Create Segment

Create a new segment to organize contacts for broadcasts.

POST/segments

Requires a full_access API key.

Body Parameters

namestringrequired

The segment name. Max 255 characters.

Response Fields

objectstring

Always "segment".

idstring

The ID of the newly created segment.

namestring

The 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

Response
{
  "object": "segment",
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Newsletter Subscribers"
}