Delete Segment

Delete a segment by ID. Contacts that belong to this segment will not be deleted.

Deletion is refused with 409 CONFLICT (name: validation_error) while a broadcast that has not finished sending still uses this segment — one that is draft, scheduled or queued. The message names the broadcast IDs; wait for them to finish, delete them, or point them at another segment first.

DELETE/segments/{segment_id}

Requires an API key with the segments:write permission.

Path Parameters

segment_idstringrequired

The ID of the segment to delete.

Response Fields

objectstring

Always "segment".

idstring

The segment ID.

deletedboolean

Always true.

curl -X DELETE 'https://api.postflare.dev/segments/a1b2c3d4-e5f6-7890-abcd-ef1234567890' \
  -H 'Authorization: Bearer sk_xxxxxxxxx'
const response = await fetch(
  'https://api.postflare.dev/segments/a1b2c3d4-e5f6-7890-abcd-ef1234567890',
  {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer sk_xxxxxxxxx',
    },
  }
);

const data = await response.json();

Response

Response
{
  "object": "segment",
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "deleted": true
}