Unsubscribe Headers
Add List-Unsubscribe headers to your emails so recipients (and mailbox providers like Gmail and Yahoo) can unsubscribe without marking your email as spam. This significantly improves deliverability for bulk and marketing sends.
https://mail.sendcorex.com/v3.0/sendMailbox providers strongly recommend (and in some cases require) List-Unsubscribe on any bulk mail. Missing this header on high-volume sends can hurt inbox placement.
Headers go in the headers object of the send request. For the naming rules that apply to every other header, seeCustom Headers.
Supported headers
List-UnsubscribeoptionalComma-separated list of unsubscribe methods, wrapped in angle brackets. Supports both a mailto: and an https: link.
e.g.
"<mailto:unsubscribe@yourdomain.com?subject=unsubscribe>,<https://yourdomain.com/unsubscribe?u=123>"List-Unsubscribe-PostoptionalEnables Gmail/Yahoo one-click unsubscribe. Required if you want the "Unsubscribe" button to appear directly in the inbox UI. Must be exactly:
e.g.
"List-Unsubscribe=One-Click"List-IdoptionalIdentifies the mailing list this email belongs to.
e.g.
"My List <mylist.yourdomain.com>"
Automatic unsubscribe link
If you don't have your own unsubscribe engine, Sendcorex can generate and manage the unsubscribe link and mailto for you. Set unsubscribe: true on the send request, and include one of the supported placeholders in your body where you want the link inserted.
Supported placeholders
[unsubscribe_url][unsubscribe][unsub_url][opt_out_url]
Use any one of them inside an href (or anywhere in the body). Sendcorex replaces it with the real per-recipient unsubscribe link before sending.
unsubscribe: true, no engine of your own
{
"to": "contact@gmail.com",
"from": "noreply@yourdomain.com",
"senderName": "My App",
"subject": "Welcome aboard!",
"body": "<h1>Welcome!</h1><p>Thanks for signing up.</p><p><a href=\"[unsubscribe]\">Unsubscribe</a></p>",
"replyTo": "support@yourdomain.com",
"unsubscribe": true
}Unsubscribed recipients are blocked
Recipients who unsubscribed through the Sendcorex link are blocked automatically on later sends with unsubscribe enabled. The whole request is refused and the response lists them; remove them and send again. You can check a contact's status with the Contacts API.
HTTP/1.1 422 Unprocessable Entity
{
"success": false,
"code": "RECIPIENT_UNSUBSCRIBED",
"message": "These recipients unsubscribed and can't receive emails with an unsubscribe link: ana@x.com. Remove them and send again.",
"unsubscribed": ["ana@x.com"],
"fix": "This person unsubscribed from you. Do not send to them again."
}If unsubscribe: true is set but none of the supported placeholders are found in the body, the request fails with MISSING_UNSUBSCRIBE_PLACEHOLDER. See the400 response.
Contact list
optionalcontact_list is not required. It only controls which list the recipient is saved to for tracking and organization. It has nothing to do with the unsubscribe link itself.
Without contact_list (default)
The contact is automatically saved to a default list called "API Contacts". This name can't be changed. You can review it anytime in yourcontact lists.
{
"to": "contact@gmail.com",
"from": "noreply@yourdomain.com",
"subject": "Welcome aboard!",
"body": "<h1>Welcome!</h1><p><a href=\"[unsubscribe]\">Unsubscribe</a></p>",
"unsubscribe": true
}With contact_list (custom name)
If the list doesn't exist yet, it's created automatically. This is useful for separating audiences, for example one list per campaign or platform.
"CRM 2026 - Gmail""Newsletter - Trial Users""Support Tickets"
{
"to": "contact@gmail.com",
"from": "noreply@yourdomain.com",
"subject": "Welcome aboard!",
"body": "<h1>Welcome!</h1><p><a href=\"[unsubscribe]\">Unsubscribe</a></p>",
"unsubscribe": true,
"contact_list": "CRM 2026 - Gmail"
}Quick start
import axios from 'axios';
const response = await axios.post(
'https://mail.sendcorex.com/v3.0/send',
{
to: 'contact@gmail.com',
from: 'noreply@yourdomain.com',
senderName: 'My App',
subject: 'Welcome aboard!',
body: '<h1>Welcome!</h1><p>Thanks for signing up.</p><p><a href="[unsubscribe]">Unsubscribe</a></p>',
unsubscribe: true,
contact_list: 'CRM 2026 - Gmail',
headers: {
'List-Id': 'My List <mylist.yourdomain.com>',
'List-Unsubscribe':
'<mailto:unsubscribe@yourdomain.com?subject=unsubscribe>,<https://yourdomain.com/unsubscribe?u=123>',
'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click',
},
},
{ headers: { Authorization: process.env.SENDCOREX_API_KEY } }
);
const { id } = response.data;Response
{
"success": true,
"message": "Email queued successfully",
"code": "EMAIL_QUEUED_SUCCESS",
"id": "3f2a1b4c-8e9d-4f7a-b2c3-1a2b3c4d5e6f"
}Errors
All error codes →Errors return a JSON object with error and code.
- 401
MISSING_AUTH_HEADERNo Authorization header present.
- 401
INVALID_API_KEYThe API key is invalid or revoked.
- 401
ACCOUNT_BLOCKEDAccount has been blocked.
- 401
NO_CREDITS_LEFTNot enough email credits for every recipient. Each to, cc and bcc address uses 1 credit.
- 401
DOMAIN_NOT_VALIDATEDSender domain not verified.
- 401
LISTED_SPAM_HAUSSender domain is listed on Spamhaus.
- 401
ISP_DOMAIN_BLOCKEDSending from well-known domains (gmail.com, outlook.com, etc) is not allowed.
- 401
FROM_HEADER_DOMAIN_MISMATCHFrom header domain not authorized for this sender.
- 401
USER_NOT_FOUNDUser not found.
- 401
MISSING_USER_PRIVILEGESMissing user privileges.
- 401
EMAIL_CREDITS_NOT_FOUNDError fetching email credits.
- 401
EMAIL_NOT_VALIDATEDAccount email address has not been verified yet.
- 429
CREDENTIAL_TEMPORARILY_BLOCKEDAPI key temporarily blocked due to repeated policy violations.
- 429
IP_TEMPORARILY_BLOCKEDRequesting IP temporarily blocked due to repeated policy violations.
- 429
TOO_MANY_CONCURRENT_CONNECTIONSToo many concurrent requests from this IP. Try again shortly.
- 400
INVALID_JSONThe request body is not valid JSON.
- 400
MISSING_FROMThe from field is missing or empty.
- 400
INVALID_FROM_FORMATThe from field must be a valid email address.
- 400
MISSING_SENDERNAMEThe senderName field is missing or empty.
- 400
INVALID_SENDERNAME_FORMATThe senderName field contains invalid characters.
- 400
MISSING_SUBJECTThe subject field is missing or empty.
- 400
MISSING_BODYThe body field is missing or empty.
- 400
MISSING_TOADDRESSThe to field is missing or empty.
- 400
MISSING_TOThe to field is missing or empty.
- 400
INVALID_TOADDRESSOne or more recipient addresses are malformed.
- 400
TOADDRESS_LIMIT_EXCEEDEDMore than 50 recipients in the to array.
- 400
INVALID_CCADDRESSOne or more cc addresses are malformed.
- 400
INVALID_BCCADDRESSOne or more bcc addresses are malformed.
- 400
RECIPIENT_LIMIT_EXCEEDEDto, cc and bcc together have more than 50 unique recipients.
- 400
INVALID_SCHEDULED_ATscheduled_at is not a valid date or is in the past.
- 400
INVALID_SENDER_FORMATThe sender email format is invalid.
- 400
HEADER_NOT_ALLOWEDCustom header key is not on the allowed list (List-Unsubscribe, List-Id, X-*, etc).
- 400
INVALID_HEADER_VALUEHeader value contains invalid characters (CR/LF not allowed).
- 400
DANGEROUS_ATTACHMENTOne or more attachments were blocked for security reasons.
- 400
INVALID_ATTACHMENTAn attachment content is not valid base64.
- 400
MISSING_UNSUBSCRIBE_PLACEHOLDERunsubscribe is true but the body has no unsubscribe placeholder ([unsubscribe_url], [unsubscribe], [unsub_url] or [opt_out_url]).
- 403
ACCOUNT_RESTRICTEDAccount is temporarily restricted.
- 403
DAILY_LIMITDaily email sending limit reached.
- 403
MARKETING_LIMIT_REACHEDFree plan daily marketing limit reached: 30 marketing or cold outreach emails per day, counted per recipient over a rolling 24-hour window. The response includes limit, used, recipients and upgradeUrl. Transactional emails still go out; nothing is queued.
- 403
FORBIDDEN_HTML_CONTENTThe HTML contains active content not allowed in emails (script, iframe, form, input, button, embed, object, svg, on* handlers, javascript: links, meta refresh…). The response lists the findings. Use a styled <a> instead of buttons or forms.
- 403
SPAM_DETECTEDEmail content flagged as spam. Response includes quarantine_id and release instructions.
- 403
SENDER_NAME_MISMATCHMultiple sender names detected for same address.
- 403
FOLLOWUP_PATTERN_DETECTEDEmail content flagged as repeated suspicious follow-up pattern.
- 403
SCAM_PATTERN_DETECTEDEmail content flagged as scam pattern.
- 403
ACCOUNT_SUSPENDED_SPOOFINGAccount suspended due to repeated From header spoofing attempts.
- 400
INVALID_IDEMPOTENCY_KEYThe Idempotency-Key header is invalid. Use 1–255 characters: letters, numbers, _ - : .
- 409
IDEMPOTENCY_IN_PROGRESSA request with the same Idempotency-Key is still being processed. Wait (Retry-After: 1) and retry with the same key.
- 422
RECIPIENT_UNSUBSCRIBEDSent with unsubscribe enabled (unsubscribe: true) to someone who already unsubscribed through the Sendcorex link. The whole request is refused and the unsubscribed array lists them. This person unsubscribed from you: remove them and send again, and do not send to them again.
- 422
IDEMPOTENCY_KEY_REUSEDThis Idempotency-Key was already used with a different body. Use a new key for every new email.
- 500
INTERNAL_SERVER_ERRORUnexpected server error. Try again.
- 500
PARSE_ERRORFailed to process email content (MIME parse failure).
- 500
PERSIST_FAILEDFailed to queue email (database persistence failure).
- 503
AUTH_UNAVAILABLECould not validate the API key right now. Try again.
- 503
UNSUBSCRIBE_UNAVAILABLEUnsubscribe link service temporarily unavailable. Try again later.