Postilio docs

Authentication and API keys

Every request to the API carries an API key as a bearer token:

curl https://api.postilio.eu/v1/domains \
  -H "Authorization: Bearer $POSTILIO_KEY"

SMTP uses the same keys: user name apikey, the key as the password (see Sending email).

Keys

A key belongs to one project and works only on that project's domains, messages, suppressions and webhooks. Create keys in the portal under Keys & SMTP: Owners and Admins of the organization in every project, Developers in the projects they have access to.

Live and test keys

WhatLive key pk_live_…Test key pk_test_…
Checks (sender domain, restrictions, suppression list, validation)yesthe same
Delivers mailyesnever: every message gets simulated events at once
Sandbox and probation limitsyes, while the organization is in the sandbox or the probation after itno
Volume limityour project and plan limits, and the platform limitsa limit of its own instead: 3,000 recipients a minute and 100,000 a day per project, see Platform limits
Counts as usageyesno
Scopesanyemails:send, emails:read and domains:read at most

Test and live messages are kept apart: a test key finds only test messages and a live key only live ones; the other kind answers 404. Webhook endpoints have a mode too: a test endpoint gets the events of test messages only. The simulator addresses are in Suppressions and test mode.

Scopes

A key has one or more scopes. A call outside them answers 403 with {"error": "insufficient_scope"}.

ScopeAllows
emails:sendPOST /v1/emails, and SMTP submission
emails:readGET /v1/emails/{id}, GET /v1/emails/problems
domains:readGET /v1/domains, GET /v1/domains/{id}; also on a test key
domains:manageeverything domains:read allows, plus POST /v1/domains, DELETE /v1/domains/{id}, POST /v1/domains/{id}/check
suppressions:readGET /v1/suppressions, also to check one address
suppressions:manageeverything suppressions:read allows, plus POST /v1/suppressions, DELETE /v1/suppressions/{id}
webhooks:readGET /v1/webhooks, GET /v1/webhooks/{id}, GET /v1/webhooks/{id}/deliveries; never the signing secret
webhooks:manageeverything under /v1/webhooks
inbound:readGET under /v1/inbound: receiving domains, routes, received messages with their content, attachments and raw mail (see Inbound mail); also on a test key
inbound:manageeverything under /v1/inbound
usage:readGET /v1/usage, the project's usage per month (see Usage); live keys only, never on by default

Give each key only what it needs: the key on a web server that sends sign-in codes needs emails:send, nothing more. A plugin that only shows its sender domain's status needs domains:read, not domains:manage; a dashboard that watches your suppressions and webhook deliveries needs suppressions:read and webhooks:read.

Restrictions

Two optional limits per key, set when you create it or later in the portal (at most 20 entries each):

Without restrictions a key sends from every verified domain of the project, from anywhere.

Moving a key to another project

An Owner or Admin can move a key to another project of the same organization, on the key's page in the portal. It is the same key: its value, prefix, scopes, networks and mode stay, so your integration keeps working without a change.

Errors

StatuserrorWhy
401invalid_api_keyno Authorization: Bearer pk_… header, or a key that does not exist or was revoked
403insufficient_scopethe key lacks the scope this call needs
403client_ip_not_allowedthe key is restricted to networks this request does not come from
403organization_suspendedPostilio suspended the key's organization; nothing is sent until it is resumed
403project_suspendedthe key's project is paused or suspended, see Paused projects

A key of an organization that is being deleted stops working too, until the deletion is cancelled.

Response headers

Every answer from /v1 carries Cache-Control: no-store, so message data, recipients and webhook secrets are not kept in a browser or proxy cache. Over HTTPS the API sends Strict-Transport-Security as well: a browser that saw it uses only HTTPS for the API host from then on. The other browser security headers (Content-Security-Policy, X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer and the like) are there too; a client on a server can ignore them.

Signing in to the portal

The portal itself is signed in to with an e-mail address, a password and a second factor; the API never uses them. Failed sign-ins are limited so that nobody can guess a password, or shut you out of your own account by failing on purpose:

Only failures count; a successful sign-in takes its attempt back. The answers are the same whether or not an address has an account: the same 401 invalid_credentials for a wrong password and an unknown address, the same 429 and the same waiting time.

Passwords

A portal password has 12 to 256 characters; there are no rules about digits or symbols. A few unrelated words work well. Every new password (when you join, set up your account again, reset or change it) is also checked against Have I Been Pwned's Pwned Passwords, a list of passwords from known data breaches (CC BY 4.0). A password on that list is refused with This password appears in known data breaches. Choose another one.

The check uses k-anonymity: Postilio hashes the password with SHA-1 and sends only the first 5 of its 40 hex characters to api.pwnedpasswords.com (run behind Cloudflare, in the United States). The answer lists every known hash with that beginning, padded with fake entries so its size says nothing, and Postilio compares the rest of the hash itself. Your password, its full hash, your address and your account never leave Postilio, no cookies are sent, and none of it is logged. If the service does not answer within 2 seconds, the password is taken unchecked: the check never keeps you from setting a password.