Create a topicMenu

Create a topic

POST/v1/topics

Requires an API key with the topics:write scope. About keys and scopes

Works with integration, agent and partner keys.

A repeat after success is refused with 409 ALREADY_EXISTS: read the one the first created. About idempotency

Creates a topic. Names are unique in the workspace (409 ALREADY_EXISTS). Topics let contacts choose what marketing they get, separately from lists. 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 the contact's consent changes.

Header parameters

Kirora-Workspacestringoptional

Partner keys only: the child workspace to act in, by the external id the partner gave it. Without it, a partner key acts in its own workspace. Any other key that sends it is refused with 403, and an unknown workspace is 404.

pattern ^[A-Za-z0-9._:-]{1,128}$

Idempotency-Keystringoptional

Makes a retry safe: a repeat with the same key and body within 24 hours gets the first response again, with Idempotency-Replay: true. The same key with another request is 409 IDEMPOTENCY_KEY_REUSED; while the first is still running, 409 IDEMPOTENCY_KEY_IN_USE; after an unsafe first request failed or never returned, 409 IDEMPOTENCY_KEY_OUTCOME_UNKNOWN. Use a new key, such as a UUID, for each new request.

8–255 characters

Request body

namestringrequired

Unique within the workspace.

1–100 characters

descriptionstring | nulloptional

up to 500 characters

modestringoptional

Who the topic reaches: everyone who has not left, or only who joined.

one of opt_out, opt_in · default "opt_out"

Returns

Returns 201 Created with a Topic in data. It can also return 409 Conflict, 413 Payload Too Large or 415 Unsupported Media Type; see the statuses below. Otherwise returns an error; Errors lists every code and which to retry.

  • 201 CreatedThe new topic.
  • 409 ConflictThe request conflicts with current state — a duplicate unique value, or a resource whose status does not allow this operation.
  • 413 Payload Too LargeThe body is larger than this operation accepts (PAYLOAD_TOO_LARGE).
  • 415 Unsupported Media TypeThe body is not JSON, or not the upload the operation takes (UNSUPPORTED_MEDIA_TYPE).
idstringrequired

uuid

namestringrequired
descriptionstring | nullrequired
modestringrequired

opt_out reaches everyone who has not left; opt_in only those who joined.

one of opt_out, opt_in

createdAtstringrequired

date-time

updatedAtstringrequired

date-time

countsobjectrequired

Counted now, as the topic rule without channel reads it; a contact's channel choice can still differ on that channel.

2 child attributes
inintegerrequired

Contacts the topic reaches topic-wide: for opt_out everyone who has not left, for opt_in those who joined.

min 0

leftintegerrequired

Contacts who left the topic.

min 0

Headers on 201 Created

Idempotency-Replaystringoptional

true when this is the stored response to an earlier request with the same key.

one of true