Unsubscribe contacts
Unsubscribe contacts from a list or exclude them from all campaigns.
POST https://cotlet.dev/api/v1/mailjet/contacts/unsubscribe
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
| Name | Type | Description |
|---|---|---|
| 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 -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"}' result = client.call("mailjet", "unsubscribe_contacts", {"segment":"No answer to reconfirmation","scope":"exclusion_list"}) const result = await cotlet.call('mailjet', 'unsubscribe_contacts', {"segment":"No answer to reconfirmation","scope":"exclusion_list"}); cotlet call mailjet unsubscribe_contacts --data '{"segment":"No answer to reconfirmation","scope":"exclusion_list"}' Example response
{
"scope": "exclusion_list",
"segment": "No answer to reconfirmation",
"excluded": 197
}