# Create a topic

`POST /v1/topics`

Requires an API key with the `topics:write` scope. [About keys and scopes](/docs/api/authentication)

Admin. Names are unique in the workspace (`409 ALREADY_EXISTS`). Topics let contacts choose what marketing they get, separately from groups. A campaign or journey send step with a `topicId` reaches a contact only if they have email or push consent **and** the topic reaches them: an `opt_out` topic reaches everyone who has not left it, an `opt_in` topic only those who joined. A contact leaves a topic from the unsubscribe link of any message sent on it; every change is recorded in consent history.

## Request body

- `name` (string, required, 1–100 characters) — Unique within the workspace.
- `description` (string | null, optional, up to 500 characters)
- `mode` (string, optional, one of `opt_out`, `opt_in`, default `"opt_out"`) — Who the topic reaches: everyone who has not left, or only who joined.

## Returns

Returns `201 Created`. Otherwise returns an error; [Errors](/docs/api/errors) lists every code and which to retry.

- `id` (string, required, uuid)
- `name` (string, required)
- `description` (string | null, required)
- `mode` (string, required, one of `opt_out`, `opt_in`) — `opt_out` reaches everyone who has not left; `opt_in` only those who joined.
- `createdAt` (string, required, date-time)
- `updatedAt` (string, required, date-time)

## Example

```bash
curl -X POST https://api.kirora.io/v1/topics \
  -H "Authorization: Bearer $KIRORA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Weekend specials"
  }'
```

Response `201`:

```json
{
  "data": {
    "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
    "name": "Weekend specials",
    "description": "description_example",
    "mode": "opt_out",
    "createdAt": "2030-03-14T09:30:00Z",
    "updatedAt": "2030-03-14T09:30:00Z"
  }
}
```
