API Reference

Delete audience

DELETE /audiences/:id — delete an audience and its contacts.

DELETE/audiences/:id

Delete an audience by id. This also removes the contacts belonging to it.

Request
import { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.audiences.remove('AUDIENCE_ID');
console.log({ data, error });
Response (200)
{
  "object": "audience",
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "deleted": true
}
Deletion is blocked while a campaign still references the audience — you get 422 validation_error asking you to delete the campaign(s) first. An unknown id returns 404 not_found.