# List Pending Migrations

`GET /migrations/pending` · Core · Storage & Schema

Returns the list of pending-migration records for the project, filterable by status (`queued`, `applied`, `rejected`, or `cancelled`) via the `?status=` query parameter. Terminal rows (`applied`, `rejected`, `cancelled`) are retained indefinitely for audit-trail integrity.

Requires any project member role (`PROJECT_VIEWER` or above). 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 |
|---|---|---|---|
| `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` | array of object | yes | Pending migrations in the requested status (default `queued`), most recently queued first. |
| `data.[]id` | string | yes | The pending migration's id (`pmig_...`). |
| `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.[]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.[]status` | enum ("queued", "pending_approval", "applied", "rejected", "cancelled") | yes | `queued`: waiting for a project admin to apply it. `pending_approval`: it touches a protected collection (or loosens a collection's gate scope), so a linked approval that a different admin must grant governs it. `applied`, `rejected`, `cancelled`: decided. |
| `data.[]affectedCollections` | array of string | yes | The collections the migration's operations and policy section touch. |
| `data.[]approvalId` | object | yes | The linked approval (`apr_...`) when the migration is governed by one; otherwise null. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.[]queuedAt` | string (date-time) | yes | When the migration was queued. |
| `data.[]queuedBy` | string | yes | The id of the principal who queued it. |
| `data.[]decidedAt` | object | yes | When it was applied, rejected or cancelled; null while undecided. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.[]decidedBy` | object | yes | The id of the principal who decided it; null while undecided. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.[]decisionReason` | object | yes | The reason recorded when it was rejected (empty when none was given) or cancelled (always empty); null while undecided or when it was applied. |
| _one of_ | | |  |
| _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 hold at least a viewer role on the project to list pending migrations. |
| 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/pending' \
  -H 'Authorization: Bearer $K9O_TOKEN'
```

### fetch

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

### k9o CLI

```bash
k9o migration pending
```

### @k9o/core

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

### k9o

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

### sdk-go

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

### k9o

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

### dev.k9o:core

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

### K9o.Core

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

### k9o

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

### k9o/sdk

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


Canonical page: https://docs.kilimanjaro.dev/api-playground/core/list-pending-migrations
