# Get Migration

`GET /migrations/{version}` · Core · Storage & Schema

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

| Name | In | Required | Description |
|---|---|---|---|
| `version` | path | yes | The migration's version: an integer from 1 to 2147483647. Example: `"3"`. |
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | An applied migration, with the operations it ran. |
| `data.version` | integer | yes | The migration's version, an integer from 1 to 2147483647. Versions apply in ascending order. |
| `data.slug` | string | yes | The migration's slug, as given when it was submitted. |
| `data.appliedAt` | string (date-time) | yes | When the migration was applied. |
| `data.checksum` | string | yes | SHA-256 (hex) of the migration's canonical JSON (`version`, `slug`, `up`, `down`, `policy`). Re-applying a version with a different checksum is refused. |
| `data.noPolicy` | boolean | yes | True when the migration was recorded as declaring no access policy. |
| `data.affectedCollections` | array of string | yes | The collections the migration's operations and policy section touch. |
| `data.opPayload` | object | yes | The migration body (`up` and `policy`) as it was applied. Null for migrations applied before bodies were recorded. |
| _one of_ | | |  |
| `data.opPayload.up` | object | yes | The migration's `up`: one operation or an ordered array of operations, as submitted. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.opPayload.policy` | object | yes | The migration's policy section as submitted, or null when it had none. |
| _one of_ | | |  |
| _or_ | | |  |
| _or_ | | |  |
| `meta` | object | yes | Request metadata: cost, timing and correlation ids. |


## Errors

| HTTP | Code | When |
|---|---|---|
| 401 | `K9O_SESSION_EXPIRED` | Your session has expired; re-authenticate and retry. |
| 403 | `K9O_ACCESS_DENIED` | You must be a project member to retrieve a specific migration. |
| 403 | `K9O_IAM_POLICY_DENIED` | The bound IAM policy ceiling denies migrations:read (for a workload: its bound policy does not grant it). |

## Code samples

### cURL

```bash
curl -X GET 'https://<org>.api-<region>.k9o.io/@storefront/migrations/latest' \
  -H 'Authorization: Bearer $K9O_TOKEN'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/migrations/latest', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`
  },
});
const { data, meta } = await res.json();
```

### @k9o/core

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

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.migrations.get("3")
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Migrations.Get(ctx, "3")
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.migrations.get("3").await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.migrations().get("3")
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Migrations.GetAsync("3")
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.migrations.get("3")
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->migrations->get('3')
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/core/get-migration
