Audiences
Audiences let you store and organise contacts per domain. Each domain can have multiple audiences. All audience endpoints require a full-access API key.
List audiences
Returns all audiences for a domain. The domain query parameter is required.
Query Parameters
domainstringrequiredThe domain whose audiences you want to list.
Response
dataAudience[]Array of audience objects.
totalnumberTotal number of audiences for this domain.
Request (curl)
curl "https://sendexapi.com/api/v1/audiences?domain=example.com" \ -H "Authorization: Bearer sk_live_XXXX"
Response
{
"data": [
{
"id": "66f1a2b3c4d5e6f7a8b9c0e1",
"name": "Newsletter",
"domain": "example.com",
"contact_count": 1240,
"created_at": "2025-02-01T00:00:00.000Z"
}
],
"total": 1
}Create an audience
Creates a new audience for a verified domain on your account.
Request Body
namestringrequiredDisplay name for the audience.
domainstringrequiredThe domain this audience belongs to. Must be a verified domain on your account.
Response
idstringUnique audience ID.
namestringAudience name.
domainstringDomain this audience belongs to.
contact_countnumberAlways 0 for newly created audiences.
created_atISO 8601Creation timestamp.
Request (curl)
curl -X POST https://sendexapi.com/api/v1/audiences \
-H "Authorization: Bearer sk_live_XXXX" \
-H "Content-Type: application/json" \
-d '{
"name": "Newsletter",
"domain": "example.com"
}'Response
HTTP/1.1 201 Created
{
"id": "66f1a2b3c4d5e6f7a8b9c0e1",
"name": "Newsletter",
"domain": "example.com",
"contact_count": 0,
"created_at": "2025-02-01T00:00:00.000Z"
}Retrieve an audience
Returns a single audience along with its current contact count.
Response
idstringAudience ID.
namestringAudience name.
domainstringDomain this audience belongs to.
contact_countnumberNumber of contacts in this audience.
created_atISO 8601Creation timestamp.
Request (curl)
curl "https://sendexapi.com/api/v1/audiences/66f1a2b3c4d5e6f7a8b9c0e1" \ -H "Authorization: Bearer sk_live_XXXX"
Response
{
"id": "66f1a2b3c4d5e6f7a8b9c0e1",
"name": "Newsletter",
"domain": "example.com",
"contact_count": 1240,
"created_at": "2025-02-01T00:00:00.000Z"
}Delete an audience
Permanently deletes an audience and all of its contacts. This action cannot be undone.
Response
idstringID of the deleted audience.
Request (curl)
curl -X DELETE "https://sendexapi.com/api/v1/audiences/66f1a2b3c4d5e6f7a8b9c0e1" \ -H "Authorization: Bearer sk_live_XXXX"
Response
{
"id": "66f1a2b3c4d5e6f7a8b9c0e1"
}List contacts
Returns a paginated list of contacts in an audience.
Query Parameters
limitnumberoptionalNumber of contacts to return (1–200). Default 50.
offsetnumberoptionalPagination offset. Default 0.
Response
dataContact[]Array of contact objects.
totalnumberTotal contacts matching the query.
limitnumberLimit applied.
offsetnumberOffset applied.
Request (curl)
curl "https://sendexapi.com/api/v1/audiences/66f1a2b3c4d5e6f7a8b9c0e1/contacts?limit=50" \ -H "Authorization: Bearer sk_live_XXXX"
Response
{
"data": [
{
"id": "66f1a2b3c4d5e6f7a8b9c0f1",
"email": "[email protected]",
"first_name": "Alice",
"last_name": "Smith",
"subscribed": true,
"created_at": "2025-02-05T08:00:00.000Z"
}
],
"total": 1240,
"limit": 50,
"offset": 0
}Add a contact
Adds or updates a contact in an audience. If a contact with the same email already exists it is updated in place (upsert).
Request Body
emailstringrequiredEmail address. Unique within the audience.
first_namestringoptionalContact first name.
last_namestringoptionalContact last name.
subscribedbooleanoptionalWhether the contact is subscribed. Defaults to true.
Response
idstringContact ID.
emailstringEmail address.
first_namestringFirst name.
last_namestringLast name.
subscribedbooleanSubscription status.
created_atISO 8601When the contact was first added.
Request (curl)
curl -X POST "https://sendexapi.com/api/v1/audiences/66f1a2b3c4d5e6f7a8b9c0e1/contacts" \
-H "Authorization: Bearer sk_live_XXXX" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"first_name": "Alice",
"last_name": "Smith",
"subscribed": true
}'Response
HTTP/1.1 201 Created
{
"id": "66f1a2b3c4d5e6f7a8b9c0f1",
"email": "[email protected]",
"first_name": "Alice",
"last_name": "Smith",
"subscribed": true,
"created_at": "2025-02-05T08:00:00.000Z"
}Retrieve a contact
Returns a single contact by ID.
Response
idstringContact ID.
emailstringEmail address.
first_namestringFirst name.
last_namestringLast name.
subscribedbooleanSubscription status.
created_atISO 8601When the contact was added.
Request (curl)
curl "https://sendexapi.com/api/v1/audiences/66f1a2b3c4d5e6f7a8b9c0e1/contacts/66f1a2b3c4d5e6f7a8b9c0f1" \ -H "Authorization: Bearer sk_live_XXXX"
Response
{
"id": "66f1a2b3c4d5e6f7a8b9c0f1",
"email": "[email protected]",
"first_name": "Alice",
"last_name": "Smith",
"subscribed": true,
"created_at": "2025-02-05T08:00:00.000Z"
}Update a contact
Partially updates a contact. Only supplied fields are changed.
Request Body
first_namestringoptionalUpdated first name.
last_namestringoptionalUpdated last name.
subscribedbooleanoptionalUpdate subscription status.
Response
idstringContact ID.
emailstringEmail address.
first_namestringFirst name.
last_namestringLast name.
subscribedbooleanSubscription status.
created_atISO 8601Original creation timestamp.
Request (curl)
curl -X PATCH "https://sendexapi.com/api/v1/audiences/66f1a2b3c4d5e6f7a8b9c0e1/contacts/66f1a2b3c4d5e6f7a8b9c0f1" \
-H "Authorization: Bearer sk_live_XXXX" \
-H "Content-Type: application/json" \
-d '{
"subscribed": false
}'Response
{
"id": "66f1a2b3c4d5e6f7a8b9c0f1",
"email": "[email protected]",
"first_name": "Alice",
"last_name": "Smith",
"subscribed": false,
"created_at": "2025-02-05T08:00:00.000Z"
}Delete a contact
Permanently removes a contact from an audience.
Response
idstringID of the deleted contact.
Request (curl)
curl -X DELETE "https://sendexapi.com/api/v1/audiences/66f1a2b3c4d5e6f7a8b9c0e1/contacts/66f1a2b3c4d5e6f7a8b9c0f1" \ -H "Authorization: Bearer sk_live_XXXX"
Response
{
"id": "66f1a2b3c4d5e6f7a8b9c0f1"
}