# Import event history

Moving to Ravensight from another analytics tool? Export its events as a CSV file and import them into your game. Imported events land in the game's own events as real players' events, so every page, [SQL](https://ravensight.io/docs/warehouse-sql/) and the [MCP tools](https://ravensight.io/docs/mcp/) read them beside the events your game sends.

## Which days can take events

Raw events are kept for 90 days, and an imported day has its daily and monthly totals, new players and retention rebuilt from raw events. So a day can take imported events only when that rebuild can never lower what is already stored for it:

- Days from 87 days back through yesterday. The last three days of the 90 day window are left alone, because a session there may have started on a day that is already gone, and today is still being counted.
- A day with no stored history, which is the usual case for events from before your game sent live ones, is always open.
- A day that already has stored history is closed when a rule to [keep an event shorter](https://ravensight.io/docs/event-catalogue/), or a purge, removed events from it, or when its raw events no longer add up to what was counted for it.

The check gives the first day this game can take, and refuses a row on a closed day as `day_not_rebuildable`.

## What a file needs

A CSV export with a header row, up to 20 MB and 50,000 rows. Every row needs three columns; the rest are optional.

| Field | What it holds |
| --- | --- |
| `timestamp` | When the event happened: an ISO 8601 date and time (a time with no zone reads as UTC), or unix seconds or milliseconds. Required. |
| `event` | The event name, up to 200 characters. Required. |
| `player` | A player, user or device identifier. Required. It is never stored; see Players and privacy. |
| `properties` | The event's properties as one JSON object. |
| `session` | A session identifier. Without one, a player's events start a new session after 30 minutes without an event. |
| `level` | The level, stage or map the event happened in. |
| `platform` | The platform the game ran on, up to 128 characters. |
| `game_version` | The game or app version, up to 128 characters. |

Any other column can be kept as a property named by its header, stored as text, or ignored. A column whose header names personal data (such as email, phone, IP address, address, first, last or full name, or username) cannot be kept, and neither can a header that starts with `rs_`.

## Importing from the dashboard

1. Open **Events** for the game and press **Import history**. Owners and admins see it; it is not offered on a game another studio shared with you.
2. Choose the file and press **Read the columns**. Ravensight proposes a column for each field it recognises. A column marked **Suggested** is a guess for you to confirm; a column nobody recognised starts on **Ignore this column**. Only the column headers and the shape of their values are used for suggestions, never the values themselves.
3. Press **Check the file**. Ravensight reads every row under your mapping and shows the rows read, the new events to import, the rows already imported, the refused rows by reason with their line numbers, the date range, the number of players and the price. It also warns when days in the file already have live events from your game: if the same play was sent live too, it would count twice. Nothing is written or charged by a check. Change the mapping and check again to see what the new mapping does.
4. Press **Import**, which names the number of events (such as Import 1,200 events). Imported events show an **Imported** tag on the Events page. Totals, new players, monthly history and retention for the imported days are rebuilt right after, usually within minutes.

One history import runs at a time per studio. A second one started meanwhile is refused with `history_import_running` and changes nothing; start it again once the first has finished. A game cannot be deleted while an import into it is running.

## What happens to each row

Every row is held to the same rules as an event your game sends: typed events (purchases, resources, progression, errors, health, ads, attribution) are checked and flagged the same way, the level is read from `level`, `location` or `track`, and an event's data may be up to 8 KB. Country and device fields are never filled in for an imported event. A row that cannot be imported is refused with its line and one of these reasons, and the rest of the file is still imported. Two identical lines in a file are two events, as the export lists them. A file with two columns of the same name is refused as a whole (`duplicate_header`): rename one and read it again.

| Reason | When |
| --- | --- |
| `no_timestamp` | The timestamp cell is empty. |
| `bad_timestamp` | The timestamp is not ISO 8601, unix seconds or unix milliseconds, or names a date that does not exist. |
| `too_old` | The event is older than 90 days. |
| `day_not_rebuildable` | The event is on a day that cannot take imported events; see Which days can take events. |
| `in_future` | The event is later than now. |
| `bad_name` | The event name is empty, longer than 200 characters, or has control characters. |
| `no_player` | The player cell is empty. |
| `bad_player` | The player or session cell is longer than 256 characters. |
| `bad_properties` | The properties cell is not a JSON object. |
| `reserved_key` | The properties set `rs_import`, `rs_event_id` or `rs_link`, which Ravensight writes itself. |
| `bad_value` | The level, platform or game version is longer than 128 characters or has control characters. |
| `too_large` | The event's data is more than 8 KB. |
| `error_capture_off` | An automatic error, while error capture is off for the game. |
| `too_many_cells` | The row has more than 200 cells. |
| `already_imported` | The same line of the file was imported before under a different mapping. |
| `storage_refused` | Event storage refused the row's data. It is not charged. |
| `changes_closed_day` | Importing the row would change a day that cannot take imported events: it continues a session already imported onto such a day, or it comes before its player's first day and that day is such a day. |
| `player_erased` | The player was erased; their rows are never imported again. |
| `row_limit` | Past the 50,000th row. |

## Players and privacy

The player identifier in the file is never stored. Each one becomes a private player id for this game, made with a one-way key that belongs to the game, so an email address in an export never appears in your events, and the same identifier in two games is two unrelated players. Session identifiers are treated the same way. Imported players are counted as their own players: they do not merge with devices your game's SDK reports.

Sessions carry across files. With no session column, a player's events that come within 30 minutes of an event already imported for them continue that session, so a session that crosses midnight, exported as two daily files, still counts once. A session identifier that comes back after a long gap starts a new session rather than counting the old one twice.

To erase an imported player, send the identifier as it appeared in the export: `POST /api/v1/games/{gameId}/devices/erase-imported` with `{"identifier": "..."}`. Ravensight works out the private id with the game's key and erases that player's events the same way it erases any player. Only the owner can erase, the identifier is not kept or logged, and the audit log records the erasure without it. An erased player stays erased: importing the same file again refuses their rows as `player_erased`. The same holds when you erase the private id itself with `DELETE /api/v1/games/{gameId}/devices/{deviceId}`, and you can erase a player before your first import, so the file you import afterwards leaves them out. While an import into the game is running, an erasure answers `409 history_import_running`: the player is already kept out of every later import, and you erase again once the running one finishes, within the hour.

Each imported event carries `rs_import`, the id of the import it came in by, so a filter, a SQL query or an export can tell imported events from live ones. A live event cannot set it.

## Importing again

Importing the same file again imports and charges nothing more: every event has a stable id made from its content, and every line of the file is remembered, so an event already imported is skipped, and the same lines under a different mapping are refused as `already_imported` rather than imported twice. An export that overlaps an earlier one imports only the events that are new. If an import stops part way (the balance ran out, or events could not be stored), import the same file again to finish it.

Now and then event storage does not confirm a batch it was sent. Those rows are reported as `uncertain`: the events they need stay held on your meter, not refunded and not charged twice, until Ravensight counts what event storage holds, keeps exactly that and releases the rest. The next import of the same file counts first and sends only the rows storage does not hold, so each event is stored and charged once. Left alone, an unconfirmed batch is settled by Ravensight within about two hours. In the rare case that event storage still holds only part of a batch a week later, the rows it holds are kept and charged, the rest are released so the same file imports them again, and the audit log records it as **Event history batch settled**.

## Price

Each imported event counts as one event on your shared event meter, the same as a live event: this month's included events first, then your prepaid balance in event blocks at the ordinary rate. There is no separate price for imports. The check shows the events an import would use and, to the owner, what it would draw from the balance; an admin is told it comes from the studio's prepaid balance, which only the owner can see. Each batch is held on the meter before it is written, so an empty balance stops the import before anything is stored; afterwards what event storage holds is kept and the rest of the hold released. Import writes events until the balance runs out, keeps and charges what was written, then stops; nothing past that point is written or charged. Add funds in Billing, then import the same file again to finish. Rows that are refused or already imported are free.

Imported events are left out of the lateness figures in data quality, and days with imported events are left out of market benchmarks, so neither reads old events as late or as live play.

## From an agent or the API

With a dashboard session, `POST /api/v1/games/{gameId}/history-import/preview` takes `{"csv": "...", "mapping": {...}}` (the mapping is optional) or the CSV itself as `text/csv`, and answers the mapping, the summary and the price. `POST /api/v1/games/{gameId}/history-import` takes `{"csv": "...", "mapping": {...}}` and answers the import id and its counts. A mapping is `{ "header": "field" }` with the fields above, `carry` to keep a column as a property, or `ignore`. Both need an owner or admin; another studio's game answers 404, an empty balance answers `429 quota_exceeded` with `reason: "needs_funds"`, a game with tracking off answers `403 tracking_disabled`, and a second import while one runs answers `409 history_import_running`. A file that arrives slower than 100 KB a second (measured once its first 10 seconds have passed) or takes longer than 10 minutes in all answers `408 history_import_timeout`, a JSON body that is not one CSV string and one mapping object answers `400 invalid_body`, a compressed body (any `Content-Encoding`) answers `415 unsupported_encoding` (send the file uncompressed), a file whose players already have more than 200,000 imported events around its times answers `400 too_many_stored_neighbours` (import a narrower time range), and while other files are being read, or another of your studio's, the answer is `503 history_import_busy` with `Retry-After`. The import answers `imported`, `alreadyImported`, `uncertain`, `notImported` and `stopped` (why it stopped part way, or null).

Agents use `preview_event_history_import` and `import_event_history` over [MCP](https://ravensight.io/docs/mcp/), up to 1 MB of CSV per call. The import tool needs a token with writes allowed.

Source: https://ravensight.io/docs/history-import/
Last updated: 2026-11-20
