Skip to main content
GET/migrations/{version}

Get Migration

Returns the record for a single applied migration identified by its version number.

The version is the monotonic integer declared in the migration file.

Returns 404 if the version does not correspond to an applied migration in the project.

Authorized by the IAM action migrations:read (every project role holds it by default; a workload needs it on its bound IAM policy; a project service token reads as its scope's role).

Parameters
version *path

The migration's version: an integer from 1 to 2147483647.

projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Responses
HTTPK9O CodeDescription
200Success
401K9O_SESSION_EXPIREDYour session has expired; re-authenticate and retry.
403K9O_ACCESS_DENIEDYou must be a project member to retrieve a specific migration.
403K9O_IAM_POLICY_DENIEDThe bound IAM policy ceiling denies migrations:read (for a workload: its bound policy does not grant it).
Response body (200)
data *object

An applied migration, with the operations it ran.

version *integer

The migration's version, an integer from 1 to 2147483647.

Versions apply in ascending order.

slug *string

The migration's slug, as given when it was submitted.

appliedAt *string <date-time>

When the migration was applied.

checksum *string

SHA-256 (hex) of the migration's canonical JSON (version, slug, up, down, policy).

Re-applying a version with a different checksum is refused.

noPolicy *boolean

True when the migration was recorded as declaring no access policy.

affectedCollections *string[]

The collections the migration's operations and policy section touch.

opPayload *any

The migration body (up and policy) as it was applied.

Null for migrations applied before bodies were recorded.

One of: object
up *any

The migration's up: one operation or an ordered array of operations, as submitted.

One of: object
or: object[]
policy *any

The migration's policy section as submitted, or null when it had none.

One of: object
or: null
or: null
meta *any

Request metadata: cost, timing and correlation ids.

TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.migrations.get('3')

Showing example in TypeScript

Response example (200)
{
  "data": {
    "version": 0,
    "slug": "string",
    "appliedAt": "string",
    "checksum": "string",
    "noPolicy": false,
    "affectedCollections": [
      "string"
    ],
    "opPayload": {}
  }
}

More in Storage & Schema