Tags help you find and route your own emails. Headers change the message itself.
To add tags
Send tags as a list of name and value pairs:
curl https://api.mailcandor.com/v1/emails \
-H "Authorization: Bearer $MAILCANDOR_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Acme <hello@acme.com>",
"to": "sam@example.com",
"subject": "Your login code",
"text": "Your code is 481 203",
"tags": [
{ "name": "flow", "value": "login" },
{ "name": "user_id", "value": "77" }
]
}'
Tags are stored with the email and returned exactly as you sent them in every webhook about it, for example:
{
"type": "email.delivered",
"data": {
"email_id": "3f1c0e2a-...",
"subject": "Your login code",
"tags": [ { "name": "flow", "value": "login" }, { "name": "user_id", "value": "77" } ],
"recipient": "sam@example.com"
}
}
The API also accepts an object such as {"flow": "login"} and returns it unchanged in webhooks, but the dashboard’s tag filter only matches the list format. Use the list.
To find emails by tag
- Open Emails in the dashboard.
- Open the filters and fill in Tag name and, optionally, Tag value.
Each email’s page also lists its tags.
Tags Mailcandor sets itself:
- Broadcast emails carry
broadcast_id. - SendGrid-compatible sends turn
categoriesinto tags namedcategory. - Postmark-compatible sends turn
Taginto a tag namedtag.
To add custom headers
Send headers as an object of header names to string values:
{
"from": "Acme <hello@acme.com>",
"to": "sam@example.com",
"subject": "Order 1042 shipped",
"html": "<p>On its way.</p>",
"headers": {
"X-Entity-Ref-ID": "order-1042-shipped",
"List-Unsubscribe": "<https://acme.com/unsubscribe?u=77>"
}
}
Headers are added to the message as given. Use them for things such as:
X-Entity-Ref-IDwith a unique value, which some mail apps use to stop threading similar emails together.List-UnsubscribeandList-Unsubscribe-Poston marketing-style mail you send through the API. See RFC 8058.- Your own
X-headers for tracing.
Do not set From, To, Subject or other standard headers here: use the matching fields.
Over SMTP
The relay keeps custom headers whose names start with X- and drops other custom headers. Tags are not available over SMTP.
If it does not work
- Tag filter finds nothing: the email was sent with tags as an object. Send them as a list of
name/valuepairs. - A header is missing in the received email: over SMTP, only
X-headers pass through. Over the API, check the header name is spelled correctly and the value is a string. - Tags missing in webhooks: emails sent without tags have no
tagsfield in the webhook.
Full reference: docs.mailcandor.com.