> Docs index: https://movekit.com/llms.txt. HTML version: https://movekit.com/docs/api/create-deliveries

# Create deliveries

Creates download links for owned videos and posters in request order.

- Method and path: `POST /v1/deliveries`
- URL: `https://api.movekit.com/v1/deliveries`
- Requires: Owned or sample content
- Authentication: `Authorization: Bearer $MOVEKIT_API_KEY`.
- Operation id: `createDeliveries`

The whole request fails if any asset is unknown, unowned or unavailable.

## Rules

- With no key, the sample exercises are the owned ones.

## Request body

`application/json`, required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `assetIds` | array of string | yes | Owned video and poster asset ids. Download links come back in this order. |

## Response 201

One download link per asset id, in request order.

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `data` | array of Delivery | yes |  |
| `data[].id` | string | yes | Download link id. |
| `data[].assetId` | string | yes | The asset to download. |
| `data[].exerciseId` | string | yes | The exercise the asset belongs to. |
| `data[].purpose` | "sync" | yes | Always sync: an import into your own storage. |
| `data[].url` | string | yes | The media URL on the delivery host. Supports GET and HEAD with single byte ranges. |
| `data[].expiresAt` | string (date-time) | yes | 300 seconds after issue. Request a new download link afterwards. |
| `data[].mediaType` | string | yes | The file's media type. One of `video/mp4`, `image/jpeg`, `image/webp`, `image/png`. |
| `data[].bytes` | integer | yes | Size of the full file in bytes. |
| `data[].sha256` | string | yes | Verify the downloaded file against it. |
| `data[].version` | string | yes | The asset revision served. |
| `meta` | Meta | yes | Present on every successful response. |
| `meta.requestId` | string | yes | Quote this id when contacting support. Also sent as the X-Request-Id header. |
| `meta.catalogRevision` | string | yes | SHA-256 over the published catalog. Changes when the catalog is redeployed; cursors are bound to it. |
| `meta.account` | string | no | sample when the request carried no API key: it was answered as the sample account. On a page of GET /v1/exercises answered with a key, acct_ and 16 hexadecimal characters: an opaque id of the account the key belongs to, made at random the first time the account lists exercises and never changed, the same for every key of that account and on every request, so an importer can tell a key of another account. It is not the account's internal id and says nothing about it. |
| `meta.sample` | SampleFacts | no | Present with account: sample. What the sample account holds and where the rest of the catalog can be bought. |
| `meta.sample.exercises` | integer | yes | Exercises the sample account owns. |
| `meta.sample.catalogueTotal` | integer | yes | Published exercises in the catalog. |
| `meta.sample.packsUrl` | string | yes | The packs page. A key from any purchase answers with what that account owns. |

## Errors

| Status | Codes | Meaning |
| --- | --- | --- |
| 400 | `invalid_request` | Invalid request or cursor. |
| 401 | `invalid_api_key`, `authentication_required` | The key sent is not a live API key, or this route needs one. A request with no Authorization header is answered as the sample account where the route allows it. |
| 403 | `asset_not_licensed`, `purchase_required` | A purchase or ownership of the requested exercise is required. |
| 404 | `not_found` | The route or exercise was not found. |
| 405 | `method_not_allowed` | Use a supported HTTP method. |
| 413 | `payload_too_large` | The JSON body is too large. |
| 415 | `unsupported_media_type` | Send application/json. |
| 429 | `rate_limit_exceeded`, `sample_busy`, `link_limit_exceeded` | About 120 requests a minute per account; wait for Retry-After before retrying. Without a key, sample_busy means the keyless sample is used up for today: send a key, or try again after 00:00 UTC. link_limit_exceeded means one file had its 200 download links for today: request the others without error.assetId, and that one after 00:00 UTC. |
| 500 | `internal_error` | Unexpected failure. Contact support with requestId if it persists. |
| 503 | `asset_not_available`, `delivery_unavailable`, `api_disabled`, `api_unavailable` | Temporarily unavailable. Retry later. |

## Example request

cURL:

```bash
curl --fail-with-body -sS -X POST \
  -H "Authorization: Bearer $MOVEKIT_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"assetIds":["ex75-video","ex75-poster"]}' \
  "https://api.movekit.com/v1/deliveries"
```

JavaScript:

```javascript
// Node 20 or newer: save as request.mjs and run node request.mjs
const response = await fetch("https://api.movekit.com/v1/deliveries", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MOVEKIT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "assetIds": [
      "ex75-video",
      "ex75-poster"
    ]
  }),
})
const body = await response.json()
if (!response.ok) throw new Error(`${response.status} ${body.error.code}: ${body.error.nextAction}`)
console.log(body.data)
```

Python:

```python
import json
import os
import urllib.error
import urllib.request

payload = {
    "assetIds": ["ex75-video", "ex75-poster"],
}

request = urllib.request.Request(
    "https://api.movekit.com/v1/deliveries",
    method="POST",
    headers={
        "User-Agent": "movekit-docs-example/1",
        "Authorization": f"Bearer {os.environ['MOVEKIT_API_KEY']}",
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode(),
)
try:
    with urllib.request.urlopen(request) as response:
        print(json.dumps(json.load(response), indent=2))
except urllib.error.HTTPError as error:
    print(error.code, error.read().decode())
```

## Example response 201

```json
{
  "data": [
    {
      "id": "grant_69e604c7-2f38-485c-89b3-24d61ab2af0e",
      "assetId": "ex75-video",
      "exerciseId": "75",
      "purpose": "sync",
      "url": "https://media.movekit.com/media/grant_69e604c7-2f38-485c-89b3-24d61ab2af0e?t=eyJnIjoiZ3JhbnRfNjllNjA0YzcifQ.Lqvtn5kUEJG22znYCC-jXAWyPJMsAP1Po2eNG279Yp",
      "expiresAt": "2026-10-04T09:17:44.000Z",
      "mediaType": "video/mp4",
      "bytes": 1843302,
      "sha256": "d74cedbbfbc4d6d93afd73cbbf4ca7e6d4ef1d876d12be14913c617974ba8109",
      "version": "golden-release-20261004:ae121e3065d855ff190bcdbe66cc267172046f2ec09f9d189f8007bbf49b715d"
    },
    {
      "id": "grant_0b9f2d61-7c4e-4a85-b3d2-9e1f6a7c8d40",
      "assetId": "ex75-poster",
      "exerciseId": "75",
      "purpose": "sync",
      "url": "https://media.movekit.com/media/grant_0b9f2d61-7c4e-4a85-b3d2-9e1f6a7c8d40?t=eyJnIjoiZ3JhbnRfNjllNjA0YzcifQ.Lqvtn5kUEJG22znYCC-jXAWyPJMsAP1Po2eNG279Yp",
      "expiresAt": "2026-10-04T09:17:44.000Z",
      "mediaType": "image/webp",
      "bytes": 321332,
      "sha256": "4971144f130907a9eb898ef7b10109b60f4c572c40e41358a053dba24836d0f4",
      "version": "golden-release-20261004:ae121e3065d855ff190bcdbe66cc267172046f2ec09f9d189f8007bbf49b715d"
    }
  ],
  "meta": {
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "catalogRevision": "3c79fc18685650e43beb1ccdd0e1f70cef31a5b643b033160e779684f9cfc869"
  }
}
```

## Example response 400

```json
{
  "error": {
    "code": "invalid_request",
    "message": "assetIds must be an array of 1 to 50 asset ids.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": false,
    "nextAction": "Correct the request using the OpenAPI document."
  }
}
```

## Example response 401

```json
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key is invalid or revoked.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": false,
    "nextAction": "Use a valid live API key."
  }
}
```

## Example response 403

```json
{
  "error": {
    "code": "asset_not_licensed",
    "message": "Your pack license does not include asset ex38-video; no download link was issued.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": false,
    "nextAction": "Use an owned exercise, or buy this one: error.purchase lists its public page and the packs that contain it.",
    "purchase": {
      "exerciseUrl": "https://movekit.com/exercises/barbell-squat",
      "packs": [
        {
          "id": "pack-12",
          "name": "Complete Pack",
          "url": "https://movekit.com/packs#complete-exercise-library"
        },
        {
          "id": "pack-11",
          "name": "Gym Pack",
          "url": "https://movekit.com/packs#gym-app-library"
        }
      ]
    }
  }
}
```

## Example response 404

```json
{
  "error": {
    "code": "not_found",
    "message": "Asset ex999999-video not found.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": false,
    "nextAction": "Use an asset ID from licensed exercise details."
  }
}
```

## Example response 405

```json
{
  "error": {
    "code": "method_not_allowed",
    "message": "This method is not supported for this route.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": false,
    "nextAction": "Read the OpenAPI document for the supported method."
  }
}
```

## Example response 413

```json
{
  "error": {
    "code": "payload_too_large",
    "message": "Request exceeds 16 KiB.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": false,
    "nextAction": "Send a smaller JSON request."
  }
}
```

## Example response 415

```json
{
  "error": {
    "code": "unsupported_media_type",
    "message": "Send application/json.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": false,
    "nextAction": "Set Content-Type: application/json."
  }
}
```

## Example response 429

```json
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "The tenant request rate is exhausted.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": true,
    "nextAction": "Wait for Retry-After, then retry with jitter."
  }
}
```

## Example response 500

```json
{
  "error": {
    "code": "internal_error",
    "message": "The request could not be completed.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": false,
    "nextAction": "Retry once with jitter; if it persists contact support with the request id."
  }
}
```

## Example response 503

```json
{
  "error": {
    "code": "asset_not_available",
    "message": "Asset ex75-video is not available for API delivery yet; no download link was issued.",
    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
    "retryable": true,
    "nextAction": "Retry later or use the purchases-page download. Your rights are unaffected."
  }
}
```

## OpenAPI

The operation and every component it references, from the OpenAPI document.

```json
{
  "openapi": "3.1.2",
  "info": {
    "title": "MoveKit API",
    "version": "1.1.0"
  },
  "servers": [
    {
      "url": "https://api.movekit.com/v1",
      "description": "Control plane (MOVEKIT_API_BASE_URL). Paths below are relative to this URL."
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/deliveries": {
      "post": {
        "operationId": "createDeliveries",
        "tags": [
          "Deliveries"
        ],
        "summary": "Create deliveries",
        "description": "Creates download links for owned videos and posters in request order. The whole request fails if any asset is unknown, unowned or unavailable.",
        "x-movekit-requires": "owned-asset",
        "x-movekit-notes": [
          "With no key, the sample exercises are the owned ones."
        ],
        "security": [
          {},
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Owned asset ids, videos and posters alike.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDeliveryRequest"
              },
              "example": {
                "assetIds": [
                  "ex75-video",
                  "ex75-poster"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "One download link per asset id, in request order.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryListResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "grant_69e604c7-2f38-485c-89b3-24d61ab2af0e",
                      "assetId": "ex75-video",
                      "exerciseId": "75",
                      "purpose": "sync",
                      "url": "https://media.movekit.com/media/grant_69e604c7-2f38-485c-89b3-24d61ab2af0e?t=eyJnIjoiZ3JhbnRfNjllNjA0YzcifQ.Lqvtn5kUEJG22znYCC-jXAWyPJMsAP1Po2eNG279Yp",
                      "expiresAt": "2026-10-04T09:17:44.000Z",
                      "mediaType": "video/mp4",
                      "bytes": 1843302,
                      "sha256": "d74cedbbfbc4d6d93afd73cbbf4ca7e6d4ef1d876d12be14913c617974ba8109",
                      "version": "golden-release-20261004:ae121e3065d855ff190bcdbe66cc267172046f2ec09f9d189f8007bbf49b715d"
                    },
                    {
                      "id": "grant_0b9f2d61-7c4e-4a85-b3d2-9e1f6a7c8d40",
                      "assetId": "ex75-poster",
                      "exerciseId": "75",
                      "purpose": "sync",
                      "url": "https://media.movekit.com/media/grant_0b9f2d61-7c4e-4a85-b3d2-9e1f6a7c8d40?t=eyJnIjoiZ3JhbnRfNjllNjA0YzcifQ.Lqvtn5kUEJG22znYCC-jXAWyPJMsAP1Po2eNG279Yp",
                      "expiresAt": "2026-10-04T09:17:44.000Z",
                      "mediaType": "image/webp",
                      "bytes": 321332,
                      "sha256": "4971144f130907a9eb898ef7b10109b60f4c572c40e41358a053dba24836d0f4",
                      "version": "golden-release-20261004:ae121e3065d855ff190bcdbe66cc267172046f2ec09f9d189f8007bbf49b715d"
                    }
                  ],
                  "meta": {
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "catalogRevision": "3c79fc18685650e43beb1ccdd0e1f70cef31a5b643b033160e779684f9cfc869"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or cursor.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_request",
                    "message": "assetIds must be an array of 1 to 50 asset ids.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": false,
                    "nextAction": "Correct the request using the OpenAPI document."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "invalid_request"
            ]
          },
          "401": {
            "description": "The key sent is not a live API key, or this route needs one. A request with no Authorization header is answered as the sample account where the route allows it.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_api_key",
                    "message": "The API key is invalid or revoked.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": false,
                    "nextAction": "Use a valid live API key."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "invalid_api_key",
              "authentication_required"
            ]
          },
          "403": {
            "description": "A purchase or ownership of the requested exercise is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "asset_not_licensed",
                    "message": "Your pack license does not include asset ex38-video; no download link was issued.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": false,
                    "nextAction": "Use an owned exercise, or buy this one: error.purchase lists its public page and the packs that contain it.",
                    "purchase": {
                      "exerciseUrl": "https://movekit.com/exercises/barbell-squat",
                      "packs": [
                        {
                          "id": "pack-12",
                          "name": "Complete Pack",
                          "url": "https://movekit.com/packs#complete-exercise-library"
                        },
                        {
                          "id": "pack-11",
                          "name": "Gym Pack",
                          "url": "https://movekit.com/packs#gym-app-library"
                        }
                      ]
                    }
                  }
                }
              }
            },
            "x-movekit-codes": [
              "asset_not_licensed",
              "purchase_required"
            ]
          },
          "404": {
            "description": "The route or exercise was not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "Asset ex999999-video not found.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": false,
                    "nextAction": "Use an asset ID from licensed exercise details."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "not_found"
            ]
          },
          "405": {
            "description": "Use a supported HTTP method.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Allow": {
                "$ref": "#/components/headers/Allow"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "method_not_allowed",
                    "message": "This method is not supported for this route.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": false,
                    "nextAction": "Read the OpenAPI document for the supported method."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "method_not_allowed"
            ]
          },
          "413": {
            "description": "The JSON body is too large.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "payload_too_large",
                    "message": "Request exceeds 16 KiB.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": false,
                    "nextAction": "Send a smaller JSON request."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "payload_too_large"
            ]
          },
          "415": {
            "description": "Send application/json.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_media_type",
                    "message": "Send application/json.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": false,
                    "nextAction": "Set Content-Type: application/json."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "unsupported_media_type"
            ]
          },
          "429": {
            "description": "About 120 requests a minute per account; wait for Retry-After before retrying. Without a key, sample_busy means the keyless sample is used up for today: send a key, or try again after 00:00 UTC. link_limit_exceeded means one file had its 200 download links for today: request the others without error.assetId, and that one after 00:00 UTC.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limit_exceeded",
                    "message": "The tenant request rate is exhausted.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": true,
                    "nextAction": "Wait for Retry-After, then retry with jitter."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "rate_limit_exceeded",
              "sample_busy",
              "link_limit_exceeded"
            ]
          },
          "500": {
            "description": "Unexpected failure. Contact support with requestId if it persists.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "internal_error",
                    "message": "The request could not be completed.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": false,
                    "nextAction": "Retry once with jitter; if it persists contact support with the request id."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "internal_error"
            ]
          },
          "503": {
            "description": "Temporarily unavailable. Retry later.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "asset_not_available",
                    "message": "Asset ex75-video is not available for API delivery yet; no download link was issued.",
                    "requestId": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70",
                    "retryable": true,
                    "nextAction": "Retry later or use the purchases-page download. Your rights are unaffected."
                  }
                }
              }
            },
            "x-movekit-codes": [
              "asset_not_available",
              "delivery_unavailable",
              "api_disabled",
              "api_unavailable"
            ]
          }
        }
      },
      "x-plane": "control"
    }
  },
  "components": {
    "headers": {
      "Allow": {
        "description": "Supported methods for the route.",
        "schema": {
          "type": "string"
        },
        "example": "GET"
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        },
        "example": 30
      },
      "X-RateLimit-Limit": {
        "description": "Authenticated attempts allowed per 60-second window for the account.",
        "schema": {
          "type": "integer"
        },
        "example": 120
      },
      "X-RateLimit-Remaining": {
        "description": "Attempts left in the current window.",
        "schema": {
          "type": "integer"
        },
        "example": 117
      },
      "X-Request-Id": {
        "description": "Correlation id for support. Present on every response.",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "req_5f0c7a9e-2b1d-4c8e-9a3f-6d2e8b1c4f70"
      }
    },
    "schemas": {
      "BatchDeliveryRequest": {
        "type": "object",
        "description": "Body of createDeliveries.",
        "properties": {
          "assetIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^ex[0-9]+-(?:video|poster)$"
            },
            "minItems": 1,
            "maxItems": 50,
            "uniqueItems": true,
            "description": "Owned video and poster asset ids. Download links come back in this order."
          }
        },
        "required": [
          "assetIds"
        ],
        "additionalProperties": false
      },
      "Delivery": {
        "type": "object",
        "description": "A short-lived download link. `url` has the form {DELIVERY_WORKER_URL}/media/{grantId}?t={token}; it is the authorization, so never send the API key to it and never log or share it.",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^grant_",
            "description": "Download link id."
          },
          "assetId": {
            "type": "string",
            "pattern": "^ex[0-9]+-(?:video|poster)$",
            "description": "The asset to download."
          },
          "exerciseId": {
            "type": "string",
            "description": "The exercise the asset belongs to."
          },
          "purpose": {
            "const": "sync",
            "description": "Always sync: an import into your own storage."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The media URL on the delivery host. Supports GET and HEAD with single byte ranges."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "300 seconds after issue. Request a new download link afterwards."
          },
          "mediaType": {
            "type": "string",
            "enum": [
              "video/mp4",
              "image/jpeg",
              "image/webp",
              "image/png"
            ],
            "description": "The file's media type."
          },
          "bytes": {
            "type": "integer",
            "minimum": 0,
            "description": "Size of the full file in bytes."
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Verify the downloaded file against it."
          },
          "version": {
            "type": "string",
            "description": "The asset revision served."
          }
        },
        "required": [
          "id",
          "assetId",
          "exerciseId",
          "purpose",
          "url",
          "expiresAt",
          "mediaType",
          "bytes",
          "sha256",
          "version"
        ],
        "additionalProperties": false
      },
      "DeliveryListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Delivery"
            },
            "minItems": 1,
            "maxItems": 50
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        },
        "required": [
          "data",
          "meta"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "description": "Every failure. Branch on `code`; `message` and `nextAction` are for humans and may change.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "$ref": "#/components/schemas/ErrorCode"
              },
              "message": {
                "type": "string",
                "description": "What went wrong."
              },
              "requestId": {
                "type": "string",
                "description": "Equals the X-Request-Id header. Quote it to support."
              },
              "retryable": {
                "type": "boolean",
                "description": "True when the same request may succeed later without a change. Honour Retry-After when present."
              },
              "nextAction": {
                "type": "string",
                "description": "What to do next."
              },
              "purchase": {
                "$ref": "#/components/schemas/PurchaseLinks",
                "description": "Only with asset_not_licensed: where to buy the refused exercise."
              },
              "assetId": {
                "type": "string",
                "description": "Only with link_limit_exceeded: the asset whose download links for today are used up. Request the other files without it."
              }
            },
            "required": [
              "code",
              "message",
              "requestId",
              "retryable",
              "nextAction"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "ErrorCode": {
        "type": "string",
        "enum": [
          "invalid_request",
          "cursor_invalid",
          "authentication_required",
          "invalid_api_key",
          "insufficient_scope",
          "purchase_required",
          "asset_not_licensed",
          "not_found",
          "method_not_allowed",
          "payload_too_large",
          "unsupported_media_type",
          "rate_limit_exceeded",
          "sample_busy",
          "link_limit_exceeded",
          "api_unavailable",
          "api_disabled",
          "delivery_unavailable",
          "asset_not_available",
          "internal_error"
        ],
        "description": "Stable, machine-readable error code. Branch on it."
      },
      "Meta": {
        "type": "object",
        "description": "Present on every successful response.",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Quote this id when contacting support. Also sent as the X-Request-Id header."
          },
          "catalogRevision": {
            "type": "string",
            "description": "SHA-256 over the published catalog. Changes when the catalog is redeployed; cursors are bound to it."
          },
          "account": {
            "type": "string",
            "pattern": "^(?:sample|acct_[0-9a-f]{16})$",
            "description": "sample when the request carried no API key: it was answered as the sample account. On a page of GET /v1/exercises answered with a key, acct_ and 16 hexadecimal characters: an opaque id of the account the key belongs to, made at random the first time the account lists exercises and never changed, the same for every key of that account and on every request, so an importer can tell a key of another account. It is not the account's internal id and says nothing about it."
          },
          "sample": {
            "$ref": "#/components/schemas/SampleFacts"
          }
        },
        "required": [
          "requestId",
          "catalogRevision"
        ],
        "additionalProperties": false
      },
      "PurchaseLinks": {
        "type": "object",
        "description": "Where to buy an exercise. Never a price: prices are adaptive per country, so link to the page that shows them.",
        "properties": {
          "exerciseUrl": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://",
            "description": "The exercise's public page, where it can be bought on its own."
          },
          "packs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchasePack"
            },
            "description": "The packs on sale that contain the exercise, in packs-page order."
          }
        },
        "required": [
          "exerciseUrl",
          "packs"
        ],
        "additionalProperties": false
      },
      "PurchasePack": {
        "type": "object",
        "description": "A pack on sale today that contains the exercise.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Purchased pack id."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://",
            "description": "The pack on the public packs page."
          }
        },
        "required": [
          "id",
          "name",
          "url"
        ],
        "additionalProperties": false
      },
      "SampleFacts": {
        "type": "object",
        "description": "Present with account: sample. What the sample account holds and where the rest of the catalog can be bought.",
        "properties": {
          "exercises": {
            "type": "integer",
            "minimum": 0,
            "description": "Exercises the sample account owns."
          },
          "catalogueTotal": {
            "type": "integer",
            "minimum": 0,
            "description": "Published exercises in the catalog."
          },
          "packsUrl": {
            "type": "string",
            "format": "uri",
            "description": "The packs page. A key from any purchase answers with what that account owns."
          }
        },
        "required": [
          "exercises",
          "catalogueTotal",
          "packsUrl"
        ],
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "mk_live_ API key",
        "description": "Send Authorization: Bearer with a key from your purchases page. Keep keys in your terminal or CI, never in an app. Leave the header out to be answered as the sample account."
      }
    }
  }
}
```
