Skip to main content

Delete Segment

Delete a segment. Contacts are not affected; only the saved audience is removed.

A segment cannot be deleted while a scheduled or sending email or SMS campaign targets it. Cancel the campaign, or wait for it to finish, then delete.

Endpoint​

DELETE /segments/:id

Returns: 200 OK

Headers​

HeaderValueRequired
AuthorizationBearer <your-api-key>Yes

Path Parameters​

ParameterTypeDescription
idstringThe segment ID

Response​

{
"object": "segment",
"id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"deleted": true
}

Examples​

curl -X DELETE "https://api.arsel.sa/v1/segments/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a" \
-H "Authorization: Bearer $ARSEL_API_KEY"

Error Responses​

{
"status_code": 409,
"name": "segment_in_use",
"message": "A scheduled or sending campaign targets this segment. Cancel or finish it first."
}