# Update a campaign `PATCH / PUT / POST /api/v1/campaigns/{id}` Updates a campaign by ID. ## Permissions Send your API key in `X-API-Key`. Required permissions are **Campaigns → Write**. ## Headers - `X-Sport-Id` (integer, required) — The sport ID from [List sports](/api/sports/list.md). Use the sport the record belongs to. ## Path parameters - `id` (integer, required) — ID of the campaign. ## Body parameters - `name` (string) — Campaign name, up to 255 characters. - `subject` (string) — Email subject, up to 255 characters. Defaults to an empty string on creation. - `track_opens` (boolean) — Whether to collect email open counts. - `template_id` (integer or null) — ID of a saved email template. Use this or supply campaign content. - `body_html` (string or null) — Campaign HTML. - `body_json` (map or JSON string) — Structured content with a blocks array. Blocks use an id and type. Supported types are heading, paragraph, image, spacer, and separator. Pause a scheduled campaign before editing it. ## Request (PATCH) Set ASDINCLOUD_API_KEY and any variables named in the example before running it. ```sh curl --request PATCH \ --url "https://api.asdincloud.com/api/v1/campaigns/${ID:?Set ID}" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"subject":"Winter program registration"}' ``` ## Request (PUT) Set ASDINCLOUD_API_KEY and any variables named in the example before running it. ```sh curl --request PUT \ --url "https://api.asdincloud.com/api/v1/campaigns/${ID:?Set ID}" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"subject":"Winter program registration"}' ``` ## Request (POST) Set ASDINCLOUD_API_KEY and any variables named in the example before running it. ```sh curl --request POST \ --url "https://api.asdincloud.com/api/v1/campaigns/${ID:?Set ID}" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"subject":"Winter program registration"}' ``` ## Response **200 OK** Returns a successful update response. Example with fictional data and selected fields. ```json { "message_key": "entities.campaign.messages.updated" } ``` ## Errors - `401` — The API key is missing or invalid. - `403` — The API key lacks the required permission. - `404` — The requested record was not found. - `409` — The campaign's current state does not allow this operation. - `422` — One or more fields failed validation.