Skip to main content
POST
/
delete-audience
Delete audience
curl --request POST \
  --url https://www.tryunleashx.com/api/v1/global/delete-audience \
  --header 'Content-Type: application/json' \
  --header 'token: <token>' \
  --data '
{
  "campaign_id": 123,
  "audience": [
    123
  ],
  "delete_all": true
}
'
{
  "message": "<string>"
}
Use this endpoint to permanently delete audience records from a campaign.

Endpoint

POST /delete-audience Content-Type: application/json Authentication: Required (workspace auth)

Request Body

Delete specific audience

{
  "campaign_id": 42,
  "audience": [101, 102, 103]
}

Delete all audience (draft campaigns only)

{
  "campaign_id": 42,
  "delete_all": true
}
FieldTypeRequiredDescription
campaign_idnumberYesCampaign identifier
audiencearrayNoArray of audience record IDs to delete. Required when delete_all is not true.
delete_allbooleanNoSet to true to delete all audience for this campaign. Only allowed when campaign is in draft status.

Response

{
  "message": "Audience deleted successfully"
}
When using delete_all:
{
  "message": "All audience deleted successfully"
}

Behavior

  • Hard deletes audience records — this action is irreversible.
  • When delete_all is true, all audience for the campaign are deleted. This is only allowed when the campaign is in draft status.
  • When delete_all is not set, audience array is required.
  • Only deletes records belonging to the specified campaign, company, and workspace.

Error Cases

ErrorCause
Campaign not existInvalid campaign_id
Audience array is requiredaudience is empty or not provided (when delete_all is not set)
All audience can only be deleted when the campaign is in draft statusdelete_all is true but campaign is not in draft status

Example cURL

curl -X POST https://www.tryunleashx.com/api/v1/global/delete-audience \
  -H "Content-Type: application/json" \
  -H "token: <api_key>" \
  -d '{
    "campaign_id": 42,
    "delete_all": true
  }'

Headers

token
string
required

API token for authentication

Body

application/json
campaign_id
integer
required

Campaign identifier

audience
integer[]

Array of audience record IDs to delete. Required when delete_all is not true.

delete_all
boolean

Set to true to delete all audience for this campaign. Only allowed when campaign is in draft status.

Response

Audience deleted successfully

message
string