Skip to main content
POST
/
v1
/
email
/
template
Send Email with Template
curl --request POST \
  --url https://api.unosend.co/v1/email/template \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "template_key": "<string>",
  "from": {
    "from.address": "<string>",
    "from.name": "<string>"
  },
  "to": [
    {
      "email_address.address": "<string>",
      "email_address.name": "<string>"
    }
  ],
  "merge_info": {},
  "reply_to": {},
  "cc": [
    {}
  ],
  "bcc": [
    {}
  ]
}
'

Documentation Index

Fetch the complete documentation index at: https://docs.unosend.co/llms.txt

Use this file to discover all available pages before exploring further.

template_key
string
required
The unique key of the template to use.
from
object
required
Sender details.
to
array
required
Array of recipient objects.
merge_info
object
Key-value pairs for template variable substitution. Example: {"first_name": "John", "order_id": "12345"}.
reply_to
object
Reply-to address with address and optional name.
cc
array
CC recipients. Same structure as to.
bcc
array
BCC recipients. Same structure as to.

Request

curl -X POST https://api.unosend.co/v1/email/template \
  -H "Authorization: Bearer un_xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "template_key": "welcome-email",
    "from": {
      "address": "hello@yourdomain.com",
      "name": "Your App"
    },
    "to": [
      {
        "email_address": {
          "address": "user@example.com",
          "name": "John Doe"
        }
      }
    ],
    "merge_info": {
      "first_name": "John",
      "activation_link": "https://yourapp.com/activate/abc123"
    }
  }'

Response

200
{
  "message": "OK",
  "request_id": "req_abc123def456",
  "data": {
    "message_id": "msg_550e8400e29b41d4"
  }
}
Template variables use the {{variable_name}} syntax. Make sure all required variables in the template are provided in merge_info.