# Campaigns API reference

The Campaigns API reference covers 8 endpoints of the SkedCast social media REST API. Named post groups and a one-call schedule shift.

## List campaigns

`GET /campaigns`

Scope: `campaigns.read`

| Field | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `clientId` | string (uuid) | query | no | Include this client's campaigns alongside the workspace-wide ones. |
| `status` | enum: active | archived | query | no |  |
| `cursor` | string | query | no | Keyset cursor from a previous page. |
| `limit` | integer | query | no | Page size (1–100). Default 100. |

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

## Create a campaign

`POST /campaigns`

Scope: `campaigns.manage`

Create a campaign (a named grouping of posts; omit `clientId` for a workspace-wide one). `409 campaign_exists` on a duplicate `(client, name)`. Requires the `campaigns.manage` scope (Owner, Manager, or an Editor on the campaign's client) 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. |
| `name` | string | body | yes |  |
| `description` | string | body | no |  |
| `status` | enum: active | archived | body | no |  |
| `color` | string | body | no | Hex color (#RRGGBB) for calendar/queue tinting. |
| `startsAt` | string (date-time) | body | no |  |
| `endsAt` | string (date-time) | body | no |  |
| `clientId` | string (uuid) | body | no | Optional client scope; omit for a workspace-wide campaign. |

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

## Get a campaign

`GET /campaigns/{id}`

Scope: `campaigns.read`

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

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

## Update a campaign

`PATCH /campaigns/{id}`

Scope: `campaigns.manage`

Partial update (name / description / status / color / planning window; ≥1 field). The client scope is immutable. Requires the `campaigns.manage` scope (Owner, Manager, or an Editor on the campaign's client) 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. |
| `name` | string | body | no |  |
| `description` | string | body | no |  |
| `status` | enum: active | archived | body | no |  |
| `color` | string | body | no |  |
| `startsAt` | string (date-time) | body | no |  |
| `endsAt` | string (date-time) | body | no |  |

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

## Delete a campaign

`DELETE /campaigns/{id}`

Scope: `campaigns.manage`

Delete a campaign. Its posts are ungrouped, never deleted. Idempotent. Requires the `campaigns.manage` scope (Owner, Manager, or an Editor on the campaign's client) 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. |

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

## Assign posts to a campaign

`POST /campaigns/{id}/assign`

Scope: `campaigns.manage`

Group the given posts into the campaign. On a client-scoped campaign, cross-client posts are silently skipped. Returns `{ assigned }`. Requires the `campaigns.manage` scope (Owner, Manager, or an Editor on the campaign's client) 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. |
| `postIds` | array of string (uuid) | body | yes |  |

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

## Unassign posts from a campaign

`POST /campaigns/{id}/unassign`

Scope: `campaigns.manage`

Un-group the given posts from the campaign. Returns `{ unassigned }`. Requires the `campaigns.manage` scope (Owner, Manager, or an Editor on the campaign's client) 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. |
| `postIds` | array of string (uuid) | body | yes |  |

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

## Shift a campaign's schedule

`POST /campaigns/{id}/shift`

Scope: `campaigns.manage`

Move the whole campaign's still-pending schedule by a relative `shiftMinutes` (non-zero, ±1 year). Each target moves on its own, so one failure does not stop the rest. Returns the bulk `{ accepted, skipped, skippedReasons }` result. Requires the `campaigns.manage` scope (Owner, Manager, or an Editor on the campaign's client) 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. |
| `shiftMinutes` | integer | body | yes | Non-zero relative shift in minutes. |
| `respectCadence` | boolean | body | no | Advisory: asks SkedCast to keep each account's spacing between posts when it moves them. |

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