# The version history of ONE row, like a document's: who created it, who changed it last, and every change, newest first. Read from the table's transaction log (nothing extra is stored in the note), so it needs history on for the table.

`POST /datanotes/operations/row_history/` (operation `row_history`)

The version history of ONE row, like a document's: who created it, who changed it last, and every change, newest first. Read from the table's transaction log (nothing extra is stored in the note), so it needs history on for the table.

Name the row by `table` and `id` (its system UUID) or `path` (now, or before it was deleted). The row is followed by its id across renames and moves between tables (move_rows); a row without an id by its path.

- `created` / `last_modified`: when, by which operation and agent (`actor`: session, harness, model, tool, auth). `created` is null when the oldest versions were vacuumed (`history_start.truncated`); a row present when its table's history began shows that version (often CREATE TABLE, no actor).
- `versions`: `version` (of `table`), `timestamp`, `operation`, `change` (insert, update, move, delete), `source` (`external` = a hand edit: an editor, git, a sync, no agent), `actor`, `migration_id` (undo_migration), `path` and `old_path` (rename), `from_table` (move), `changes` `{column: {before, after}}`, `body_changed` and `body_diff` (lines removed and added).
- `limit` (default 50, max 1000), `since` / `before` (ISO date or date-time); pass `next_before` as `before` for the next, older page.

The whole row as it was at a version: select_rows with `version` (or `timestamp`). Every change of a table: table_changes; of the database: list_changes.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Datanotes-View-As` | header | `string` | no | Owner only, on reads only (an operation that only reads, tokens/me/, extensions/, the change stream): the request runs with this named token's permissions and read scope, and the token's last_seen does not change. A named token sending it gets 403; a request that is not a read gets 400. |

## Request body

`application/json`, required

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `table` | `string` | yes |  | The table (a dropped one by its full catalog.schema.table name). |
| `id` | `string \| null` | no | `null` | The row's system id (UUID). |
| `path` | `string \| null` | no | `null` | The row's vault path, now or before it was deleted (`.md` optional). |
| `limit` | `integer \| null` | no | `null` | Versions to return (default 50, at most 1000). |
| `since` | `string \| null` | no | `null` | ISO date or date-time: only the versions at or after it. |
| `before` | `string \| null` | no | `null` | ISO date or date-time: only the versions before it (the previous answer's `next_before`). |

## Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Done. | `object` (application/json) |
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
| 403 | A named token whose `read` patterns do not cover the table, view or note the request names (such as `token cook may not read personal.health.weight`). Sets it did not name (listings, bases, search, the graph, the change feed) are filtered instead. | `Error` (application/json) |
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
| 500 | Unexpected error. | `Error` (application/json) |

The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
