# Media API reference

The Media API reference covers 6 endpoints of the SkedCast social media REST API. The media library: upload, import and read assets.

## List library assets

`GET /media`

Scope: `media.read`

| Field | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | string | query | no | Keyset cursor from a previous page. |
| `limit` | integer | query | no | Page size (1–100). |
| `kind` | enum: image | video | gif | document | query | no |  |
| `folder` | string | query | no |  |
| `label` | string | query | no | Narrow to assets carrying this label. |
| `clientId` | string (uuid) | query | no |  |
| `status` | enum: pending | scanning | passed | transcoding | transcoded | failed | … | query | no |  |
| `search` | string | query | no | Free-text match on the filename, folder name, or any one label. |
| `used` | enum: true | false | upcoming | query | no | Narrow by post usage. - `true`: used by at least one post (an attachment, a video cover, or one platform's own media). - `false`: used by no post. - `upcoming`: sent by a post that has not published yet (a destination still scheduled, scheduled on the platform, or on hold). These files cannot be deleted until they are removed from those posts or the posts are canceled. |
| `sort` | enum: created_at | filename | size | query | no |  |
| `order` | enum: asc | desc | query | no |  |
| `from` | string (date-time) | query | no | Lower bound on the UPLOAD date, under every sort. |
| `to` | string (date-time) | query | no | Upper bound on the UPLOAD date, under every sort. |

Responses: 200, 400, 401, 403, 404, 422, 429

## Register an uploaded asset

`POST /media`

Scope: `media.manage`

Register an asset after its bytes are uploaded, so SkedCast starts processing it.

The upload sequence:

1. `POST /media/presign` returns `assetId`, `key` and an upload URL.
2. `PUT` the file to that URL (a multipart upload also calls `POST /media/{id}/complete`).
3. `POST /media` with the `assetId` and `key` from step 1 registers the asset.

The response carries `readyEvent` (`media.ready`): subscribe to it instead of polling. Requires the `media.manage` scope and an `Idempotency-Key` header.

| Field | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | string | header | yes | A unique key (for example a UUID, up to 255 characters) for this request. Retry a 429, 502, 503 or 504, or a request that got no response, with the same Idempotency-Key: SkedCast runs it once or returns the first result. Every other answer, including a 500, is kept for 24 hours and returned again for that key, so send a new key to try again. |
| `assetId` | string (uuid) | body | yes | The `assetId` from the presign response. |
| `key` | string | body | yes | The `key` from the presign response. |
| `clientId` | string (uuid) | body | no | Optional, and best left out: the asset is filed under the client chosen at presign, which the `key` carries. When sent it must equal that client, else `400 media_bad_key` (since 2026-11-27). |
| `contentType` | string | body | yes | The file's MIME type, for example `image/jpeg`. |
| `sizeBytes` | integer | body | yes | The file size in bytes. SkedCast records the size of the stored file. |
| `filename` | string | body | yes | The original file name. |
| `platforms` | array of enum: x | linkedin | instagram | facebook | tiktok | youtube | … | body | no | Optional. Prepare the file for these platforms first. |

Responses: 201, 400, 401, 403, 404, 422, 429

## Get a library asset

`GET /media/{id}`

Scope: `media.read`

| Field | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | string (uuid) | path | yes |  |

Responses: 200, 400, 401, 403, 404, 422, 429

## Presign a direct upload

`POST /media/presign`

Scope: `media.manage`

Get a presigned URL to upload a file straight to storage. The file does not pass through the API.

The upload sequence:

1. `POST /media/presign` returns `assetId`, `key`, `expiresAt` and either a single upload `url` or, with `multipart: true`, `uploadId` and `parts[]`.
2. `PUT` the file to the URL before it expires. For a multipart upload, `PUT` each part at its `sizeBytes`, then call `POST /media/{id}/complete`.
3. `POST /media` with the `assetId` and `key` registers the asset.

Requires the `media.manage` scope and an `Idempotency-Key` header.

| Field | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | string | header | yes | A unique key (for example a UUID, up to 255 characters) for this request. Retry a 429, 502, 503 or 504, or a request that got no response, with the same Idempotency-Key: SkedCast runs it once or returns the first result. Every other answer, including a 500, is kept for 24 hours and returned again for that key, so send a new key to try again. |
| `clientId` | string (uuid) | body | no | Scope the asset to one client. Omit for a workspace-wide asset. |
| `filename` | string | body | yes | The original file name. |
| `contentType` | string | body | yes | The file's MIME type, for example `image/jpeg`. SkedCast checks the real type after upload. |
| `sizeBytes` | integer | body | yes | The file size in bytes. |
| `multipart` | boolean | body | no | Set `true` for a large file to get `uploadId` and `parts[]` instead of one upload `url`. |

Responses: 201, 400, 401, 403, 404, 422, 429

## Complete a multipart upload

`POST /media/{id}/complete`

Scope: `media.manage`

Finish a multipart upload started with `POST /media/presign` and `multipart: true`. Send the `key` and `uploadId` from the presign and every part's `partNumber` with the `ETag` its `PUT` returned, in order. Then register the asset with `POST /media`, as for a single upload.

The `key` must be the one issued for this asset; any other is refused. Requires the `media.manage` scope and an `Idempotency-Key` header.

| Field | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | string (uuid) | path | yes |  |
| `Idempotency-Key` | string | header | yes | A unique key (for example a UUID, up to 255 characters) for this request. Retry a 429, 502, 503 or 504, or a request that got no response, with the same Idempotency-Key: SkedCast runs it once or returns the first result. Every other answer, including a 500, is kept for 24 hours and returned again for that key, so send a new key to try again. |
| `key` | string | body | yes | The `key` the presign returned. |
| `uploadId` | string | body | yes | The `uploadId` the presign returned. |
| `parts` | array of object | body | yes |  |

Responses: 201, 400, 401, 403, 404, 409, 422, 429

## Import an asset from a URL

`POST /media/import-url`

Scope: `media.manage`

Import an image or video into the library from a URL (HTTPS URLs only). Requires the `media.manage` scope and an `Idempotency-Key` header.

| Field | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | string | header | yes | A unique key (for example a UUID, up to 255 characters) for this request. Retry a 429, 502, 503 or 504, or a request that got no response, with the same Idempotency-Key: SkedCast runs it once or returns the first result. Every other answer, including a 500, is kept for 24 hours and returned again for that key, so send a new key to try again. |
| `url` | string (uri) | body | yes | An HTTPS URL of the image or video to import. |
| `clientId` | string (uuid) | body | no | Scope the asset to one client. Omit for a workspace-wide asset. |
| `platforms` | array of enum: x | linkedin | instagram | facebook | tiktok | youtube | … | body | no | Optional. Prepare the file for these platforms first. |

Responses: 201, 400, 401, 403, 404, 422, 429
