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-WorkspacestringoptionalPartner 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-KeystringoptionalMakes 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 409IDEMPOTENCY_KEY_REUSED; while the first is still running, 409IDEMPOTENCY_KEY_IN_USE; after anunsafefirst request failed or never returned, 409IDEMPOTENCY_KEY_OUTCOME_UNKNOWN. Use a new key, such as a UUID, for each new request.8–255 characters
Request body
namestringrequiredUnique within the workspace.
1–100 characters
descriptionstring | nulloptionalup to 500 characters
modestringoptionalWho 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).
idstringrequireduuid
namestringrequireddescriptionstring | nullrequiredmodestringrequiredopt_outreaches everyone who has not left;opt_inonly those who joined.one of
opt_out,opt_increatedAtstringrequireddate-time
updatedAtstringrequireddate-time
countsobjectrequiredCounted now, as the topic rule without
channelreads it; a contact's channel choice can still differ on that channel.2 child attributes
inintegerrequiredContacts the topic reaches topic-wide: for
opt_outeveryone who has not left, foropt_inthose who joined.min 0
leftintegerrequiredContacts who left the topic.
min 0
Headers on 201 Created
Idempotency-Replaystringoptionaltruewhen this is the stored response to an earlier request with the same key.one of
true