Skip to content

POST /mailing/send-template ​

Queue a new email request using an existing template.

Overview ​

Use this endpoint to send an email with a template stored in Mailiqo. The template version selected for sending provides the subject, HTML body, and plain text body. Recipients are processed in the same way as POST /mailing/send.

Template placeholders use syntax. Variables that are not present are replaced with an empty string, and variables that do not appear in the template are ignored.

Endpoint ​

http
POST /v1/mailing/send-template
bash
curl -X POST https://api.mailiqo.com/v1/mailing/send-template \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template_uuid": "7e9c6c60-8a98-4c10-9d5e-xxxxxxxx",
    "from": "[email protected]",
    "to": "[email protected]",
    "variables": {"first_name": "Jane"}
  }'

Request body ​

The request body must be sent as JSON.

Required fields ​

FieldTypeRequiredDescription
template_uuidstringYesUUID of the template to use.
fromstring (email)YesSender email address.
tomixedYesPrimary recipients. See recipients format below.

Optional fields ​

FieldTypeRequiredDescription
ccmixedNoCarbon copy recipients.
bccmixedNoBlind carbon copy recipients.
variablesobjectNoValues used to replace template placeholders.
attachmentsarrayNoList of attachments.
force_validationbooleanNoRuns a new check on every recipient during sending, without reusing previous results. Equivalent to validation.mode: "always", and spends one credit per recipient checked
validationobjectNoAdjusts validation for this send only. See Validation for this send

Validation for this send ​

Works exactly as in POST /mailing/send. By default the sending domain's configuration applies; the validation object tightens it for this request only:

json
{
  "template_uuid": "7e9c6c60-8a98-4c10-9d5e-xxxxxxxx",
  "from": "[email protected]",
  "to": "[email protected]",
  "validation": {
    "mode": "always",
    "level": "restrictive",
    "block": ["catch_all", "risky"]
  }
}
FieldValuesDescription
modeunknown_only, alwaysWhen the recipient's mailbox is probed
levelpreventive, restrictiveHow demanding the check is
blocklist of catch_all, risky, unknownDoubtful results you drop for this send

A send can only tighten

The adjustment never relaxes the domain configuration, and block only adds to what the domain already blocks. That is why mode does not accept never. An unrecognised value returns 400 with code 1419.

The full explanation is in Recipient validation.

Recipients format ​

to, cc, and bcc use the same formats documented in POST /mailing/send.

Variables format ​

json
{
  "first_name": "Jane",
  "company_name": "Acme"
}

These values can be used by placeholders such as {{first_name}} and {{company_name}}.

Example request ​

json
{
  "template_uuid": "7e9c6c60-8a98-4c10-9d5e-xxxxxxxx",
  "from": "[email protected]",
  "to": [
    {
      "name": "Jane Doe",
      "email": "[email protected]"
    }
  ],
  "variables": {
    "first_name": "Jane",
    "company_name": "Acme"
  },
  "attachments": [
    {
      "filename": "invoice.pdf",
      "content_base64": "JVBERi0xLjQKJ...",
      "content_type": "application/pdf"
    }
  ]
}

Successful response example (status = success) ​

json
{
  "status": "success",
  "data": {
    "id": "snd_0c4ab8dc0df44ef689ea53ee4a8e1a3f",
    "sent_to": [
      {
        "id": "msg_8c2db7094df247c4b03f6f1d2a9e5c10",
        "name": "Jane Doe",
        "email": "[email protected]"
      }
    ],
    "rejected_recipients": []
  }
}

Error response example ​

json
{
  "status": "error",
  "error": {
    "code": "1416",
    "message": "Email template not found.",
    "details": {}
  }
}

HTTP responses ​

StatusMeaning
200Request processed.
400Invalid request or validation error.
401Authentication failed or request not authorized.
404Template not found.
409The template has no published version (1420).
429Sending limit reached (1421). Wait the seconds in the Retry-After header before sending again. See Sending limits.
500Internal server error.

Notes ​

  • The template provides the subject and body content.
  • Delivery is asynchronous after the request is accepted.
  • Accepted and rejected recipients follow the same response format as POST /mailing/send.

See also ​

Built with VitePress