sendpetrelgateway

Gateway API reference

For applications integrating with the sendpetrel gateway. Base URL https://api.sendpetrel.com — JSON in, JSON out, errors as RFC 9457 problem documents.

Access is issued per integration; there is no self-service sign-up. Field names and limits describe the current release; the generated /openapi.json is authoritative.

All endpoints

Every /v1 route needs an API key; the scope column names the permission the key must carry ("any key" means any valid key of the tenant). Resources are always scoped to the key's own tenant — another tenant's id answers 404.

Health

GET/health/livepublic

The API process is up.

GET/health/readypublic

Database reachable and delivery provider connected.

Sending domains

POST/v1/sending-domainsdomains:write

Register a domain you intend to send from.

GET/v1/sending-domainsany key

List your domains and their status.

GET/v1/sending-domains/{domain_id}any key

Read one domain.

GET/v1/sending-domains/{domain_id}/dns-recordsdomains:read

The DNS records to publish and their last-checked status.

POST/v1/sending-domains/{domain_id}/verification-checksdomains:write

Check the published records now.

GET/v1/sending-domains/{domain_id}/verification-checksdomains:read

The 20 most recent checks.

Messages and events

POST/v1/messagesmessages:write

Submit a message (requires Idempotency-Key); answers 202.

GET/v1/messagesany key

List your messages, newest first.

GET/v1/messages/{message_id}any key

Current state of one message.

GET/v1/messages/{message_id}/eventsmessages:read

One message's state history, oldest first.

GET/v1/eventsmessages:read

Recipient-level outcomes for your tenant, newest first, cursor-paged.

GET/v1/usagemessages:read

Current per-minute and per-day usage against your limits.

Suppressions

GET/v1/suppressionssuppressions:read

Addresses that will not receive your mail, filterable by reason.

POST/v1/suppressionssuppressions:write

Suppress an address manually.

DELETE/v1/suppressions/{address}suppressions:write

Lift a manual or soft-bounce suppression (hard bounces and complaints are operator-only).

Unsubscribes rolling out

GET/v1/unsubscribesunsubscribes:read

Opt-outs from your marketing mail, by topic, cursor-paged.

POST/v1/unsubscribesunsubscribes:write

Record an opt-out you received elsewhere.

DELETE/v1/unsubscribes/{address}unsubscribes:write

Re-subscribe an address; requires a consent_reference, which is audited.

GET/u/{token}public

Unsubscribe confirmation page linked from marketing mail (never unsubscribes by itself).

POST/u/{token}public

RFC 8058 one-click unsubscribe used by mail apps.

Authentication

Every request carries the integration's API key as a bearer token. Keys are scoped (for example messages:write, domains:read) and act only within their own tenant.

Authorization: Bearer edg_yourprefix_…

Keys are shown once when issued and stored only as a hash. If a key leaks, it is revoked and a new one issued.

Sending domains

Before you can send from a domain it must be verified:

  1. POST /v1/sending-domains with {"domain": "example.com"}.
  2. GET /v1/sending-domains/{domain_id}/dns-records returns the records to publish: an ownership TXT, an SPF include, a per-domain DKIM key, a return-path CNAME and (recommended) DMARC.
  3. POST /v1/sending-domains/{domain_id}/verification-checks checks them. When everything passes, the domain is reviewed and enabled for sending.

Sending a message

# send one message
curl https://api.sendpetrel.com/v1/messages \
  -H "Authorization: Bearer $SENDPETREL_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1042-receipt" \
  -d '{
    "from": "Example Shop <orders@example.com>",
    "to": ["customer@example.org"],
    "subject": "Your receipt",
    "text": "Thanks for your order.",
    "html": "<p>Thanks for your order.</p>"
  }'

The response is 202 Accepted with a message_id. Repeating a request with the same Idempotency-Key and body returns the original result instead of sending again.

FieldNotes
fromAn address on one of your verified domains, optionally with a display name.
toUp to 50 recipients.
subject, text, htmlAt least one of text or html; the whole message up to 200 KB.
reply_to, headers, tagsOptional. tags are returned with events.
categorytransactional (default) or marketing. Marketing mail gets List-Unsubscribe / List-Unsubscribe-Post (RFC 8058) headers automatically and must be addressed to a single recipient.
unsubscribe_topicOptional topic for marketing mail, e.g. newsletter; recipients can unsubscribe from one topic or from everything.

Delivery status and events

GET /v1/messages/{message_id} returns the current state; GET /v1/messages/{message_id}/events its history; GET /v1/events recipient-level outcomes for your account, newest first and cursor-paged.

StateMeaning
queuedAccepted by the API, waiting for the delivery worker.
sentHanded to the mail server; the receiving server has not answered yet.
deliveredThe recipient's mail server accepted the message.
deferredA temporary failure; it will be retried.
bounced / failedPermanently undeliverable. Hard bounces suppress the address.

Suppressions and unsubscribes

GET /v1/suppressions lists addresses that will not receive your mail (hard bounces, complaints, manual entries). POST /v1/suppressions adds one; DELETE /v1/suppressions/{address} lifts a manual or soft-bounce entry.

Unsubscribes from marketing mail are kept per account and topic: GET, POST and DELETE /v1/unsubscribes. Re-subscribing someone requires a reference to their consent. Unsubscribes never block transactional mail.

Limits

Each account has a per-minute rate limit and a daily quota; GET /v1/usage shows the current window. Requests over the limit get 429 with Retry-After.