Create Segment
Create a new segment to organize contacts for broadcasts.
POST
/segmentsRequires a full_access API key.
Body Parameters
namestringrequiredThe segment name. Max 255 characters.
Response Fields
objectstringAlways "segment".
idstringThe ID of the newly created segment.
namestringThe segment name.
curl -X POST 'https://api.postflare.app/segments' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"name": "Newsletter Subscribers"
}'const response = await fetch('https://api.postflare.app/segments', {
method: 'POST',
headers: {
'Authorization': 'Bearer re_xxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Newsletter Subscribers',
}),
});
const data = await response.json();Response
{
"object": "segment",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Newsletter Subscribers"
}