# History

> Last year's sales loaded from a file (OnTourHQ or any CSV), kept as imported counts by day and ticket type for the Overview's pace. Never orders, tickets or money here

Source: https://rcms-tickets-test.web.app/docs/reference/history

Every operation below is also in [the OpenAPI document](https://rcms-tickets-test.web.app/v1/openapi.yaml). One that names an MCP tool can be called through [the MCP server](https://rcms-tickets-test.web.app/docs/mcp.md); one that names none cannot.

## Load a past event's sales from a file (OnTourHQ or any CSV)

`POST /v1/history/imports`

Operation id `importHistory`. MCP tool `import_history`. SDK `tickets.history.import`.

Loads a PAST event's sales from a file so the Overview can say ahead of or behind last year. `source: "ontourhq"` reads an OnTourHQ "All Order Details" export by its default columns; `source: "csv"` reads any CSV by `columns`. Send `dry_run: true` first: it says what the file read as (rows, days, types, the money, every word in the status column, what it skips and why, the first problems by row, and what looks wrong in `notes`) and keeps nothing. The first real import of an `ontourhq` file must send the `dry_run_token` that dry run answered. It is imported: counts by day and ticket type, in cents, marked `imported` with provider `external`. They are never orders, tickets or money here, so no settlement, payout, webhook, door or email ever sees them. A buyer is kept only when the file marks consent (`consent_email`, `consent_sms`); a row without it keeps no person, only its count, and someone erased earlier stays out whatever the file says (`buyers.erased`). A file with no quantity column says `columns.quantity: "none"`. At most 2,000 data rows a request: a bigger file is sent in `parts`, each after the first carrying the `import_id` part 1 answered. An import may not add up to more than $100,000,000. The same part sent again changes nothing; a changed part, or a new part 1, replaces what was there.

**Who may call it.** Any one of: An API key with scope `full`. Any other scope answers `insufficient_scope`; A signed-in dashboard member whose role has `org.manage` (owner, admin).

**Request body** (`HistoryImportInput`)

| Field | Type | Description |
| --- | --- | --- |
| `event` * | string | The past event the history belongs to (a normal event of this org, usually in the series the Overview compares with). It must have no sales of its own. |
| `source` | "ontourhq" \| "csv" | ontourhq: an OnTourHQ "All Order Details" export, with its default columns. csv: any CSV, with `columns`. |
| `csv` * | string | The file's text (a leading byte-order mark and CRLF line ends are fine). At most 2,000 data rows a request: send a bigger file in parts. |
| `columns` | HistoryColumns |  |
| `timezone` | string | An IANA zone the file's times are in when they carry none (default: the organization's). |
| `part` | integer | Which part of the file this is, from 1. Part 1 starts an import and replaces any earlier one. |
| `import_id` | string | Required on every part after the first: the `import_id` part 1 answered, so a part of another file cannot join this one. |
| `dry_run_token` | string | source ontourhq, the first real import of an event: the `dry_run_token` a dry run of these same bytes answered. The default columns are a guess about the file until someone has read what the dry run says. It is a guard… |
| `parts` | integer | How many parts the file is sent in. Every request of one import says the same. |
| `skip_problems` | boolean | A row that cannot be read (a bad amount, date or quantity) stops the import by default. true: those rows are left out, and said. |
| `dry_run` | boolean | Reads the file and says what it found; nothing is kept. |

\* required

```json
{
  "event": "evt_yrd2026",
  "source": "csv",
  "csv": "Order Date,Ticket Type,Quantity,Total Paid\n2025-03-01,GA Saturday,1,$75.00\n",
  "columns": {
    "date": "Order Date",
    "ticket_type": "Ticket Type",
    "quantity": "Quantity",
    "amount": "Total Paid"
  },
  "dry_run": true
}
```

**Answers 200.** What the part read as (dry_run) or what keeping it did. A bigger file is sent in parts.

**Fields** (`HistoryImportResult`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "history_import_result" |  |
| `dry_run` * | boolean |  |
| `unchanged` * | boolean | This part was already held exactly as sent: nothing was written. |
| `import_id` * | string \| null | What every later part of this file sends as `import_id`. Null on a dry run. |
| `dry_run_token` * | string \| null | On a dry run: what the first real import of an ontourhq file sends back, to say these bytes were read first. Null on a real run. |
| `can_import` * | boolean |  |
| `blockers` * | array of string | Why it cannot be imported, in words (a column that cannot be found, another currency, problem rows without skip_problems, a part past the file). |
| `part` * | integer |  |
| `parts` * | integer |  |
| `columns` * | object | What each field was read from: the header in the file, or null when the file has none. |
| `rows` * | object |  |
| `skipped` * | array of object | Rows left out on purpose: cancelled, unpaid, duplicate_row, blank. |
| `statuses` * | array of object | Every distinct word in the status column, with how many rows say it and what it was read as. |
| `problems` * | array of object | The first problems, by row. |
| `days` * | object |  |
| `types` * | array of object |  |
| `totals` * | object |  |
| `buyers` * | object |  |
| `notes` * | array of string | What was assumed, and what looks wrong: a date with no time, a comp's price ignored, a column it could not find, sales outside the event's dates, a price per ticket that looks like a fee. Read these before the real impo… |
| `import` * | HistoryImport \| null | The event's imported history as it stands (null on a dry run, or once removed). |

\* required

**Errors of its own.** [`invalid_state_transition`](https://rcms-tickets-test.web.app/docs/errors.md#invalid_state_transition). The errors every operation can answer are on [the errors page](https://rcms-tickets-test.web.app/docs/errors.md).

## What an event holds of imported history

`GET /v1/history/imports/{id}`

Operation id `getHistoryImport`. MCP tool `get_history_import`. SDK `tickets.history.retrieve`.

What an event holds of imported history, labelled imported: totals, days and types by name. `id` is the event's id, not the `import_id` an import answers. `format=csv` answers the days and types as a CSV.

**Who may call it.** Any one of: An API key with scope `full`, `read`. Any other scope answers `insufficient_scope`; A signed-in dashboard member whose role has `read` (owner, admin, staff, viewer).

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `id` * | path | string | An id starting with evt_. |
| `format` | query | "json" \| "csv" | csv answers the imported days and types as text/csv (cells starting = + - @ escaped). |

**Answers 200.** The imported totals, labelled imported (format=csv: the days and types as a CSV).

**Fields** (`HistoryImport`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "history_import" |  |
| `event` * | string | An id starting with evt_. |
| `status` * | "loading" \| "complete" | loading: some parts are still to come, and the pace does not use it yet. |
| `source` * | "ontourhq" \| "csv" |  |
| `imported` * | true | Always true: these totals were loaded from a file and were not sold here. |
| `provider` * | "external" | The money in them was taken somewhere else. |
| `currency` * | Currency | An ISO 4217 currency in lower case. Every one listed has two minor digits. |
| `timezone` * | string |  |
| `parts` * | object |  |
| `totals` * | object |  |
| `days` * | object |  |
| `types` * | array of object |  |
| `buyers` * | object |  |
| `loaded_at` * | string (date-time) | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `expires_at` * | string \| null | When the kept buyers are removed (the event's retention period, else two years after the import). |

\* required

## Remove an event's imported history

`DELETE /v1/history/imports/{id}`

Operation id `deleteHistoryImport`. MCP tool `delete_history_import`. SDK `tickets.history.delete`.

Removes an event's imported history, buyers included. Nothing sold is touched.

**Who may call it.** Any one of: An API key with scope `full`. Any other scope answers `insufficient_scope`; A signed-in dashboard member whose role has `org.manage` (owner, admin).

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `id` * | path | string | An id starting with evt_. |

**Answers 200.** What was removed.

**Fields** (`HistoryImport`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "history_import" |  |
| `event` * | string | An id starting with evt_. |
| `status` * | "loading" \| "complete" | loading: some parts are still to come, and the pace does not use it yet. |
| `source` * | "ontourhq" \| "csv" |  |
| `imported` * | true | Always true: these totals were loaded from a file and were not sold here. |
| `provider` * | "external" | The money in them was taken somewhere else. |
| `currency` * | Currency | An ISO 4217 currency in lower case. Every one listed has two minor digits. |
| `timezone` * | string |  |
| `parts` * | object |  |
| `totals` * | object |  |
| `days` * | object |  |
| `types` * | array of object |  |
| `buyers` * | object |  |
| `loaded_at` * | string (date-time) | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `expires_at` * | string \| null | When the kept buyers are removed (the event's retention period, else two years after the import). |

\* required

**Errors of its own.** [`invalid_state_transition`](https://rcms-tickets-test.web.app/docs/errors.md#invalid_state_transition). The errors every operation can answer are on [the errors page](https://rcms-tickets-test.web.app/docs/errors.md).
