Skip to Content
sesameSend

Topics

Create and manage Topics

Retrieve a list of topics

GET /topics

Query parameters

NameTypeRequiredDescription
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/topics" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "has_more": true,
  "data": [
    {
      "id": "string",
      "name": "string",
      "description": "string",
      "default_subscription": "opt_in",
      "visibility": "public",
      "created_at": "2023-10-06 23:47:56.678+00"
    }
  ]
}

Create a new topic

POST /topics

Body

FieldTypeRequiredDescription
namestringyesThe name of the topic. Max 50 characters.
default_subscription"opt_in" | "opt_out"yesThe default subscription status for the topic. Cannot be changed after creation.
descriptionstringnoA description of the topic. Max 200 characters.
visibility"public" | "private"noThe visibility of the topic. Public topics are visible to all contacts on the unsubscribe page. Private topics are only visible to opted-in contacts.

Example

curl -X POST "$SESAMESEND_URL/topics" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "default_subscription": "opt_in"
}'

Responses

StatusDescription
201OK
{
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "object": "topic"
}

Retrieve a single topic

GET /topics/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Topic ID.

Example

curl -X GET "$SESAMESEND_URL/topics/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "object": "topic",
  "name": "Newsletter",
  "description": "string",
  "default_subscription": "opt_in",
  "visibility": "public",
  "created_at": "2023-10-06 23:47:56.678+00"
}

Update an existing topic

PATCH /topics/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Topic ID.

Body

FieldTypeRequiredDescription
namestringnoThe name of the topic. Max 50 characters.
descriptionstringnoA description of the topic. Max 200 characters.
visibility"public" | "private"noThe visibility of the topic.

Example

curl -X PATCH "$SESAMESEND_URL/topics/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Responses

StatusDescription
200OK
{
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "object": "topic"
}

Remove an existing topic

DELETE /topics/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Topic ID.

Example

curl -X DELETE "$SESAMESEND_URL/topics/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "object": "topic",
  "deleted": true
}