# API reference

This page is the platform API: every route under `https://durablesdk.com/api/v1`, what it takes, what it answers and the scope it needs. It teaches the shapes a client branches on and the rules every request keeps; `curl` is the client here, and [the CLI](https://durablesdk.com/docs/reference/cli.md) is the same routes with a verb each.

The machine twin of this page is [`/openapi.json`](#openapi); the error codes are on [Errors](https://durablesdk.com/docs/reference/api/errors.md).

## The base and the credentials

The base is `https://durablesdk.com/api/v1` (`api.durablesdk.com` is an alias of the same routes, for a reader's eye). A request carries one of two credentials:

- **An API key** as `Authorization: Bearer dsk_live_…`: the credential a CI job, an agent or a script holds. Minted by a person on the dashboard or by `durable-sdk login`; one scope; revocable; see [Accounts and keys](https://durablesdk.com/docs/operate/accounts-and-keys.md).
- **The dashboard's session**: what the dashboard itself uses. A session request is admitted only when `Sec-Fetch-Site: same-origin` (or, absent, `Origin` exactly the product's origin), `X-Durable-Org` names the active organization, and a body's `Content-Type` is `application/json`; any miss is 403 `plane.auth.origin_refused`. The API sends no CORS header, so a browser page on another origin cannot call it with a session; use a key.

The tenant is the key's or the session's active organization, resolved by the gate and set on every read and write under it; nothing in a path, a query or a body names a tenant.

**Scopes** are a ladder, `read` < `deploy` < `admin`: a route marked `deploy` admits `deploy` and `admin`. A key short of a route's scope is 403 `plane.key.scope_short`. A session's scope is its role's: `org:admin` is `admin`, `org:member` is `deploy`.

```bash
export DURABLE_API_KEY="dsk_live_…"
curl -s https://durablesdk.com/api/v1/whoami \
  -H "Authorization: Bearer $DURABLE_API_KEY"
```

```json
{
  "tenant": {
    "id": "7c1e…",
    "slug": "acme",
    "name": "Acme",
    "plan": "free",
    "region": "us-east"
  },
  "principal": {
    "kind": "key",
    "id": "k_7f2a",
    "name": "ci on github",
    "scope": "deploy",
    "expiresAt": "2027-01-26T09:00:00Z"
  }
}
```

## Every answer

- JSON, `Cache-Control: no-store`, `X-Durable-Plane: <major>.<minor>` (the API's version; its current value is `info.version` of [`/openapi.json`](#openapi)), `Content-Security-Policy: frame-ancestors 'none'`, `X-Frame-Options: DENY`.
- A list is `{ "items": T[], "nextCursor": string | null }`, read with `?limit=` (50 by default, at most 200) and `?cursor=<the previous nextCursor>`.
- An error is `{ "error": { "code", "message", "remedy", "docs" } }` with its status: 400 a refused value, 401 no credential, 403 a scope short or an origin refused, 404 not under the tenant (never 403: a row of another tenant does not exist here), 409 a conflict, 422 a validation, 429 a quota or a rate bucket with `Retry-After`, 503 the platform's own provider down with `Retry-After`. `code` is a row of the registry (`plane.<area>.<word>`), `docs` the absolute link to its row on [Errors](https://durablesdk.com/docs/reference/api/errors.md).
- A mutating route starts a keyed run and answers at once with the row and its `runId`; the run continues past the answer. A run that fails against the platform's own providers is compensated and **finished as a value**: the app or the deployment reads `failed` with an `error`, never a run stranded for you. Only a run whose irreversible step failed stays in limbo, listed by `GET /runs?state=limbo` and redriven by `POST /runs/:runId/redrive`.

### Idempotency-Key

Every mutating route that starts a run (`POST /apps`, `PATCH` and `DELETE /apps/:slug`, `restore`, an environment's `DELETE`, `POST /apps/:slug/deployments` and a deployment's `promote`, `rollback`, `cancel` and `redeploy`, the keys, the secrets, the domains, the repository and its `deploy`, the read string, `redrive`) takes `Idempotency-Key: <[A-Za-z0-9_-]{1,64}>`. The platform prefixes it with the tenant id and holds it 24 hours:

- the same key and the same body again → 200 with the first run's row (`deduplicated`);
- the same key after the run completed, where the answer carried a one-time value (a minted key, a read string) → the row with that field `null` and the code `plane.value_shown_once`;
- the same key with a different body → 409 `plane.idempotency.mismatch`.

Mint one per intent (a UUID), resend it on every retry of that intent, and never reuse it for another. The CLI does this on every `deploy`.

The upload routes start no run and read no key; an upload is resumed, never replayed: a part is idempotent by its number and SHA (`PUT /uploads/:id/parts/:n`), `complete` by the upload (a second `POST /uploads/:id/complete` answers the same row), `GET /uploads/:id` says what landed, and an open whose answer was lost is opened again (`POST /apps/:slug/uploads` makes a new upload each time; the orphan expires in an hour). `POST /cli/logins`, the token poll and the console proxy take no key either.

### Rate buckets

Per key 600 a minute, per user 600 a minute, per tenant 2 000 a minute over every principal, deployments 60 an hour, provisioning 10 an hour, the console proxy 120 a minute, logins 10 an hour per address. A spent bucket is 429 with `Retry-After`; the numbers are entitlements a tier may raise.

## Routes

Paths are relative to the base. "Scope" is the least scope admitted; `none` needs no credential; `any` needs a credential of any scope.

### Identity and keys

| Route                        | Scope | What                                                                                                                                                                                                                                                                                                                                                                                    |
| ---------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /whoami`                | any   | The tenant and the principal (above).                                                                                                                                                                                                                                                                                                                                                   |
| `POST /cli/logins`           | none  | Opens a device login: `{ client, hostname, scope? }` → `{ id, pollSecret, userCode, verifyUrl, expiresAt, intervalSeconds }`. Ten an hour per address.                                                                                                                                                                                                                                  |
| `POST /cli/logins/:id/token` | none  | Polled with `Authorization: Bearer <pollSecret>` every `intervalSeconds`: `{ status: "pending" }`, 429 `plane.login.slow_down`, 400 `plane.login.expired`, 400 `plane.login.denied`, a wrong secret or id 404 `plane.login.not_found`; once approved `{ status: "approved", apiKey, tenant: { slug, name }, scope, expiresAt }` once, then every later poll 409 `plane.login.consumed`. |
| `GET /keys`                  | read  | The tenant's keys, paged: `ApiKey { id, name, prefix, scope, owner, createdAt, expiresAt, lastUsedDay, revokedAt }`; `?owner=user:<id>` the keys one person minted (422 `plane.body.invalid` off the grammar).                                                                                                                                                                          |
| `POST /keys`                 | user  | `{ name, scope, expiresDays: 30 \| 90 \| 365 }` → `{ key, id, prefix }`, `key` shown once. A session principal alone; a key is 403 `plane.key.mint_by_person`.                                                                                                                                                                                                                          |
| `DELETE /keys/:id`           | read  | Revokes: the minter their own, an admin any.                                                                                                                                                                                                                                                                                                                                            |
| `GET /regions`               | any   | `{ items: [{ id, label, city }] }`: the product's region words.                                                                                                                                                                                                                                                                                                                         |

```bash
curl -s -X POST https://durablesdk.com/api/v1/cli/logins \
  -H "Content-Type: application/json" \
  -d '{"client":"durable-sdk","hostname":"laptop.local","scope":"deploy"}'
```

```json
{
  "id": "0b7a1c2e-…",
  "pollSecret": "…",
  "userCode": "K7MP3XQW",
  "verifyUrl": "https://durablesdk.com/cli/authorize?code=K7MP-3XQW",
  "expiresAt": "2026-10-28T14:12:00Z",
  "intervalSeconds": 5
}
```

### The organization's members

| Route                             | Scope | Answer                                                                                                                                                                                                          |
| --------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /members`                    | read  | The members, paged: `Member { userId, name, email, imageUrl, role: admin \| member, scope, joinedAt, lastActiveAt, keys, you }`; `?q=` over the names and addresses, `?role=admin \| member`.                   |
| `GET /members/seats`              | read  | `{ members, pending, cap, admins }`: the pending invitations count with the members; `cap` null for no limit.                                                                                                   |
| `GET /members/invitations`        | admin | The pending invitations, paged: `Invitation { id, email, role, sentAt, expiresAt, expired, invitedBy }`; the addresses are an admin's.                                                                          |
| `POST /members/invitations`       | admin | `{ email, role }` answers `Invitation` + `runId`, 201. A person alone: a key is 403 `plane.member.by_person`; past the seats 403 `plane.member.seats_full`; already invited 409 `plane.member.already_invited`. |
| `DELETE /members/invitations/:id` | admin | `{ id, revoked }` + `runId`; a settled invitation answers `revoked: false`. A person alone.                                                                                                                     |
| `PATCH /members/:userId`          | admin | `{ role }` answers `Member` + `runId`; never your own row (409 `plane.member.self`), the last admin stays (409 `plane.member.last_admin`); a demotion revokes their keys. A person alone.                       |
| `DELETE /members/:userId`         | admin | `{ userId, removed, keysRevoked }` + `runId`; never your own row, the last admin stays. A person alone.                                                                                                         |
| `POST /members/leave`             | user  | `{ userId, removed, keysRevoked }` + `runId`: the caller leaves for themselves alone; the last admin stays.                                                                                                     |
| `PATCH /organization`             | admin | `{ name }` answers `{ id, name, slug, region, plan }` + `runId`; the slug stays. A person alone: a key is 403 `plane.organization.by_person`.                                                                   |
| `DELETE /organization`            | admin | `{ tenantId, deleted, keysRevoked, appsHeld }` + `runId`: every key revoked, every app into the hold, the members lose it. A person alone.                                                                      |

### Apps and environments

| Route                                   | Scope  | What                                                                                                                                                                                                                      |
| --------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /apps`                             | read   | The tenant's apps, paged; `?q=` narrows to a slug or a name holding the text, `?status=` and `?region=` to one word each, `?sort=` orders `newest` (the default), `oldest` or `name`. An unknown value is 400 by name.    |
| `POST /apps`                            | admin  | `{ slug, region? }` → `App` in `provisioning` with `runId`. The tier's `apps` count judged at the door (a held app counts); a failed provisioning answers the app `failed` with its `error`, and `DELETE` frees the slug. |
| `GET /apps/:slug`                       | read   | The `App`.                                                                                                                                                                                                                |
| `PATCH /apps/:slug`                     | admin  | `{ promotionRule: "auto" \| "manual" }`.                                                                                                                                                                                  |
| `DELETE /apps/:slug`                    | admin  | The hold starts: the hostnames stop answering within the minute, the row reads `deleted`, the slug stays reserved for `delete_hold_days`, then the purge.                                                                 |
| `POST /apps/:slug/restore`              | admin  | Within the hold; 409 `plane.app.not_held` otherwise.                                                                                                                                                                      |
| `GET /apps/:slug/environments`          | read   | `Environment[]`: `production` and every preview.                                                                                                                                                                          |
| `DELETE /apps/:slug/environments/:name` | deploy | A preview removed at once; `production` is 422 `plane.environment.production`.                                                                                                                                            |

```
App { id, slug, name, region, status: "provisioning" | "active" | "failed" | "deleted",
      hostname, promotionRule: "auto" | "manual", createdAt, deletedAt,
      currentDeployment: { id, state, createdAt } | null }
Environment { name, kind: "production" | "preview", branch, hostname, currentDeploymentId,
              tick: "cron" | "request-only", database: { status } }
```

A preview's `tick` is `request-only`: the minute cron runs on the production deployment alone, so a timer on a preview resumes at the preview's next request.

```bash
curl -s -X POST https://durablesdk.com/api/v1/apps \
  -H "Authorization: Bearer $DURABLE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"slug":"my-app","region":"us-east"}'
```

```json
{
  "id": "a_01JB…",
  "slug": "my-app",
  "name": "my-app",
  "region": "us-east",
  "status": "provisioning",
  "hostname": "my-app.durablesdk.com",
  "promotionRule": "auto",
  "createdAt": "2026-10-28T13:58:00Z",
  "deletedAt": null,
  "currentDeployment": null,
  "runId": "r_01JB…"
}
```

### Uploads and deployments

| Route                                | Scope  | What                                                                                                                                                                                                                                                                                                     |
| ------------------------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `POST /apps/:slug/uploads`           | deploy | `{ bytes, sha256 }` of the gzipped tarball → `{ id, partBytes: 4194304, maxBytes, expiresAt }`. The tier's `upload_mb` is judged here; the upload belongs to this app and this principal and expires in an hour.                                                                                         |
| `PUT /uploads/:id/parts/:n`          | deploy | The raw part, `n` from 1, every part but the last exactly `partBytes`, `Content-SHA256` required and checked → `{ received: number[] }`. The same `n` with the same SHA is 200 and idempotent; a different SHA 409 `plane.upload.part_conflict`; any part after `complete` 409 `plane.upload.completed`. |
| `GET /uploads/:id`                   | deploy | `{ received, state }` for a resume.                                                                                                                                                                                                                                                                      |
| `POST /uploads/:id/complete`         | deploy | `{ sha256 }` → `{ id, bytes, parts }`; `plane.upload.incomplete` names the missing parts, `plane.upload.sha_mismatch` a wrong whole.                                                                                                                                                                     |
| `POST /apps/:slug/deployments`       | deploy | `{ uploadId, target: "production" \| "preview", branch?, message? }` → `Deployment` in `queued` with `runId`. `"staging"` is 403 `plane.tier.staging` (coming, DS-035).                                                                                                                                  |
| `GET /apps/:slug/deployments`        | read   | Paged; `?target=`, `?state=` (one of the states below) and `?source=` (`cli_upload`, `template`, `redeploy`, `git`) narrow.                                                                                                                                                                              |
| `GET /deployments/:id`               | read   | The `Deployment`.                                                                                                                                                                                                                                                                                        |
| `GET /deployments/:id/events?since=` | read   | `DeploymentEvent[]`, `since` an ISO instant or the previous `nextCursor`; cached three seconds.                                                                                                                                                                                                          |
| `POST /deployments/:id/promote`      | deploy | A `ready` production deployment under the `manual` rule.                                                                                                                                                                                                                                                 |
| `POST /deployments/:id/rollback`     | deploy | The production hostname points at this deployment again; the row `rolled_back`. A rollback that would need the schema's down is `plane.deploy.down_pending` (coming, DS-008).                                                                                                                            |
| `POST /deployments/:id/cancel`       | deploy | While `queued` or `building`; 409 `plane.deploy.not_cancellable` once `ready`.                                                                                                                                                                                                                           |
| `POST /deployments/:id/redeploy`     | deploy | The same files under the project's current variables → a new `Deployment`.                                                                                                                                                                                                                               |

```
Deployment { id, app, target, branch, state, url, sha256, bytes, message, createdBy,
             createdAt, finishedAt, checkedAt, promotedAt,
             error: { code, message, remedy, docs } | null,
             check: { verdict: "ok" | "warn" | "fail", rows: [{ name, verdict, detail }] } | null,
             runId }
DeploymentEvent { at, level: "info" | "error", text }
```

`state` is one of `queued`, `building`, `checking`, `ready` (a preview's end, or a production build checked and awaiting its promotion), `promoted`, `failed`, `cancelled`, `rolled_back`. `url` is the product's hostname for that deployment: `https://<slug>-<short id>.durablesdk.com` for a production build, `https://<slug>-git-<branch>.durablesdk.com` for a preview. The build's bounds: 10 000 entries, 100 MB unpacked, 10 MB a file, each refused by name at the entry that crosses it. [Deploying](https://durablesdk.com/docs/hosting/deploy.md) walks the whole.

```bash
# 1. open
curl -s -X POST "https://durablesdk.com/api/v1/apps/my-app/uploads" \
  -H "Authorization: Bearer $DURABLE_API_KEY" -H "Content-Type: application/json" \
  -d "{\"bytes\":$(stat -f%z tree.tgz),\"sha256\":\"$(shasum -a 256 tree.tgz | cut -d' ' -f1)\"}"
# 2. one part (a tree under 4 MiB)
curl -s -X PUT "https://durablesdk.com/api/v1/uploads/$UPLOAD/parts/1" \
  -H "Authorization: Bearer $DURABLE_API_KEY" -H "Content-Type: application/octet-stream" \
  -H "Content-SHA256: $(shasum -a 256 tree.tgz | cut -d' ' -f1)" --data-binary @tree.tgz
# 3. complete, then deploy
curl -s -X POST "https://durablesdk.com/api/v1/uploads/$UPLOAD/complete" \
  -H "Authorization: Bearer $DURABLE_API_KEY" -H "Content-Type: application/json" \
  -d "{\"sha256\":\"$(shasum -a 256 tree.tgz | cut -d' ' -f1)\"}"
curl -s -X POST "https://durablesdk.com/api/v1/apps/my-app/deployments" \
  -H "Authorization: Bearer $DURABLE_API_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d "{\"uploadId\":\"$UPLOAD\",\"target\":\"production\",\"message\":\"first\"}"
```

### Secrets

| Route                              | Scope  | What                                                                                                                                                                                                                                                                  |
| ---------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /apps/:slug/secrets`          | deploy | `Secret { name, targets, setBy, setAt }[]`: names and stamps, never a value.                                                                                                                                                                                          |
| `PUT /apps/:slug/secrets/:name`    | deploy | `{ value, targets?: ("production" \| "preview")[], redeploy?: boolean }`. The value is sealed before any run and written as the project's sensitive variable; the platform keeps no value. A reserved name (the platform's own variables) is `plane.secret.reserved`. |
| `DELETE /apps/:slug/secrets/:name` | deploy | Removed from the targets; applies at the next build.                                                                                                                                                                                                                  |

A change applies at the next build; `redeploy: true` makes one from the current production deployment. [Secrets](https://durablesdk.com/docs/hosting/secrets.md).

### Domains

| Route                                   | Scope  | What                                                                                                                 |
| --------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------- |
| `GET /apps/:slug/domains`               | deploy | `Domain { hostname, kind: "platform" \| "custom", status, challenge: { type, name, value } \| null, verifiedAt }[]`. |
| `POST /apps/:slug/domains`              | deploy | `{ hostname }` → the `Domain` with its TXT challenge. Pro and up; the Free tier is 403 `plane.tier.custom_domain`.   |
| `POST /apps/:slug/domains/:name/verify` | deploy | Checks the record; `verifiedAt` set when it stands.                                                                  |
| `DELETE /apps/:slug/domains/:name`      | deploy | Removed. `<slug>.durablesdk.com` always stands beside a custom domain.                                               |

### Repository

| Route                                        | Scope  | What                                                                                                                                                             |
| -------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /apps/:slug/repository`                 | read   | `Repository { app, connection: { installationId, account: { login, type }, repoId, repo, defaultBranch } \| null }`: the connected repository, or none.          |
| `POST /apps/:slug/repository`                | admin  | `{ installationId, repoId, defaultBranch? }` → the `Repository` with its `runId`; every push deploys from then on. The installation itself is made in a browser. |
| `PATCH /apps/:slug/repository`               | admin  | `{ defaultBranch }` → the `Repository` with its `runId`: the production branch changed in place; the installation and the repository stay.                       |
| `POST /apps/:slug/repository/deploy`         | deploy | The production branch at its head deployed to production as a push would: the `Deployment` queued (202) with its `runId`; a push of the same commit lands on it. |
| `DELETE /apps/:slug/repository`              | admin  | Clears the connection: `{ app, disconnected: true }`; a push deploys nothing after it.                                                                           |
| `GET /apps/:slug/repositories?installation=` | read   | The repositories an installation of the GitHub App offers, paged: `{ id, fullName, defaultBranch, private }`.                                                    |

What deploys on which push, the check run and the comment on the commit are on [GitHub](https://durablesdk.com/docs/hosting/github.md).

### Database

| Route                                          | Scope | What                                                                                                                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `GET /apps/:slug/database`                     | read  | `Database { status, region, compute: { minCu, maxCu, suspendSeconds, state, lastActiveAt, suspendedAt }, storageBytes, history: { days, retainedUntil }, maintenanceWindow, branches: [{ name, kind, sizeBytes, createdAt }], live, readString: { present, createdAt, rotatedAt } }`: the row's facts, and the live half read once a minute (`live: false` leaves it null or empty). |
| `POST /apps/:slug/database/read-string`        | admin | Mints the one read-only role and answers `{ url }` once (`postgresql://read_…@…/…?sslmode=require`); a standing role is 409 `plane.database.read_string_exists` with the remedy `rotate`.                                                                                                                                                                                            |
| `POST /apps/:slug/database/read-string/rotate` | admin | A new password; the new `url` once.                                                                                                                                                                                                                                                                                                                                                  |
| `DELETE /apps/:slug/database/read-string`      | admin | Drops the role.                                                                                                                                                                                                                                                                                                                                                                      |

The read role is read-only by grant, with a connection limit of 5 and a 30 s statement timeout. [Database](https://durablesdk.com/docs/hosting/database.md).

### Logs, usage, limits, status

| Route                                         | Scope | What                                                                                                                                                                                                                |
| --------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /apps/:slug/logs?env=&level=&q=&follow=` | read  | The current deployment's runtime lines for at most 30 s (`follow=1` up to five minutes), `level` and `q` filtered on the platform, each line redacted and masked, at most 256 lines; `retentionDays` on the answer. |
| `GET /apps/:slug/usage?days=`                 | read  | `UsageDay { day, runs, events, failedRuns, invocations, activeCpuHours, transferGb, dbStorageGb, dbCuHours }[]`.                                                                                                    |
| `GET /apps/:slug/limits`                      | read  | `Limits { plan, entitlements: Record<key, number \| boolean \| null>, usage: UsageDay, engine }`; `engine` is the app's own `GET limits` answer (the time contract).                                                |
| `GET /apps/:slug/status`                      | read  | `Status { app, environment, deployment: { id, state, promotedAt, url } \| null, api: { version, reachable, latencyMs }, health: { ok, limbo, schema, instance } \| { error }, readAt }`.                            |

### The console proxy

`ANY /apps/:slug/console/<path>` forwards to the app's own operator API at `https://<slug>.durablesdk.com/admin/api/<path>` under a session the platform signs for the principal: a `GET` under `read`, an action under `deploy`, a destructive entry under `admin`. The path after `console/` must be a route of the operator contract (an unknown one is 404 at the platform; the app is never asked). Exactly `Content-Type`, `Accept`, `If-None-Match` and `X-Durable-Api` cross with the signed session and the app's bearer; `Cookie`, `Authorization` and `X-Durable-Org` never do. The answer comes back with its status, `ETag`, `X-Durable-Api` and `X-Durable-Truncated`; a redirect is 502 `plane.console.redirected`, a non-JSON body 502 `plane.console.not_json`, 20 s is 504 `plane.console.timeout`. The routes themselves are the operator contract's, listed in the OpenAPI document under `/apps/{slug}/console/<path>`.

```bash
curl -s "https://durablesdk.com/api/v1/apps/my-app/console/runs/limbo" \
  -H "Authorization: Bearer $DURABLE_API_KEY"
```

### The platform's runs

| Route                       | Scope  | What                                                                                                                      |
| --------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| `GET /runs?state=`          | read   | The tenant's platform runs, paged; `state=limbo` the stranded ones.                                                       |
| `GET /runs/:runId`          | read   | `Run { id, workflow, state, startedAt, finishedAt, steps: [{ name, state, error }], error }`; never an input or an image. |
| `POST /runs/:runId/redrive` | deploy | Redrives a run in limbo; 409 `plane.run.not_in_limbo` otherwise; 404 for another tenant's run.                            |

### Explain and the document

| Route                | Scope | What                                                              |
| -------------------- | ----- | ----------------------------------------------------------------- |
| `GET /explain?code=` | none  | The registry row: `{ id, status, sentence, trap, remedy, docs }`. |
| `GET /openapi.json`  | none  | The document below.                                               |

## OpenAPI

`https://durablesdk.com/openapi.json` (also `GET /api/v1/openapi.json`) is an OpenAPI 3.1 document rendered from the route table every handler is bound from, so it cannot drift from the routes: every operation with its summary, scope (`x-scope`), parameters, request body, answer schema and the error schema `PlaneError` (`{ error: { code, message, remedy, docs } }`, nothing else), plus the operator contract's catalogue under `/apps/{slug}/console/<path>` with its own `X-Durable-Api` version. `info.version` is the API's version, the current value every answer carries in `X-Durable-Plane`.

The CLI's `--json` prints these answers verbatim, so a response schema here is a verb's output schema too.

---

Prompt for an agent:

```text
Read https://durablesdk.com/docs/reference/api.md, then call the platform API route that does what the page names, with an API key as bearer and an Idempotency-Key on every mutating route that starts a run; run durable-sdk doctor --host before and after; a refused line is a refusal id: durable-sdk explain <id>
```
