Guides
Sending email
Everything about POST /emails - recipients, HTML and text, batch sends, scheduling with natural language, attachments (base64 or remote path), tags, headers and streams.
POST /emails accepts one email; POST /emails/batch accepts up to 100. Both return as soon as the email is safely queued, with its id. Delivery, retries and bounce handling happen in the background and are reported through webhooks.
{
"from": "Acme <onboarding@acme.com>",
"to": ["steve@example.com"],
"cc": ["billing@acme.com"],
"reply_to": "support@acme.com",
"subject": "Your invoice for October",
"html": "<p>Hi Steve, your invoice is attached.</p>",
"attachments": [{ "path": "https://files.acme.com/invoices/2026-10.pdf" }],
"tags": [{ "name": "category", "value": "invoice" }]
}Sender and recipients
fromisaddr@domainorName <addr@domain>. The domain must be verified in your account (exact match) and allowed for the API key.to,cc,bcctake one address or a list. Up to 50 unique recipients across the three; addresses are de-duplicated (case-insensitive local part, IDN domains normalized).reply_totakes one address or a list and doesn't count toward the 50.- Addresses with an IP literal as domain, local parts over 64 characters or addresses over 254 characters are rejected.
Each recipient is delivered separately and gets its own status. Recipients on your suppression list are accepted but not delivered: they end as suppressed, don't count toward your quota, and trigger email.suppressed.
Test sender
Before your own domain is verified, send from any address at test.pidgely.com (for example onboarding@test.pidgely.com), through the API, SMTP or the dashboard's Send test. It needs no DNS and is meant for trying Pidgely out:
- Every recipient (
to,ccandbcc) must be a member of your organization with a confirmed e-mail address: you, or teammates you invite in Settings → Team. One other recipient rejects the whole email with403 sandbox_recipient_not_allowed. - Up to 50 recipients a day per organization, then
429 sandbox_daily_limit_exceededuntil 00:00 UTC. They also count toward your plan quota. - Broadcasts and store e-mails need your own domain (
422 test_sender_not_allowed), and a key restricted to a domain can't use it. - Messages are signed (DKIM) and get bounces on Pidgely's test domain, and appear in your email list, events and webhooks like any other.
Your organization starts in test mode (status: sandbox) and leaves it automatically as soon as one of its domains is verified.
Content
subjectis required (up to 998 bytes) unless a template provides it.htmland/ortext: at least one is required. When you send onlyhtml, Pidgely generates the plain-text part for you.- The
Message-IDuses your domain; lines always end in CRLF.
Batch sending
import { Pidgely } from 'pidgely';
const pidgely = new Pidgely(process.env.PIDGELY_API_KEY);
const { data, error } = await pidgely.batch.send([
{
from: 'Acme <hi@acme.com>',
to: ['alice@example.com'],
subject: 'Hi Alice',
html: '<p>Hi!</p>',
},
{
from: 'Acme <hi@acme.com>',
to: ['bob@example'],
subject: 'Hi Bob',
html: '<p>Hi!</p>',
},
], {
batchValidation: 'permissive',
});
console.log(data ?? error);import os
import pidgely
pidgely.api_key = os.environ["PIDGELY_API_KEY"]
result = pidgely.Batch.send([
{
"from": "Acme <hi@acme.com>",
"to": ["alice@example.com"],
"subject": "Hi Alice",
"html": "<p>Hi!</p>",
},
{
"from": "Acme <hi@acme.com>",
"to": ["bob@example"],
"subject": "Hi Bob",
"html": "<p>Hi!</p>",
},
], {
"batch_validation": "permissive",
})
print(result)<?php
require __DIR__ . '/vendor/autoload.php';
$pidgely = Pidgely::client(getenv('PIDGELY_API_KEY'));
$result = $pidgely->batch->send([
[
'from' => 'Acme <hi@acme.com>',
'to' => ['alice@example.com'],
'subject' => 'Hi Alice',
'html' => '<p>Hi!</p>',
],
[
'from' => 'Acme <hi@acme.com>',
'to' => ['bob@example'],
'subject' => 'Hi Bob',
'html' => '<p>Hi!</p>',
],
], [
'batch_validation' => 'permissive',
]);
var_dump($result);package main
import (
"context"
"fmt"
"os"
"github.com/pidgely/pidgely-go"
)
func main() {
ctx := context.Background()
client := pidgely.NewClient(os.Getenv("PIDGELY_API_KEY"))
result, err := client.Batch.Send(ctx, []pidgely.SendEmailRequest{
{
From: "Acme <hi@acme.com>",
To: []string{"alice@example.com"},
Subject: "Hi Alice",
Html: "<p>Hi!</p>",
},
{
From: "Acme <hi@acme.com>",
To: []string{"bob@example"},
Subject: "Hi Bob",
Html: "<p>Hi!</p>",
},
}, pidgely.WithBatchValidation(pidgely.BatchPermissive))
if err != nil {
panic(err)
}
fmt.Println(result)
}require "pidgely"
Pidgely.api_key = ENV["PIDGELY_API_KEY"]
result = Pidgely::Batch.send([
{
from: "Acme <hi@acme.com>",
to: ["alice@example.com"],
subject: "Hi Alice",
html: "<p>Hi!</p>"
},
{
from: "Acme <hi@acme.com>",
to: ["bob@example"],
subject: "Hi Bob",
html: "<p>Hi!</p>"
}
], {
batch_validation: "permissive"
})
puts resultcurl -X POST 'https://api.pidgely.com/emails/batch' \
-H "Authorization: Bearer $PIDGELY_API_KEY" \
-H 'Content-Type: application/json' \
-H 'x-batch-validation: permissive' \
-d '[
{
"from": "Acme <hi@acme.com>",
"to": [
"alice@example.com"
],
"subject": "Hi Alice",
"html": "<p>Hi!</p>"
},
{
"from": "Acme <hi@acme.com>",
"to": [
"bob@example"
],
"subject": "Hi Bob",
"html": "<p>Hi!</p>"
}
]'- 1 to 100 emails per request, each with the full single-send shape (attachments,
scheduled_atandtemplateincluded). strict(default): all or nothing. The first invalid email fails the request, with its index in the message ([1].to: …).permissive: valid emails are queued and invalid ones are listed inerrors:
{
"data": [{ "id": "0199d8a2-6f3c-7c51-9e2a-3b1f0c6d4e21" }],
"errors": [{ "index": 1, "message": "to: invalid address \"bob@example\": invalid domain \"example\"" }]
}A batch that would exceed the daily quota is rejected as a whole. Batches support idempotency keys like single sends.
Scheduling
Set scheduled_at to send later, up to 30 days ahead. It accepts ISO 8601:
{ "scheduled_at": "2026-10-20T09:00:00-03:00" }or natural language, evaluated in UTC:
| You write | Means |
|---|---|
in 10 minutes, in 2 hours, in 3 days, in 1 week |
Relative to now. Units: s/sec/seconds, m/min/minutes, h/hr/hours, d/days, w/weeks |
in an hour, in a day, one week from now, 3 days from now |
a, an and one work as numbers; in and from now are optional |
tomorrow, tomorrow at 9am, tomorrow 18:30, today at 5:45pm |
A time of day in UTC (12- or 24-hour) |
now, immediately, right now |
Send now |
Matching ignores case and extra spaces. ISO dates without an offset are treated as UTC. A time in the past (or now) sends immediately; anything unrecognised fails with unrecognised date "…": use ISO 8601 or phrases like "in 1 hour".
While the email is still scheduled you can:
- reschedule it with
PATCH /emails/{id}and a newscheduled_at(in the future, within 30 days); - cancel it with
POST /emails/{id}/cancel.
Both return 409 (not_reschedulable / not_cancelable) once the email has been sent or canceled. A scheduled email shows last_event: "scheduled".
Attachments
Each attachment has either content (standard base64) or path (an http/https URL that Pidgely downloads when you send):
{
"attachments": [
{ "filename": "invoice.pdf", "content": "JVBERi0xLjcKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURlY29kZT4+CnN0cmVhbQp4nO1d…" },
{ "path": "https://files.acme.com/reports/october.csv", "content_type": "text/csv" },
{ "filename": "logo.png", "content": "iVBORw0KGgoAAAANSUhEUgAA…", "content_id": "logo" }
],
"html": "<img src=\"cid:logo\" alt=\"Acme\"> <p>Your files are attached.</p>"
}- Size. All attachments of an email share a budget of 40 MiB (decoded), and the whole message must stay under 40 MiB after encoding. There is no separate limit on the number of attachments.
- Remote
path. Fetched once at send time with a 30-second timeout. Only a200response is accepted, redirects are not followed, URLs with credentials and private or internal addresses are refused. The filename defaults to the last segment of the URL path, and the responseContent-Typeis used unless it istext/html. - Inline images. Set
content_idand reference it ascid:<content_id>in the HTML. - Content type is guessed from the extension when you omit
content_type(fallbackapplication/octet-stream). - Blocked types. Executables and scripts are rejected:
.exe .bat .cmd .com .cpl .dll .js .jse .msi .msp .pif .scr .vbs .vbe .wsf .wsh .hta .jar .ps1 .lnk .iso .img .vhd .reg .app .apk. - File names can't contain
/,\or line breaks.
Attachments of a sent email can be listed and downloaded with signed links valid for one hour.
Tags
Tags are name/value pairs (^[A-Za-z0-9_-]{1,256}$ for both) stored with the email and included in its webhook events. Use them to tie an email back to your own data:
{ "tags": [{ "name": "user_id", "value": "42" }, { "name": "category", "value": "password_reset" }] }Custom headers
headers adds headers to the message:
{ "headers": { "X-Entity-Ref-ID": "order-1234", "List-Id": "Acme receipts <receipts.acme.com>" } }Header names are 1 to 76 printable ASCII characters without :; values can't contain line breaks. Headers the platform manages are rejected: From, To, Cc, Bcc, Subject, Date, Message-ID, MIME-Version, Content-Type, Content-Transfer-Encoding, DKIM-Signature, Return-Path, Received, Sender, Reply-To (use reply_to), Feedback-ID, X-Pidgely-Ref, Authentication-Results and the ARC-* headers.
Streams
Pidgely keeps transactional and broadcast mail apart, on separate IP pools, so a marketing campaign never hurts the delivery of password resets. POST /emails uses the transactional stream by default. Set "stream": "broadcast" for bulk or marketing mail sent through the emails endpoint: those messages get List-Unsubscribe and List-Unsubscribe-Post headers (RFC 8058 one-click unsubscribe). Broadcasts always use the broadcast stream.
Open and click tracking
Opens and clicks follow the sending domain's open_tracking and click_tracking. tracking (Pidgely extension) overrides them for one email; a field you leave out follows the domain:
{ "tracking": { "opens": true, "clicks": false } }See Open and click tracking for how it works, the links that are never rewritten and privacy.
Templates
Instead of html/text, reference a published template and pass its variables:
{
"to": ["steve@example.com"],
"template": { "id": "order-confirmation", "variables": { "ORDER_ID": "1234", "TOTAL": 59.9 } }
}For a template with several languages, template.locale (a Pidgely extension) picks the language:
{
"to": ["maria@example.com"],
"template": { "id": "order-confirmation", "locale": "pt-BR", "variables": { "ORDER_ID": "1234", "TOTAL": 59.9 } }
}localefalls back to its primary language (es-MXuseses), then to another variant of the same language, then to the template's base language.- Without
locale, thelanguageproperty of the recipient's contact (firsttoaddress) is used, else the base language. Resend SDKs that do not knowlocalekeep working: they get the contact's language or the base. - The language used is returned by
GET /emails/{id}astemplate.locale.
Status of an email
GET /emails/{id} returns last_event, the most advanced status across the recipients:
last_event |
Meaning |
|---|---|
queued |
Accepted, waiting for delivery |
scheduled |
Waiting for its scheduled_at |
delivery_delayed |
A temporary failure; Pidgely retries for up to 72 hours |
delivered |
The receiving server accepted the message |
opened |
Delivered and opened (tracked emails) |
clicked |
Delivered and a link was clicked (tracked emails) |
bounced |
Bounced; a permanent bounce suppresses the address |
complained |
The recipient marked it as spam |
suppressed |
Not sent: the address is on the suppression list |
failed |
Gave up (retry window exhausted, account suspended, content expired) |
canceled |
Canceled before sending |
discarded |
Not sent: the recipient is in a reserved test domain (sandbox for tests) |
Test without sending: reserved domains
Addresses in domains that the internet reserves for tests (RFC 2606 and RFC 6761) are a free sandbox: .test, .example, .invalid, .localhost, .local, and example.com, example.net and example.org (any subdomain too). Use them in your automated tests, for example ana@suaapp.test.
Pidgely accepts the request exactly like a real one (same id, same response), so your test does not break, but it never reaches a mail server. Each such recipient ends as discarded, with the event email.discarded on the timeline, and counts nowhere: not in sent, bounces, suppressions, quota or your sender reputation. A test must never email a made-up address on a real domain (it would bounce and hurt your reputation); use a reserved domain and Pidgely discards it.
List the events of an email (Pidgely extension) returns the whole timeline: queued, each delivery with the remote server's answer, delays, bounces with their SES-style classification, complaints, every open and click, and each recipient's counters.
The bodies of sent emails are kept for 30 days.
Retries and timing
Temporary failures are retried after 1 minute, 5, 15 and 30 minutes, 1 and 2 hours, then every 4 hours, for up to 72 hours; each one emits email.delivery_delayed. Permanent failures bounce immediately. If the primary route is blocked or unreachable, Pidgely can deliver through a second own node.