Topics
Create and manage Topics
Retrieve a list of topics
GET /topics
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Number of items to return. |
after | string | no | Return items after this cursor. |
before | string | no | Return items before this cursor. |
Example
curl -X GET "$SESAMESEND_URL/topics" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
200 | OK |
{
"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
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | The name of the topic. Max 50 characters. |
default_subscription | "opt_in" | "opt_out" | yes | The default subscription status for the topic. Cannot be changed after creation. |
description | string | no | A description of the topic. Max 200 characters. |
visibility | "public" | "private" | no | The 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
| Status | Description |
|---|---|
201 | OK |
{
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
"object": "topic"
}Retrieve a single topic
GET /topics/{id}
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The Topic ID. |
Example
curl -X GET "$SESAMESEND_URL/topics/<id>" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
200 | OK |
{
"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
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The Topic ID. |
Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | no | The name of the topic. Max 50 characters. |
description | string | no | A description of the topic. Max 200 characters. |
visibility | "public" | "private" | no | The 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
| Status | Description |
|---|---|
200 | OK |
{
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
"object": "topic"
}Remove an existing topic
DELETE /topics/{id}
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The Topic ID. |
Example
curl -X DELETE "$SESAMESEND_URL/topics/<id>" \
-H "Authorization: Bearer $OPENSEND_API_KEY"Responses
| Status | Description |
|---|---|
200 | OK |
{
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
"object": "topic",
"deleted": true
}