Unsubscribe contacts

Unsubscribe contacts from a list or exclude them from all campaigns.

POST https://cotlet.dev/api/v1/mailjet/contacts/unsubscribe

write Confirm

Give a segment or a list of emails. scope "list" unsubscribes the contacts from the list in list_id and keeps them on it. scope "exclusion_list" adds them to the Campaign Exclusion List, so they get no campaign or automation email from any list, but still get transactional email. The tool never deletes a contact, because Mailjet deletes are permanent. By default you confirm each call; you can switch that off for this tool.

Parameters

Parameters: unsubscribe_contacts
NameTypeDescription
scope enum required enum list or exclusion_list.
list_id integer integer Contact list ID. Required when scope is list.
segment string string Name of a segment from list_segments.
emails array array Email addresses to unsubscribe or exclude. Give emails or segment, not both.

Request

cURL
curl -X POST https://cotlet.dev/api/v1/mailjet/contacts/unsubscribe \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"segment":"No answer to reconfirmation","scope":"exclusion_list"}'
Python
result = client.call("mailjet", "unsubscribe_contacts", {"segment":"No answer to reconfirmation","scope":"exclusion_list"})
Node.js
const result = await cotlet.call('mailjet', 'unsubscribe_contacts', {"segment":"No answer to reconfirmation","scope":"exclusion_list"});
CLI
cotlet call mailjet unsubscribe_contacts --data '{"segment":"No answer to reconfirmation","scope":"exclusion_list"}'

Example response

JSON

{
  "scope": "exclusion_list",
  "segment": "No answer to reconfirmation",
  "excluded": 197
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.