Send email

POST /v1/emails accepts one email and queues it. Authentication is a project API key in the Authorization header.

Request

FieldTypeNotes
fromstringAddress on a verified domain (live keys). Display names allowed: "Acme <hi@acme.com>".
tostring | string[]Also cc, bcc and replyTo. At most 50 recipients across to, cc and bcc.
subjectstringRequired unless a template supplies it.
html, textstringAt least one, unless you use template.
templatestringTemplate alias or id. Supplies subject, html and text.
variablesobjectValues for {{ placeholders }}. HTML-escaped in html.
attachmentsarray{ filename, content (base64), contentType? }. Up to 10 files, 10 MB in total. Executables are refused.
headersobjectCustom headers. Single-line values; From, To, Subject and similar are reserved.
tagsobjectUp to 10 key/value pairs, returned in webhooks.
scheduledAtISO 8601Up to 30 days ahead. Cancel with POST /v1/emails/:id/cancel.
type"TRANSACTIONAL" | "MARKETING"Default TRANSACTIONAL. Each type has its own queue, so a large send never delays a password reset.

Idempotency

Send an Idempotency-Key header (up to 256 printable ASCII characters) to make retries safe. Repeating a request with the same key returns the original result without sending again. Reusing a key with a different body returns 409 CONFLICT.

Terminal
curl https://api.mailfy.uz/v1/emails \
  -H "Authorization: Bearer $MAILFY_API_KEY" \
  -H "Idempotency-Key: order-1042-receipt" \
  -H "Content-Type: application/json" \
  -d '{ "from": "orders@acme.com", "to": "ada@example.com", "template": "receipt", "variables": { "order": "1042" } }'

Batch

POST /v1/emails/batch takes an array of up to 100 emails. Every email is validated before any is accepted, and the response lists one { id, status } per email in order.

Reading emails

GET /v1/emails (newest first, cursor pagination) and GET /v1/emails/:id (with the event timeline) need a full access key; sending-only keys get 403.

Statuses

StatusMeaning
QUEUED / SCHEDULEDAccepted and waiting for the worker (or for scheduledAt).
SENTHanded to the delivery provider.
DELIVERED / DELIVERY_DELAYEDReported by the provider for the recipient server.
BOUNCED / COMPLAINEDPermanent bounce or spam complaint. The address is added to your suppression list.
SUPPRESSEDEvery recipient was on the suppression list; nothing was sent or counted.
SANDBOXEDSent with a test key: processed, never delivered.
FAILED / CANCELEDCould not be sent (reason in lastError), or canceled before sending.

Status only moves forward. See Webhooks to be notified of each change.