50% off all paid plans: use code BLACKFRIDAY at checkout, until November 30. Get the deal

Developers

Sending email with the API

Send transactional email from your code with POST /api/v1/send, read the response, handle every error code and stay inside the rate limits.

Use the send endpoint for one-off messages from your application, such as receipts, sign-in links and password resets.

POST https://pigeonify.com/api/v1/send

Before you start

You need:

  1. An API key with the send scope. Create one under API Keys in the sidebar. New keys have send ticked by default. See API keys and scopes.
  2. A verified sending domain. The from address must be on a domain verified in your account. See Sending domains. Until then you can test with your sandbox domain (below).

Send the key in either header:

X-API-Key: pgn_your_api_key
Authorization: Bearer pgn_your_api_key

Request

curl -X POST https://pigeonify.com/api/v1/send \
  -H "X-API-Key: $PIGEONIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Acme <hello@yourdomain.com>",
    "to": ["ada@example.com", "grace@example.com"],
    "subject": "Your receipt",
    "html": "<p>Thanks for your order.</p>",
    "text": "Thanks for your order.",
    "reply_to": "support@yourdomain.com"
  }'
Field Required Description
from Yes Sender. A bare address or Name <address>. Must be on a verified domain
to Yes One address, or an array of addresses
subject Yes Subject line
html Yes HTML body
text No Plain-text body. If you leave it out, one is generated from the HTML
reply_to No Where replies go
track_opens No true to add an open-tracking pixel. Off unless set
track_clicks No true to route links through click tracking. Off unless set

One message per recipient

Each address in to gets its own separate message, so recipients never see each other's addresses. Each one counts as one email against your plan's limits.

A request can name up to 50 recipients. More than that is refused with validation_error and nothing is sent: split the list across several requests, or send it as a campaign. A request for more messages than your plan has left today or this month is refused whole with plan_limit_reached, rather than sending some of them.

Tracking

Tracking is off by default: in a receipt or a password reset a pixel tells you little and a rewritten link gets in the way. Turn it on per request when you want to measure. Tracked opens and clicks arrive as email.opened and email.clicked webhooks, each marked as made by a person or a machine. See Analytics and tracking.

Response

{
  "success": true,
  "message": "Email sent successfully",
  "sent": 1,
  "suppressed": ["grace@example.com"],
  "emails": [
    { "id": "a41d…", "to": "ada@example.com" }
  ]
}
  • sent is how many messages actually went out.
  • emails lists one id per message sent. Store it. It is the email_id on every webhook about that message (delivered, bounced, complained, opened, clicked, unsubscribed), and the only way to match an event to the send.
  • suppressed lists recipients that were skipped.

Suppressed recipients

Recipients on your suppression list (unsubscribes, hard bounces, complaints and addresses you blocked), and addresses known to be undeliverable across the platform, are skipped rather than failing the request. If every recipient is suppressed you still get 200, with "sent": 0 and no emails. See Suppressions and unsubscribes.

What Pigeonify adds to each message

Every message is signed with DKIM for your domain and gets an unsubscribe link at the end of the HTML and plain-text parts, plus List-Unsubscribe and one-click List-Unsubscribe-Post headers, which Gmail and Yahoo expect. Someone who unsubscribes is skipped on later sends.

Errors

Errors carry a stable code to branch on, a human-readable error (which may be reworded), and sometimes details and retry_after:

{ "error": "This key does not have the send scope.", "code": "insufficient_scope", "details": "Create a key with send under API Keys. This key has: contacts:read." }
Code HTTP Meaning and what to do
missing_api_key 401 No key in the request
invalid_api_key 401 Key unknown, revoked or expired
insufficient_scope 403 Key lacks send. Create a key that has it
validation_error 400 A required field is missing, to has more than 50 addresses, from is not an address, or text or a tracking flag has the wrong type
domain_not_verified 403 The from domain is not verified in your account
sandbox_recipient_not_authorised 403 Sandbox sending to an address that has not authorised it
sandbox_daily_limit 429 The sandbox's daily allowance is used up
sending_disabled 503 Sending is paused on your account, or the account is scheduled for deletion. details gives the resume date when there is one
plan_limit_reached 429 Your plan's daily or monthly allowance is spent
content_rejected 403 Our content checks refused the message. Nothing was sent or counted
rate_limited 429 Too many requests. Wait retry_after seconds
quota_exhausted 429 Temporary capacity limit on our side, not your account. Retry later
internal_error 500 Something failed on our side. Retry with backoff

Do not retry a 4xx unchanged unless it is a 429. For paused sending and content refusals, see Account health.

Rate limits

  • 100 requests per minute per account (and per IP address).
  • 3 requests per second per account.

These count requests, not recipients. A 429 carries a Retry-After header and retry_after in the body; a client that waits that long is paced rather than rejected. Your plan also sets daily and monthly allowances; see Sending limits.

The endpoint has no idempotency key. If a request times out, check your webhooks or logs before retrying, or the recipient may get the message twice.

Testing with the sandbox domain

Every account has a sandbox sending domain, so you can try the API before your own domain is verified. It has two limits:

  • It can only send to your own account address and up to 5 others that have each authorised it by clicking a link sent to them. Add them under Get started → Send a test email.
  • It can send 50 messages a day (UTC).

To send to anyone else, verify your own domain.

The official Node.js SDK

npm install pigeonify
import { Pigeonify } from "pigeonify"

const pigeonify = new Pigeonify(process.env.PIGEONIFY_API_KEY)

const { sent, suppressed } = await pigeonify.emails.send({
  from: "Acme <hello@yourdomain.com>",
  to: "ada@example.com",
  subject: "Your receipt",
  html: "<p>Thanks for your order.</p>",
})

The SDK currently covers sending only (emails.send). For contacts, lists, events and everything else, call the REST API directly.

Examples for other languages are in the integration guides. The full reference is at /docs#send. If you would rather use SMTP, see SMTP relay.

Still stuck?

Email us and a person will reply.

support@pigeonify.com