> For the complete documentation index, see [llms.txt](https://docs.realmacsoftware.com/elements-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmacsoftware.com/elements-docs/cms/json-rest-api/reference/versions.md).

# Versions

Every write to an item can produce a version-history snapshot. These routes expose that history.

{% hint style="info" %}
Version history depends on the site's license limits. This is in addition to the whole-API JSON access gate.
{% endhint %}

{% hint style="warning" %}
The JSON API router declares read and restore routes with a `{version}` path segment, while the current editor handler expects that value internally as `timestamp`. Until that adapter is aligned, use the Online Editor for reading or restoring a specific historical version.
{% endhint %}

### `GET /cms/collections/{collection}/items/{slug}/versions`

List versions for an item, newest first.

| Field | Value            |
| ----- | ---------------- |
| Auth  | Required         |
| Role  | Any API key user |

Response:

```json
{
  "versions": [
    { "timestamp": 1713611100, "size": 1204 },
    { "timestamp": 1713607273, "size": 1100 }
  ],
  "current": {
    "modified": 1713612200,
    "size": 1280
  }
}
```

`timestamp` values are integer Unix timestamps.

### `GET /cms/collections/{collection}/items/{slug}/versions/{version}`

Read a single historical version's full content.

| Field | Value            |
| ----- | ---------------- |
| Auth  | Required         |
| Role  | Any API key user |

Pending adapter alignment for external JSON API clients.

### `POST /cms/collections/{collection}/items/{slug}/versions/{version}/restore`

Promote a historical version back to current. This writes a new version on top of history. It does not rewrite history.

| Field | Value            |
| ----- | ---------------- |
| Auth  | Required         |
| Role  | Any API key user |

Pending adapter alignment for external JSON API clients.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.realmacsoftware.com/elements-docs/cms/json-rest-api/reference/versions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
