Skip to main content

Versions

List, diff, and roll back a Spec's published field versions. Versioning is append-only: every publication snapshots the fields for history, diffing, and audit.

Spec versioning is append-only. Each version is an immutable snapshot of the Spec's field definitions at the moment it was published (a draft was promoted), retained for history and diffing. These endpoints let you list versions newest first, diff any two by their version numbers, fetch one by number, and roll back to an earlier version. A Spec that has never published a version returns an empty array.

A rollback never deletes history. POST .../versions/rollback creates a new active draft named Rollback to v<n> whose fields copy the target version, recording the version you rolled away from as its base_version_number. The response is that draft, not a new version: the version chain advances only when the draft is promoted (published), at which point the rollback becomes the newest version. Until then the live Spec is unchanged, so a rollback is always reviewable before it takes effect.

The diff endpoint compares any two versions field by field. Its response carries entries (one per field, with a status of added, removed, modified, or unchanged, the field's shape on each side, and the individual changes), the summary arrays fieldsAdded / fieldsRemoved / fieldsModified, and an isBreaking flag for changes that would break downstream consumers of the produced table, such as a removed field.

GET/v1/schemas/{id}/versions
GET/v1/schemas/{id}/versions/diff

Query parameters

from*integerThe base version number.
to*integerThe target version number.
GET/v1/schemas/{id}/versions/{versionNumber}

Path parameters

id*stringSpec (schema) UUID.
versionNumber*integerThe version number to fetch.
POST/v1/schemas/{id}/versions/rollback

Body parameters

version_number*integerThe version number to roll the Spec back to (minimum 1).

Diff two versions

curl -s "https://api.talonic.com/v1/schemas/a1b2c3d4-e5f6-7890-abcd-ef1234567890/versions/diff?from=2&to=3" \
  -H "Authorization: Bearer tlnc_your_api_key"

Response

The list endpoint returns a bare array of version snapshots, newest first. Each snapshot is the persisted user_schema_versions row: the monotonic version_number, the fields captured at publication, a field_count, who promoted it (promoted_by, a user UUID, null for system publications), and timestamps. Versions are immutable — nothing on this surface edits one.

Version fields

idstringVersion row UUID.
version_numberintegerMonotonic version number.
fieldsarrayThe field definitions captured at this version.
field_countintegerNumber of fields in the snapshot.
promoted_bystring | nullUUID of the user who promoted the draft into this version, or null.
promoted_atstring | nullISO 8601 promotion timestamp.
notesstring | nullOptional publication notes.
created_atstringISO 8601 timestamp the version was created.

Response (GET versions/diff)

{
  "entries": [
    {
      "fieldName": "total",
      "status": "added",
      "liveField": null,
      "draftField": { "field_name": "total", "data_type": "number" },
      "changes": []
    },
    {
      "fieldName": "invoice_number",
      "status": "unchanged",
      "liveField": { "field_name": "invoice_number", "data_type": "string" },
      "draftField": { "field_name": "invoice_number", "data_type": "string" },
      "changes": []
    }
  ],
  "fieldsAdded": ["total"],
  "fieldsRemoved": [],
  "fieldsModified": [],
  "isBreaking": false
}

Rollback returns the draft it created — name Rollback to v<n>, status active, fields copied from the target, and base_version_number recording the version that was current when you rolled back. Promote (publish) that draft to make the rollback the live version; discard it to abandon the rollback with no effect on the Spec.

Rollback is non-destructive and staged: it creates an active draft copying the target rather than touching the chain, and only publishing that draft appends the new version. The intervening versions all remain listed, so you can always roll forward again.

Errors

Error responses

400validation_errorMissing or non-integer from/to query params, or an invalid version_number.
401unauthorizedMissing or invalid API key.
404not_foundNo Spec (schema) or version with this ID/number exists for your organization.
429rate_limitedToo many requests. Retry after the period indicated in the Retry-After header.

Frequently asked questions

Does rolling back delete the versions after the target?+
No. Versioning is append-only. A rollback creates an active draft that copies the target; publishing that draft appends a new version, leaving the intervening versions intact for history and so you can roll forward again.
How do I compare two versions?+
Call GET /v1/schemas/{id}/versions/diff?from=<n>&to=<n> with the two version numbers. The response carries per-field entries (added / removed / modified / unchanged, with the concrete changes), the summary arrays fieldsAdded / fieldsRemoved / fieldsModified, and an isBreaking flag.
What creates a new version?+
Publishing: a version is minted when a draft of the Spec's fields is promoted — whether the draft came from the Spec editor, the schemas API, or a rollback. Each publication appends an immutable snapshot with the next monotonic version_number.
Does rollback change the live Spec immediately?+
No. It only creates the "Rollback to v<n>" draft; the live fields stay as they are until that draft is published. This makes rollback safe to stage and review — discard the draft and nothing happened.