# Create a campaign `POST /api/v1/campaigns` Creates a campaign. ## 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. ## Body parameters - `type` (string) — Email campaigns are supported. - `name` (string, required) — 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. To provide content, choose a template or supply a body. The campaign starts in draft. ## Request 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" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: ${SPORT_ID:?Set SPORT_ID}" \ --header "Content-Type: application/json" \ --data '{"name":"November club news","subject":"News from the club","body_html":"

Registration for the winter program opens this week.

","track_opens":false}' ``` ## Response **201 Created** The created campaign is returned in data. Example with fictional data and selected fields. ```json { "message_key": "entities.campaign.messages.created", "data": { "id": 24, "sport_id": 3, "name": "November club news", "subject": "News from the club", "body_html": "

Registration for the winter program opens this week.

", "track_opens": false, "status": "draft" } } ``` ## Errors - `401` — The API key is missing or invalid. - `403` — The API key lacks the required permission. - `422` — One or more fields failed validation.