Objective
This article explains how to delete one or more Engage audiences programmatically using the Segment Public API, including:
-
the
DELETE /spaces/{spaceId}/audiences/{audienceId}endpoint, - the token access required,
- the 50 requests-per-minute rate limit to plan for during bulk clean-ups, and
- the follow-up needed for any Journeys that reference a deleted audience.
It is aimed at workspaces running data-hygiene or housekeeping activities that need to remove a large number of legacy or inactive audiences.
Product
Twilio Segment
Environment
Segment Console
User Account Permission/Role(s) Required
A Public API token with Unify and Engage Admin permission.
Procedure
Follow these steps to programmatically delete your Engage audiences:
- Generate a Public API token. In the Segment app, go to Settings → Workspace Settings → Access Management → Tokens, create a token with Workspace Owner access, and store it securely. This is the token you'll pass as a Bearer credential.
-
Identify the Space ID and Audience ID. The Space ID has the form
spa_xxxand the Audience ID has the formaud_xxx. You can find the Audience ID in the audience's URL in the Segment app, or by listing audiences usingGET https://api.segmentapis.com/spaces/{spaceId}/audiences. Use the Audience ID, not the audience name — the delete endpoint expects theaud_xxxID. - Delete the audience. Call the Remove Audience from Space endpoint:
curl --request DELETE \
--url https://api.segmentapis.com/spaces/{spaceId}/audiences/{audienceId} \
--header 'Authorization: Bearer <YOUR_API_TOKEN>'-
Pace the calls for bulk runs. The delete endpoint is rate-limited to 50 requests per minute. When deleting a large batch, throttle your requests to stay under this limit and handle any
429 Too Many Requestsresponses with a short back-off and retry, rather than firing all deletions at once — otherwise the run will start erroring partway through. - Review Journeys after deletion. Deleting an audience does not cascade into Journeys. Users already in flight continue through their steps unaffected and the deletion itself is not blocked, but any Journey that used the deleted audience as an entry condition will be left pointing at an audience that no longer exists. In Journeys v2 this surfaces as an "audience no longer exists" validation error. For any in-scope audiences used as a Journey entry condition, identify them beforehand and repoint or retire the Journey in the UI as part of the clean-up. This step is done manually in the Segment app.
- Destinations require no separate clean-up. Once the audience is deleted, any connected destinations simply stop receiving that audience's data. You do not need to remove or update the destination connections separately.
Additional Information
- Full set of Audience endpoints (including List Audiences): Audiences
- Deleting an audience generates an
Audience Deletedevent in the workspace Audit Trail, which can be used to confirm a bulk run completed as expected.