Create Topic
Create a new subscription topic. Topics allow contacts to manage their email preferences.
POST
/topicsRequires a full_access API key.
Body Parameters
namestringrequiredThe topic name. Max 50 characters.
descriptionstringA description of the topic. Max 200 characters.
default_subscriptionstringThe default subscription state for new contacts. Either "opt_in" or "opt_out". Default "opt_in".
visibilitystringWhether the topic is visible to contacts in preference pages. Either "public" or "private". Default "public".
Response Fields
objectstringAlways "topic".
idstringThe ID of the newly created topic.
curl -X POST 'https://api.postflare.app/topics' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"name": "Product Updates",
"description": "Receive the latest product news",
"default_subscription": "opt_in",
"visibility": "public"
}'const response = await fetch('https://api.postflare.app/topics', {
method: 'POST',
headers: {
'Authorization': 'Bearer re_xxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Product Updates',
description: 'Receive the latest product news',
default_subscription: 'opt_in',
visibility: 'public',
}),
});
const data = await response.json();Response
{
"object": "topic",
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
}