API

Send one email

Email one person from a template right away, and optionally add them to a list.

Use this when one person should get an email right away. A welcome after signup, a password reset, an order receipt, and a booking confirmation all use this same call.

It sends a template you already saved. It does not create a campaign, so the project does not fill up with one campaign per person.

Quick Send in the dashboard does the same thing. Choose a template and one address. Add a list only when that person should join it. Tick Skip if already sent for a welcome, so nobody gets it twice.

Before you call

  • Save the email as a template in this project. Copy its id from GET /api/v1/templates, or from Email Templates.
  • Create an API key that includes the messages:send scope. A key created before this scope existed cannot send until you create a new key and include messages:send.
  • Optional: create a list, such as Signups, and copy its id from GET /api/v1/lists. Pass that id as list_id and the person is added to that list. The list has to be a static list in this project; a dynamic list returns 409 with code list_is_dynamic.
  • Call this from the brand's server, right after signup or the order succeeds. The key only affects that one project.

What one call does

  • Saves the person as a contact. The same email updates the contact you already have, and restores it first if it was deleted.
  • Adds them to list_id when you send one. Other people already on that list are not emailed.
  • Sends the template to that email only.
  • Fills variables in the subject, preview text, HTML, and plain text. {{first_name}}, {{last_name}}, {{email}}, and {{full_name}} come from the contact. Your own values, such as an order number or cart items, come from variables. See Template variables.

Welcome email, send once

Set once to true. If this address already received this template, the person is still saved and added to the list, and the email is not sent again.

json
{
  "email": "ada@example.com",
  "first_name": "Ada",
  "list_id": 12,
  "once": true
}

Put the template id from this project in the URL path.

Receipt or password reset

Leave once out, or set it to false. Each call sends the email again. Leave list_id out when this person should not join a list.

json
{
  "email": "ada@example.com",
  "first_name": "Ada",
  "variables": { "order_id": "A-1042", "total": "₹1,499" },
  "idempotency_key": "receipt-A-1042"
}

Retries and idempotency_key

Send an idempotency_key, up to 128 characters, when your server might repeat a call, for example after a timeout. A repeat with the same key in the same project within 24 hours sends nothing. It returns the first response with HTTP 200 and idempotent_replay true.

  • Use one key per email you mean to send, such as the order or cart id.
  • A call that failed, for example with HTTP 422 or 502, is not kept. Retry it with the same key.
  • A repeat that arrives while the first call is still running returns HTTP 409 with the code idempotency_in_progress. Try again a moment later.
  • If a call stops part-way on our side (for example during an update), its key is freed after 5 minutes, so your retry sends the email.

Answer at once with queue

Sending through your own mailbox can take several seconds, because the call waits until your mail server accepts the email. Add "queue": true to get an answer at once: HTTP 202 with status queued and the send_id. VeloSend checks the address, your quota and the template before answering, then hands the email over in the background. If your mail server is down it tries again for about two and a half hours.

Follow the result with GET /api/v1/sends/{id} (queued, then sent, delivered, opened…, or failed with error_message), or with the webhooks email.sent and email.failed. Combine queue with idempotency_key so a retry can never send twice. Without queue nothing changes: the call answers when the email has been handed over.

No sending email connected

If the project has no connected sending email, the call returns HTTP 409 with the code mailbox_not_connected. Nothing is saved or sent. Connect a mailbox under Email sending, then send the same request again.

Emails sent this way count toward the project's daily sending limit, and they are always sent straight away.

Email address not confirmed

Until the account owner confirms their email address, the call returns HTTP 403 with the code email_not_verified. Nothing is saved or sent. Use the link in the confirmation email, or send a new one from the dashboard.

Metadata for your webhooks

Pass metadata, an object of up to 2 KB, such as { "flow": "abandoned_cart", "cart_id": "abc" }. It comes back unchanged on every webhook event for that send, and from GET /api/v1/sends/{id}. See Webhooks: events sent to your server.

People who opted out

An address that already unsubscribed is not emailed. The call returns HTTP 200 with status suppressed, reason unsubscribed and the send_id of the skipped send, which shows in the send log. Pass force_resubscribe true only after they ask to receive email again.

Some people ask not to receive email from anyone using VeloSend. Their address gets the same answer as one on your suppression list, status suppressed with reason suppressed, and force_resubscribe does not change that.

A bounced address is saved and can still be added to the list. The email is not sent. The response has status suppressed, sent false, skipped true, reason bounced and a send_id.

POST/api/v1/templates/{id}/send

Scope

messages:send

Fields

emailRequiredfirst_namelast_namephonewhatsappnoteslist_idonceforce_resubscribevariablesmetadataidempotency_key

Returns

send_id, contact_id, list_id, status (sent, suppressed, invalid or skipped), sent, skipped, reason, warnings

Any other field is refused with 400 and code unknown_field, naming them in fields, and nothing is sent. Values for the template go under variables, for example { "email": "asha@example.com", "variables": { "link": "https://example.com/reset" } }, never next to email. The id in the path is the template id from this project.

Response

  • sent true means the email went out. The HTTP status is 201. send_id identifies this email, and warnings lists any variables that rendered blank.
  • sent false, skipped true, and reason already_sent means once was true and this person already received this template. The HTTP status is 200. They are still on the list.
  • sent false, skipped true, and reason bounced means the mailbox was already marked bounced.
  • status suppressed, sent false, skipped true, and reason suppressed means the address can't be emailed, for example after a spam complaint. The skipped send has a send_id.
  • status suppressed and reason unsubscribed means the person unsubscribed. Pass force_resubscribe only after they ask to receive email again.
  • status invalid, sent false and skipped true means the address can't receive email, and nothing was sent or counted toward your plan. reason says why: syntax (not a real address), no_mx (the domain does not accept email), previously_bounced or complained. message is the sentence shown in the send log, and verification has the status, reason and, for a likely typo, a suggestion such as asha@gmail.com. The skipped send has a send_id.
  • An address VeloSend has not checked yet is checked just before sending. If the check does not finish within 3 seconds, the email is sent and the address is checked later.
  • HTTP 422 with the code invalid_variables means a required variable is missing or a value has the wrong type. The variable field names it. Nothing is sent or saved.
  • If the mail server rejects the message, the contact is still saved. The HTTP status is 502 and the code is send_failed. Call the same request again to retry. A failed send does not count as already sent.
  • If the mailbox itself fails, for example because the sign-in is refused, Email sending shows the error and owners and admins get an email about it, at most once a day.

The message includes an unsubscribe link. If the person uses it, they are removed from every list in this project.

Check a send

GET/api/v1/sends/{id}

Scope

messages:send or analytics:read

Returns

send_id, template_id, contact_id, email, status, error_message, render_warnings, sent_at, opened_at, clicked_at

Use the send_id from the send response. status moves from sent to opened or clicked as the person reads the email.

Links in the email carry UTM tags from Settings, Email sending: utm_source and utm_medium as set there, utm_campaign from metadata.flow (or the template's name) and utm_content the template id. Pass utm to set your own for this send, for example "utm": { "utm_campaign": "cart_recovery_oct" }. It takes utm_source, utm_medium, utm_campaign, utm_content and utm_term, each up to 100 characters. A tag a link already has is kept. Your own tags are added even when the setting is off.