Amail For developers Sign in

The API for businesses

Check that the agent emailing you is backed by a real person, by program. JSON over HTTPS under https://amail-api-production.up.railway.app/v1/supplier/, with your key as a bearer token.

The address in these examples, maya.shopping@amail.example, is made up. Here it answers not_active. Use the address an agent gave you.

Quick start

Five steps from nothing to a signed answer you can act on. The Node blocks, read in order, are one program: Amail's own tests run it as printed.

  1. Register

    One call with no key. The answer holds your key, shown once.

    curl

    curl -X POST \
      https://amail-api-production.up.railway.app/v1/supplier/register \
      -H 'content-type: application/json' \
      -d '{"name": "Larkfern Books", "domain": "larkfern.example",
           "email": "it@larkfern.example"}'
  2. Prove your domain by DNS

    Publish the TXT record you were given, then ask Amail to look. Until you do, you are an "unverified business": the agent is told nothing about you, and every code you open waits for its person to say yes.

    curl

    curl -X POST \
      https://amail-api-production.up.railway.app/v1/supplier/domain/dns \
      -H 'authorization: Bearer amail_sk_...'
  3. Run a verification against your sandbox

    This is a test deployment: GET /v1/supplier/sandbox gives you an address of your own whose verifications confirm by themselves 5 seconds after you open them (more). With a real agent, open it on the address the agent gave you and give the agent the code.

    curl

    curl \
      https://amail-api-production.up.railway.app/v1/supplier/sandbox \
      -H 'authorization: Bearer amail_sk_...'
    
    curl -X POST \
      https://amail-api-production.up.railway.app/v1/supplier/verifications \
      -H 'authorization: Bearer amail_sk_...' \
      -H 'content-type: application/json' \
      -d '{"address": "sandbox-...", "sessionRef": "chat-4417"}'
  4. Read the receipt

    Once status is confirmed, check the signed receipt with readSigned: it is made out to you, for your session. A sandbox receipt is a test receipt: refuse it in production.

    What countsthe signed receipt, checked by you: not what an agent says, and not a copy someone hands you. It is for acting on now; for later, the answer that counts is always the issuer's, asked now.

    curl

    curl \
      https://amail-api-production.up.railway.app/v1/supplier/verifications/kyv_... \
      -H 'authorization: Bearer amail_sk_...'
  5. Act only on the level you need

    Each level is a fixed fact (what each means). Decide what each may do with you. Ask again before you rely on it later: a person can switch their agent off.

    curl

    curl 'https://amail-api-production.up.railway.app/v1/check?address=maya.shopping%40amail.example'

No account? The check page does the same by hand. In Python, the same checks are printed whole under Verify anything Amail signed and Your webhook.

Every route

RouteWhat it does
GET/v1/checkThe public check of an address (no key)
GET/.well-known/amail-check-keysThe keys that sign check answers, receipts and records (no key)
POST/v1/supplier/registerRegister a business and get its first key (no key)
GET/v1/supplier/meThe business this key speaks for
GET/v1/supplier/keysThe business's keys
POST/v1/supplier/keysMake another key
POST/v1/supplier/keys/{id}/revokeRevoke a key
POST/v1/supplier/domain/dnsLook for the DNS record that proves the domain
GET/v1/supplier/verificationsYour verifications, newest first
POST/v1/supplier/verificationsOpen a verification: a one-time code for the agent
GET/v1/supplier/verifications/{id}One verification
POST/v1/supplier/messages/verifyDid Amail send this message?
GET/v1/supplier/agreementsYour agreements, newest first
POST/v1/supplier/agreementsPropose terms to an agent address
GET/v1/supplier/agreements/{id}One agreement
POST/v1/supplier/agreements/{id}/acceptAccept the terms the agent came back with
POST/v1/supplier/agreements/{id}/declineDecline the terms the agent came back with
POST/v1/supplier/agreements/{id}/endEnd an agreement
POST/v1/supplier/authorisationsIs this agent authorised for this offer?
GET/v1/supplier/requestsYour requests for details, newest first
POST/v1/supplier/requestsAsk an agent's person for details
GET/v1/supplier/requests/{id}One request
POST/v1/supplier/requests/{id}/cancelTake a request back
GET/v1/supplier/eventsWhat happened to what you started, after a cursor
GET/v1/supplier/webhookYour webhook
PUT/v1/supplier/webhookSet your webhook
DELETE/v1/supplier/webhookRemove your webhook
GET/v1/supplier/sandboxThe sandbox of a test deployment (on this test deployment)

The same, for a program: /openapi.json (OpenAPI 3.1). An index of these pages for a model: /llms.txt. What changed: Changelog, and /changelog.json.

Conventions

How
Your keyAuthorization: Bearer amail_sk_... on every call but register, the public check and its keys.
An error{"error": {"code", "message"}} with a status that fits; 400 invalid_request adds details: [{path, message}], one per field, never your value. Every code.
Retrying a POSTSend Idempotency-Key on POST /verifications, /requests, /agreements and /keys: the same key and body give the same answer, one-time code included, for 24 hours, with Idempotent-Replayed: true. Another body is 409 idempotency_key_reused. /authorisations changes nothing and needs none.
A listGET /verifications, /requests, /agreements: newest first, ?limit=&cursor=, answering {"items": [...], "next": "..."}; next is null on the last page. Requests and agreements also keep their first names, requests and agreements, beside items.
Too many429 with Retry-After in seconds. Every limit.
TimesISO 8601 in UTC; a day as YYYY-MM-DD. Amounts are strings with two decimals: "84.00".

Register and your keys

POST/v1/supplier/register

Your business's name (2 to 80 characters), the domain it runs, and an email address we can reach you at. No key.

curl
curl -X POST \
  https://amail-api-production.up.railway.app/v1/supplier/register \
  -H 'content-type: application/json' \
  -d '{"name": "Larkfern Books", "domain": "larkfern.example",
       "email": "it@larkfern.example"}'
JSON
{
  "supplier": {
    "id": "sup_5v30vw0kmks0gff8298zm1zqg3",
    "name": "Larkfern Books",
    "domain": "larkfern.example",
    "domainVerified": false,
    "domainVerifiedBy": null,
    "domainVerifiedAt": null,
    "domainCheckedAt": null,
    "domainUnproved": null,
    "domainRecordMissing": null,
    "createdAt": "2026-10-10T12:00:00.000Z",
    "domainProof": {
      "dns": {
        "type": "TXT",
        "name": "_amail.larkfern.example",
        "value": "amail-verify=k05fml2PdjNBb79PSUBJ2HXek0a1Kx7F"
      }
    }
  },
  "key": {
    "id": "spk_k6csckx5xnvkq03g2egtkh6rm7",
    "secret": "amail_sk_mKp650voMb0noghfrUm6jbkkiSmNLdQJvhvjrQS7cfQ"
  }
}

Shown onceAmail keeps only a hash of your key. Errors: 400 invalid_name, invalid_domain, invalid_email, public_suffix_domain, name_reserved, domain_reserved.

Your account and your keys

CallAnswers
GET /v1/supplier/me{"supplier": {...}}, as above: whether your domain is proved, and the record to publish.
GET /v1/supplier/keys{"keys": [{"id", "label", "createdAt", "lastUsedAt", "revokedAt"}]}. Never a secret.
POST /v1/supplier/keysAnother key. label is optional, up to 60 characters. 409 too_many_keys past the most you may hold.
POST /v1/supplier/keys/:id/revokeStops that key on the next call, the key you call with included. Answers with the list.
curl
curl -X POST \
  https://amail-api-production.up.railway.app/v1/supplier/keys \
  -H 'authorization: Bearer amail_sk_...' \
  -H 'content-type: application/json' \
  -d '{"label": "Warehouse system"}'
JSON
{
  "key": {
    "id": "spk_2pa26th6fewmq3tqk43kvqt2kr",
    "label": "Warehouse system",
    "createdAt": "2026-10-10T12:00:00.000Z",
    "lastUsedAt": null,
    "revokedAt": null
  },
  "secret": "amail_sk_FljI0XWAP0oYsHss8jIWW6dyAPeECLehZFxixbvb0MI"
}

Note the shapehere secret sits beside key; registering puts it inside.

Prove your domain

POST/v1/supplier/domain/dns

Publish the TXT record from domainProof.dns, then call this with no body. It answers {"supplier": {...}} with "domainVerifiedBy": "dns", or 409 dns_record_not_found while the record is not seen (a new record can take a few minutes).

Why it mattersUntil it is proved, the agent and its person see you as "unverified business" and nothing you typed, and every code you open waits for the person. A DNS record is the one proof: only whoever runs a domain can publish one.

Keep the recordIt is looked for again every day. Five misses in a row over at least three days and the domain is no longer proved; a lookup that fails is not a miss. You are emailed at a first miss.

One business holds a proved domain

  • 400 public_suffix_domain: a domain anyone can take a name under (co.uk, myshopify.com). Register your own name under it (shop.myshopify.com).
  • 409 domain_already_proved: another business holds the proof, and its record is still published.
  • When you stop holding the proof, your active agreements end at once (endedBy: "domain_proof"). Proving again brings none back.
Where you stand, field by field
  • domainCheckedAt: when the record was last seen.
  • domainRecordMissing: null, or {"since", "misses", "nextCheckAt", "unprovedAfter": {"misses": 5, "days": 3}} while the record is not seen. Put it back and it clears at the next look, six hours after a first miss, then twelve, then daily.
  • domainUnproved: null, or {"at", "reason"}: record_gone (another business published its record and yours had gone), email_retired (you proved it by an emailed code, which no longer proves anything), stronger_proof (another business published the record for a domain you had proved by email) or duplicate. Publish the record and call this again.
  • A proof by DNS is never taken by another while its own record is still published. Where the deployment has a reading service switched on, a name that poses as a bank, a public body, a mail provider or Amail itself, on a domain that is not theirs, is shown to the person with one line of caution: you are not told, and a proved domain does not take it away. What you prove is your domain, never your name.

Read an address

GET/v1/check?address=

The public check. No key.

curl
curl 'https://amail-api-production.up.railway.app/v1/check?address=maya.shopping%40amail.example'
JSON
{
  "address": "maya.shopping@amail.example",
  "checkedAt": "2026-10-10T12:00:00.000Z",
  "claims": {
    "status": "active",
    "switchedOff": null,
    "kind": "base",
    "createdOn": "2026-09-30",
    "closesOn": null,
    "oneOfSeveral": false,
    "goodStanding": true,
    "kya": {
      "level": 2,
      "name": "Live connection",
      "facts": [
        { "name": "mailbox_confirmed", "established": true,
          "establishedOn": "2026-10-03", "how": "sent_message",
          "validUntil": "2027-10-03" },
        { "name": "live_connection", "established": true,
          "establishedOn": "2026-10-04", "how": "forwarding_loop",
          "checkedOn": "2026-10-10T12:00:00.000Z" },
        { "name": "identity_verified", "established": false,
          "establishedOn": null, "how": null }
      ],
      "kyc": { "verified": false, "on": null }
    }
  },
  "statement": "eyJhbGciOiJFZERTQSIsInR5cCI6ImFtYWlsLWNoZWNrK2p3dCJ9.eyJpc3Mi.c2ln",
  "statementExpiresAt": "2026-10-10T12:05:00.000Z",
  "keysUrl":
    "https://amail-api-production.up.railway.app/.well-known/amail-check-keys",
  "statusUrl":
    "https://amail-api-production.up.railway.app/v1/check?address=maya.shopping%40amail.example"
}
FieldWhat it is
statusactive, closing, switched_off (with switchedOff.on, the day) or not_active. An address that never existed and a closed one both answer not_active, alike.
kindbase: the agent's main address. task: one it made for a single order or store.
kyaThe level, 1 to 3, its name, and each fact with how and when it was established (how to read a level).
statementThe same answer, signed, good until statementExpiresAt (five minutes). Shortened here.
statusUrlWhere to ask again. The answer that counts is always the issuer's, asked now: a copy, signed or not, says only what was true when it was signed.

What the signed copy holds

statement is a compact JWS of type amail-check+jwt. Its payload: iss this deployment, sub the address, iat and exp in seconds, five minutes apart, v the format, 2.

JSON
{
  "iss": "https://amail-api-production.up.railway.app",
  "sub": "maya.shopping@amail.example",
  "iat": 1791633600,
  "exp": 1791633900,
  "v": 2,
  "claims": { "…": "the claims object of the public check, whole" }
}

Verify anything Amail signed

Seven types, all compact JWS signed with Ed25519 by one key, told apart by typ in the header.

typWhat it isExpiresMade out to you
amail-check+jwtThe answer about an address.Yes, exp, five minutesNo
amail-receipt+jwtA receipt: the one signed result of a verification. Has sessionRef (yours) and a nonce.Yes, exp, fifteen minutesaud
amail-agreement+jwtA record: one change to an agreement.Noaud
amail-authorisation+jwtA signed answer to "authorised for this amount?".Yes, exp, ten minutesaud
amail-answer+jwtThe answer to a request for details: each item given or declined, a digest and never the value. Has sessionRef and a nonce.Yes, exp, thirty days, or a switch-offaud
amail-bundle+jwtNo longer made (the handshakes route is gone). One you hold stands as an answer does.Yes, exp, thirty days, or a switch-offaud
amail-invitation+jwtAn invitation to a shared space. Agents hold these, not businesses.Yes, exp, seven daysNo: sub is the invited address

Check each the same way: alg is EdDSA and typ the one you expect; the signature under the key kid names; iss the origin you fetched the keys from; sub the address you asked about; exp in the future where it expires; aud your own id (sup_...) where it is made out to you; v 2 for a check and a receipt; and for a receipt or an answer, your sessionRef (or the id you were given when you asked, as jti). readSigned below does all of it. Save it as amail-verify.mjs.

Test receiptsA test deployment's sandbox signs its receipts as amail-test-receipt+jwt, marked "test": true: they stand for nobody. readSigned refuses one unless you pass test: true. Never pass it in production.

Node

import { createPublicKey, verify } from 'node:crypto';

const ORIGIN = 'https://amail-api-production.up.railway.app';
let keys = [];
async function keyFor(kid) {
  let jwk = keys.find((key) => key.kid === kid);
  if (!jwk) {
    // Unknown kid: fetch the list again, once, then give up.
    const list = await fetch(ORIGIN + '/.well-known/amail-check-keys');
    keys = (await list.json()).keys;
    jwk = keys.find((key) => key.kid === kid);
  }
  return jwk ? createPublicKey({ key: jwk, format: 'jwk' }) : null;
}

// The types made out to one reader: aud is required. The one that records
// something that happened has no expiry; every other one must have one.
// A test deployment's sandbox signs its receipts as their own type: they stand
// for nobody. Refuse one, and anything marked test, unless want.test is true.
const TEST = 'amail-test-receipt+jwt';
const MADE_OUT = ['amail-receipt+jwt', 'amail-agreement+jwt', TEST,
  'amail-authorisation+jwt', 'amail-answer+jwt', 'amail-bundle+jwt'];
const RECORDS = ['amail-agreement+jwt'];
const VERSIONED = ['amail-check+jwt', 'amail-receipt+jwt', TEST];

// want: { typ, sub, aud, sessionRef, id }. For a receipt or an answer, name
// your sessionRef (best: pass one whenever you ask) or the id you were given
// when you asked (the verification's or the request's): Amail's nonce only
// makes each one unique, and ties it to nothing of yours.
export async function readSigned(jws, want) {
  const [head, body, signature] = jws.split('.');
  const { alg, typ, kid } = JSON.parse(Buffer.from(head, 'base64url'));
  if (alg !== 'EdDSA' || typ !== want.typ) throw new Error('wrong type');
  if (typ === TEST && want.test !== true) throw new Error('a test receipt');
  const key = await keyFor(kid);
  const signed = Buffer.from(head + '.' + body);
  const ok = key && verify(null, signed, key, Buffer.from(signature, 'base64url'));
  if (!ok) throw new Error('bad signature');
  const payload = JSON.parse(Buffer.from(body, 'base64url'));
  if (payload.test !== undefined && want.test !== true) {
    throw new Error('a test receipt');
  }
  if (payload.iss !== ORIGIN) throw new Error('wrong issuer');
  if (payload.sub !== want.sub) throw new Error('wrong address');
  const now = Date.now() / 1000;
  if (!RECORDS.includes(typ) && !(payload.exp > now)) throw new Error('expired');
  if (MADE_OUT.includes(typ)) {
    if (!want.aud) throw new Error('say whose you expect');
    if (payload.aud !== want.aud) throw new Error('not made out to you');
  }
  if (VERSIONED.includes(typ) && payload.v !== 2) throw new Error('older format');
  const NONCED = ['amail-receipt+jwt', 'amail-answer+jwt', TEST];
  if (NONCED.includes(typ)) {
    if (typeof payload.nonce !== 'string') throw new Error('no nonce');
    if (!want.sessionRef && !want.id) {
      throw new Error('say which session or request you expect');
    }
  }
  if (want.sessionRef && payload.sessionRef !== want.sessionRef) {
    throw new Error('for another session');
  }
  if (want.id && payload.jti !== want.id) {
    throw new Error('for another request');
  }
  return payload;
}
Why a nonce is not enough, and when an answer stops standing

The nonce is Amail's, and only makes each receipt and answer unique: you did not choose it, so it proves nothing about which of your sessions it belongs to. That is what sessionRef is for: pass one every time you ask, the reference you showed the agent in your own channel, and check it. By hand, on the check page, aud is by-hand: and the id that page opened.

An answer to a request stands until exp or until the person switches their agents off, whichever is first: a signature cannot know the future. Before you act on one, read answerValidUntil on the request again; a time already past means it is not good. You are also told by credential.changed.

The keys

GET/.well-known/amail-check-keys

JSON
{
  "keys": [
    { "crv": "Ed25519", "x": "-w0XtpH32zGrIeHyYYvDIyyrkon-20IyzIB795L4i3k",
      "kty": "OKP", "kid": "check_e88f7de894bcc560", "use": "sig", "alg": "EdDSA" }
  ],
  "statementType": "amail-check+jwt",
  "statementLifetimeSeconds": 300,
  "receiptType": "amail-receipt+jwt",
  "receiptLifetimeSeconds": 900,
  "formatVersion": 2,
  "ephemeral": false
}
  • Take the origin from your own settings, over HTTPS. Never from the thing you are checking.
  • Keep the list. You do not need to fetch it for every check.
  • On a kid you do not hold, fetch the list again, once. If the key is still not there, the signature is not Amail's.
  • ephemeral: true: this deployment made its key when it started and makes another at its next restart, so what it signed before then stops verifying. A production deployment refuses to start without a lasting key.

Verify an agent

An address check is about an address. A verification shows that the agent in front of you controls it: you get a one-time code, the agent gives it back to Amail naming you (your proved domain, or unverified), and you read one signed receipt.

POST/v1/supplier/verifications

Field
addressRequired. The address the agent gave you.
sessionRefYour reference for this session (a chat id, an order number): 1 to 128 printable characters, no spaces. It comes back in the receipt. Pass one every time.
purposeOne line, up to 200 characters, shown to the agent and the person as you typed it.
liveTesttrue: also test the live connection once the agent confirms.
terms, amount + currency, requestAnything else you need from the person, in the same code: below.
curl
curl -X POST \
  https://amail-api-production.up.railway.app/v1/supplier/verifications \
  -H 'authorization: Bearer amail_sk_...' \
  -H 'content-type: application/json' \
  -d '{"address": "maya.shopping@amail.example",
       "purpose": "Order 4417, 3 books", "sessionRef": "chat-4417",
       "liveTest": true}'
JSON
{
  "id": "kyv_z5p6ec2apvmcyzh8n55kxyhehc",
  "address": "maya.shopping@amail.example",
  "status": "waiting_for_agent",
  "purpose": "Order 4417, 3 books",
  "sessionRef": "chat-4417",
  "liveTestRequested": true,
  "createdAt": "2026-10-10T12:00:00.000Z",
  "expiresAt": "2026-10-11T12:10:00.000Z",
  "codeExpiresAt": "2026-10-10T12:10:00.000Z",
  "addressStatus": "active",
  "switchedOff": null,
  "askedBy": {
    "name": "Larkfern Books",
    "domain": "larkfern.example",
    "domainVerified": true,
    "domainVerifiedBy": "dns",
    "path": "api"
  },
  "confirmedAt": null,
  "credential": null,
  "kya": null,
  "liveTest": null,
  "receipt": null,
  "receiptExpiresAt": null,
  "code": "K7M2-9XWP"
}

The code8 characters, shown in two groups of four. The agent may give it back with or without the dash, in either case: dashes and spaces are ignored. It works once, for 10 minutes (codeExpiresAt), and is never shown again.

One fact, two spellingsthe agent's pending_verifications tells it who you are as proved and way; here and in the receipt they are askedBy.domainVerified and askedBy.path. The map.

GET/v1/supplier/verifications/:id

The same object without code. GET /v1/supplier/verifications lists yours, newest first, each item exactly as read alone. Once confirmed:

JSON
{
  "id": "kyv_z5p6ec2apvmcyzh8n55kxyhehc",
  "address": "maya.shopping@amail.example",
  "status": "confirmed",
  "purpose": "Order 4417, 3 books",
  "sessionRef": "chat-4417",
  "liveTestRequested": true,
  "createdAt": "2026-10-10T12:00:00.000Z",
  "expiresAt": "2026-10-11T12:10:00.000Z",
  "codeExpiresAt": "2026-10-10T12:10:00.000Z",
  "addressStatus": "active",
  "switchedOff": null,
  "askedBy": { "…": "as above" },
  "confirmedAt": "2026-10-10T12:01:12.000Z",
  "credential": { "…": "the address as it is now, with its signed statement" },
  "kya": { "…": "the level, as in Read an address" },
  "liveTest": {
    "id": "klt_8ggxfj3ya5dzt20g7je40k48sy",
    "address": "maya.shopping@amail.example",
    "status": "live",
    "confirmedAt": "2026-10-10T12:01:16.000Z",
    "roundTripMs": 3200,
    "reused": false,
    "askedAt": "2026-10-10T12:01:12.000Z",
    "completedAt": "2026-10-10T12:01:16.000Z"
  },
  "receipt":
    "eyJhbGciOiJFZERTQSIsInR5cCI6ImFtYWlsLXJlY2VpcHQrand0In0.eyJpc3Mi.c2ln",
  "receiptExpiresAt": "2026-10-10T12:16:16.000Z"
}
statusMeaning
waiting_for_agentNot confirmed yet. You are not told why, whatever keeps it waiting.
confirmedThe agent controls this address. Carries credential, kya, liveTest if asked, and receipt (null while a live test is still out: read again).
expiredNot confirmed a day and ten minutes after you opened it: nobody gave the code back, or the person said no or did not answer. You are not told which.
refusedThe code was presented five times by agents that do not control the address, or that named another business.

Act only on confirmedA no is learned only at the deadline, a day later, so treat everything else as "not yet": do not hold an order open for the day, offer your customer another way, and open a new verification rather than waiting on an old one (why).

It proves who, nothing moreyour first agreement, your first request for details and the first answer the agent would give you alone all wait for the person, who approves you once with their passkey.

Your sandbox, on a test deployment

GET/v1/supplier/sandbox

curl
curl \
  https://amail-api-production.up.railway.app/v1/supplier/sandbox \
  -H 'authorization: Bearer amail_sk_...'
JSON
{
  "address": "sandbox-3f9c0a1b2d4e5f6a7b8c9d0e@amail.example",
  "confirmsAfterSeconds": 5,
  "receiptMarked": "test"
}

Your own address, given to you alone: a plain verification of it that you open confirms by itself 5 seconds later, with a sample level (Live connection), "test": true on its view, and a receipt of type amail-test-receipt+jwt. To any other business it is an address nobody has. Terms, an amount or a request are refused (400 sandbox_plain_only). Only a test deployment has it: elsewhere the route does not exist.

Terms, an amount and a request, in the same verification

One code, one receipt, for everything you need from the person: terms as in an agreement, amount answered as "authorised?" is, request as in a request for details. Made whole or not at all.

curl
curl -X POST \
  https://amail-api-production.up.railway.app/v1/supplier/verifications \
  -H 'authorization: Bearer amail_sk_...' \
  -H 'content-type: application/json' \
  -d '{"address": "maya.shopping@amail.example",
       "purpose": "Order 20418", "sessionRef": "order-20418",
       "terms": {"kinds": ["offers"], "maxPerWeek": 1,
                 "duration": "30d"},
       "amount": "84.00", "currency": "USD",
       "request": {"items": ["delivery_address"],
                   "purpose": "deliver_order"}}'
JSON
{
  "id": "kyv_z5p6ec2apvmcyzh8n55kxyhehc",
  "status": "waiting_for_agent",
  "…": "the verification, as above",
  "code": "7KQM-3XPD",
  "complete": false,
  "parts": {
    "terms": { "…": "the agreement, as in Agree what you may send" },
    "amount": {
      "amount": "84.00",
      "currency": "USD",
      "authorised": null,
      "statement": null,
      "expiresAt": null
    },
    "request": { "…": "the request, as in Ask for details" }
  },
  "receipt": null,
  "receiptExpiresAt": null
}
  • complete turns true when every part is settled (event verification.completed); then receipt names each part's outcome, with the SHA-256 of the request's own signed answer and no value.
  • Terms are never accepted because the code was confirmed. Terms outside what the agent may agree come back declined, with a refusal that names no limit; the other parts go on.
  • A person who has to decide has a day; after it every line still open is a no.

The receipt

A compact JWS of type amail-receipt+jwt, made out to you alone, for acting on now: it expires fifteen minutes after it was signed. Keep it as your record; for later, read the address again. Verify it with readSigned, naming your aud and sessionRef. Its payload:

JSON
{
  "iss": "https://amail-api-production.up.railway.app",
  "sub": "maya.shopping@amail.example",
  "aud": "sup_5v30vw0kmks0gff8298zm1zqg3",
  "iat": 1791633676,
  "exp": 1791634576,
  "jti": "kyv_z5p6ec2apvmcyzh8n55kxyhehc",
  "v": 2,
  "nonce": "Jv0bK3x9QmT2rZc8pL5aWq",
  "sessionRef": "chat-4417",
  "receipt": {
    "verificationId": "kyv_z5p6ec2apvmcyzh8n55kxyhehc",
    "result": "confirmed",
    "issuedFor": {
      "id": "sup_5v30vw0kmks0gff8298zm1zqg3",
      "name": "Larkfern Books",
      "domain": "larkfern.example",
      "domainVerified": true,
      "domainVerifiedBy": "dns",
      "path": "api"
    },
    "address": "maya.shopping@amail.example",
    "purpose": "Order 4417, 3 books",
    "openedAt": "2026-10-10T12:00:00.000Z",
    "confirmedAt": "2026-10-10T12:01:12.000Z",
    "addressStatus": "active",
    "kya": { "…": "the level at that moment" },
    "liveTest": {
      "status": "live",
      "confirmedAt": "2026-10-10T12:01:16.000Z",
      "roundTripMs": 3200
    }
  }
}

Did Amail send this message?

Every message an agent address sends ends with a line Message code: K7M2Q-9XWPT. Give the code (or messageId, the Message-ID header) and the recipient it reached. Once your domain is proved you may leave recipient out: your domain is used.

POST/v1/supplier/messages/verify

curl
curl -X POST \
  https://amail-api-production.up.railway.app/v1/supplier/messages/verify \
  -H 'authorization: Bearer amail_sk_...' \
  -H 'content-type: application/json' \
  -d '{"address": "maya.shopping@amail.example", "code": "K7M2Q-9XWPT",
       "recipient": "orders@larkfern.example"}'
JSON
{
  "address": "maya.shopping@amail.example",
  "sent": true,
  "sentAt": "2026-10-10T11:58:03.000Z",
  "recipientDomain": "larkfern.example",
  "subjectSha256": "9b1f6c0f5a3f0d1e7c2b4a6988d7e5f4c3b2a1908f7e6d5c4b3a29181f0e9d8c",
  "bodySha256": "4e07408562bedb8b60ce05c1decfe3ad16b72230967de01f640b7e4729b49fce",
  "messageId": "<msg_8w522vafr1xqjxkw5dh4w3nra2@amail.example>"
}

No means no, and nothing elsea held message, a wrong code, another recipient and an address that is not ours all answer "sent": false with every other field null. No content is ever returned. 400 invalid_recipient: not one address, or left out before your domain is proved.

Comparing the digests

Compare subjectSha256 with the SHA-256 of the subject you received, and bodySha256 with the SHA-256 of the plain-text words in this form: lines end in a line feed alone, spaces and tabs at the end of each line removed, empty lines at the end removed, Unicode NFC, hashed as UTF-8. A difference means the words changed after they left, or a mail system rewrote them (a mailing list footer does). Both are an empty string once the message is no longer kept; bodySha256 is null for an answer Amail wrote with a person's details in it.

On email the message itself is the stronger proof: in production agent mail's domain publishes DMARC p=reject and is signed, so your server's dmarc=pass for the From address says it came through Amail.

Agree what you may send the person

Your mail always reaches the agent, and updates about an order always reach the person. Anything else reaches the person only under an agreement. You propose terms; the agent accepts, counters or declines, inside rules its person set that you are never told.

Terms are fixed choices, nothing else:

TermChoicesLeft out
kindsA list of any of offers, marketing, requests: offers, newsletters, questions for the person.[]: order updates only
maxPerWeek1, 3, 7: messages shown to the person in any seven days.1
duration30d, 90d, 1y, open (open: until someone ends it).30d
sharenothing, same_customer: one customerRef to recognise this customer again, different for every business.nothing

Send all foura term you leave out takes the most cautious choice, without saying so.

POST/v1/supplier/agreements

curl
curl -X POST \
  https://amail-api-production.up.railway.app/v1/supplier/agreements \
  -H 'authorization: Bearer amail_sk_...' \
  -H 'content-type: application/json' \
  -d '{"address": "maya.shopping@amail.example",
       "kinds": ["offers"], "maxPerWeek": 1,
       "duration": "90d", "share": "nothing"}'
JSON
{
  "agreement": {
    "id": "agr_71gejgqe3tfcccz571gdate9ag",
    "address": "maya.shopping@amail.example",
    "status": "proposed",
    "awaiting": "agent",
    "proposedBy": "supplier",
    "terms": {
      "kinds": ["offers"],
      "maxPerWeek": 1,
      "duration": "90d",
      "share": "nothing"
    },
    "alwaysAllowed": ["order_updates"],
    "createdAt": "2026-10-10T12:00:00.000Z",
    "acceptedAt": null,
    "endsAt": null,
    "endedAt": null,
    "endedBy": null,
    "messages": { "shown": 0, "held": 0, "orderUpdates": 0 },
    "customerRef": null,
    "receipts": [
      {
        "event": "proposed",
        "by": "supplier",
        "at": "2026-10-10T12:00:00.000Z",
        "receipt": "eyJhbGciOiJFZERTQSIsInR5cCI6ImFtYWlsLWFncmVlbWVudCtqd3QifQ.e30.c2ln"
      }
    ]
  }
}
CallDoes
GET /v1/supplier/agreementsYours, newest first: {"agreements", "items", "next"}.
GET /v1/supplier/agreements/:idOne.
POST /v1/supplier/agreements/:id/acceptAccepts the terms the agent came back with. 409 nothing_to_accept, or 409 outside_what_agent_may_agree if they have since fallen outside its rules.
POST /v1/supplier/agreements/:id/decline, /endOne call under two names: turns a proposal away, or ends an active agreement, at once.
statusMeaning
proposedWaiting for an answer. awaiting: agent, or supplier when the agent came back with other terms.
waiting_for_personThe agent accepted and its person approves this themselves. The first agreement with a person always waits for them.
activeIn force until endsAt, or until someone ends it.
declinedTurned away by the agent, the person or you, or for your domain proof (endedBy: "domain_proof").
endedWas active and is over. endedBy: supplier, agent, person, switched_off, time or domain_proof.
expiredNobody answered in fourteen days.

Errors409 agreement_exists (end the one you have first), 409 domain_not_allowed (a domain many unrelated senders share), 400 invalid_request (a term that is not one of the choices). Posting again while your proposal is open replaces its terms.

How an agreement changes while it stands
  • The person can narrow their rule at any time: an agreement outside it ends at once, endedBy: "person".
  • An active agreement can go back to waiting_for_person when its person asks to approve that kind themselves. A yes makes it active again with the same dates; a no ends it.
  • One that reaches endsAt is ended within a minute, with a signed record whose by is time.
  • A proposal to an address that is not active is taken like any other and never answered.
  • The weekly number is yours for that person over any seven days: ending an agreement and making another does not reset it.

Say what each message is

One header on every message you send to an agent address:

HTTP
X-Amail-Kind: offer
What it isIn the headerIn kindsWhat the agent is told
An update about an orderorder-updatealways allowed (alwaysAllowed: order_updates)order_update
An offerofferoffersoffers
A newslettermarketing (or newsletter)marketingmarketing
A question for the personrequestrequestsrequests
A message that does not saynonenever alloweduntagged

Heldno header (unless it reads as an order update), a kind not agreed, past maxPerWeek, sent to a list, or not what it says it is. Held mail still reaches the agent as fields; the person is not shown it; messages.held counts it, with no reason.

What else decides whether a message counts
  • Send from your proved domain (or a subdomain), signed so DMARC passes. Until it is proved, only mail from exactly the domain you registered counts as yours.
  • order-update opens nothing by itself: the message has to read as one (an order number, a total, a tracking number).
  • List-Unsubscribe, List-Id or Precedence: bulk make it marketing, whatever the header says.
  • Where a reading service is switched on, a message that reads as another kind than it says is held. It can only hold back, never let through.
  • While an agreement is active, its address stays open to your proved domain even if it was a task address that has since closed.

The record of each change

Every change comes with a compact JWS in receipts, type amail-agreement+jwt, made out to you, with no expiry. Its payload:

JSON
{
  "iss": "https://amail-api-production.up.railway.app",
  "sub": "maya.shopping@amail.example",
  "aud": "sup_5v30vw0kmks0gff8298zm1zqg3",
  "iat": 1791633780,
  "jti": "age_r0ytn087q4anxr8gamwg675sz7",
  "agreement": {
    "id": "agr_71gejgqe3tfcccz571gdate9ag",
    "event": "accepted",
    "by": "agent",
    "status": "active",
    "issuedFor": {
      "id": "sup_5v30vw0kmks0gff8298zm1zqg3",
      "name": "Larkfern Books",
      "domain": "larkfern.example",
      "domainVerified": true
    },
    "address": "maya.shopping@amail.example",
    "terms": {
      "kinds": ["offers"],
      "maxPerWeek": 1,
      "duration": "90d",
      "share": "nothing"
    },
    "alwaysAllowed": ["order_updates"],
    "acceptedAt": "2026-10-10T12:03:00.000Z",
    "endsAt": "2027-01-08T12:03:00.000Z",
    "endedAt": null,
    "customerRef": null
  }
}

Is this agent authorised for this amount?

Before you take an order, ask whether the agent may commit to the amount without asking its person. You need a verification of that address the agent confirmed for you in the last day. Safe to send again: it changes nothing.

POST/v1/supplier/authorisations

curl
curl -X POST \
  https://amail-api-production.up.railway.app/v1/supplier/authorisations \
  -H 'authorization: Bearer amail_sk_...' \
  -H 'content-type: application/json' \
  -d '{"address": "maya.shopping@amail.example",
       "amount": "79.99", "currency": "EUR",
       "verificationId": "kyv_z5p6ec2apvmcyzh8n55kxyhehc"}'
JSON
{
  "id": "auc_0k8gr1p2142hfx9sas6xrg7b5p",
  "address": "maya.shopping@amail.example",
  "amount": "79.99",
  "currency": "EUR",
  "authorised": "yes",
  "askedAt": "2026-10-10T12:04:00.000Z",
  "expiresAt": "2026-10-10T12:14:00.000Z",
  "statement":
    "eyJhbGciOiJFZERTQSIsInR5cCI6ImFtYWlsLWF1dGhvcmlzYXRpb24rand0In0.e30.c2ln",
  "keysUrl":
    "https://amail-api-production.up.railway.app/.well-known/amail-check-keys"
}
authorisedMeaning
yesThe agent may commit to this amount now.
needs_personThe agent has to ask its person first. Wait for it to come back.
noThis agent may not buy: its person said so, switched off, or took back its key.

One word, never a limitno remainder and no reason. A yes counts against what the person lets the agent spend in a month. Probing many amounts stops working: after two answers that were not yes, or six questions, everything is needs_person for a day. 409 verification_needed without a verification that fits.

statement is the signed answer, amail-authorisation+jwt, made out to you, good for ten minutes.

Ask for a delivery address, a phone number, an answer

The agent never holds its person's details. You ask Amail; the person's own rule decides; Amail gives you what was allowed, once, with a signed answer. You need a verification of that address the agent confirmed for you in the last thirty days.

POST/v1/supplier/requests

curl
curl -X POST \
  https://amail-api-production.up.railway.app/v1/supplier/requests \
  -H 'authorization: Bearer amail_sk_...' \
  -H 'content-type: application/json' \
  -d '{"address": "maya.shopping@amail.example",
       "purpose": "deliver_order", "orderRef": "ORD-20418",
       "sessionRef": "order-20418",
       "items": ["delivery_address", "phone"],
       "note": "So the courier can ring you on the day."}'
JSON
{
  "request": {
    "id": "ask_4t0c6k2m9q1x7v3b8n5d2h6j0p",
    "address": "maya.shopping@amail.example",
    "status": "waiting_for_agent",
    "purpose": "deliver_order",
    "orderRef": "ORD-20418",
    "sessionRef": "order-20418",
    "items": [
      { "item": "delivery_address", "state": "waiting" },
      { "item": "phone", "state": "waiting" }
    ],
    "createdAt": "2026-10-10T12:05:00.000Z",
    "expiresAt": "2026-10-17T12:05:00.000Z",
    "answeredAt": null,
    "valuesUntil": null,
    "receipt": null,
    "answerValidUntil": null,
    "keysUrl":
      "https://amail-api-production.up.railway.app/.well-known/amail-check-keys"
  }
}
Field
purposeOne of deliver_order, contact_about_delivery, complete_order, other.
itemsEach asked once: the items below.
orderRefAn order number: letters, digits and at most two dashes, 4 to 24 long, no word in it.
sessionRefYours, as for a verification; it comes back in the signed answer.
noteOne line for the person only. The agent never sees it.
ItemWhat comes back when it is given
delivery_addressvalue: line1, line2, city, region, postalCode, country (two letters). An empty part is left out.
phonevalue.number, with its country code: +447700900123
order_namevalue.name: the name a parcel is sent to
confirmanswer: true or false, about the order in orderRef, which it needs
{"item": "choose", "options": [...]}answer: one of your options, each a short label of letters and digits.
date, or {"item": "date", "dates": [...]}answer: YYYY-MM-DD, one of yours when you offered some

First time, the person decideswhatever their rule says: they see your proved domain, and approve you with their passkey. Each item reads waiting, then waiting_for_person, given or declined; declined never says why. Nothing is given until the whole request is settled.

The answer

GET/v1/supplier/requests/{id}

JSON
{
  "request": {
    "id": "ask_4t0c6k2m9q1x7v3b8n5d2h6j0p",
    "address": "maya.shopping@amail.example",
    "status": "answered",
    "purpose": "deliver_order",
    "orderRef": "ORD-20418",
    "sessionRef": "order-20418",
    "items": [
      {
        "item": "delivery_address",
        "state": "given",
        "value": {
          "line1": "12 Harbour Lane",
          "line2": "Flat 3",
          "city": "Bristol",
          "region": "Avon",
          "postalCode": "BS1 4QA",
          "country": "GB"
        },
        "salt": "Zk3vQ0m1x8bT2nYw5rLd9A",
        "digest":
          "9f2c1b7e4a6d8c0f3e5b7a9d1c2e4f6a8b0d2c4e6f8a0b1c3d5e7f9a1b3c5d7e"
      },
      { "item": "phone", "state": "declined" }
    ],
    "createdAt": "2026-10-10T12:05:00.000Z",
    "expiresAt": "2026-10-17T12:05:00.000Z",
    "answeredAt": "2026-10-10T12:06:00.000Z",
    "valuesUntil": "2026-10-11T12:06:00.000Z",
    "receipt":
      "eyJhbGciOiJFZERTQSIsInR5cCI6ImFtYWlsLWFuc3dlcitqd3QifQ.e30.c2ln",
    "answerValidUntil": "2026-11-09T12:06:00.000Z",
    "keysUrl":
      "https://amail-api-production.up.railway.app/.well-known/amail-check-keys"
  }
}
FieldWhat it is
valueIn this answer to you and nowhere else, until valuesUntil; then erased. Keep what you need. "valueUnreadable": true: nothing left to collect, ask again.
receiptThe signed answer, amail-answer+jwt, made out to you: each item's state, a nonce and your sessionRef, no value. Verify it with readSigned.
answerValidUntilUntil when to rely on it: thirty days, or the start (UTC) of the day the person next switches off. Read it again before you act.
digestSHA-256, in hex, of salt, a line break, and value as JSON with its keys in order and no spaces. With value and salt you can show what you were given.

GET /v1/supplier/requests lists yours ({"requests", "items", "next"}); POST /v1/supplier/requests/{id}/cancel takes one back. 409 verification_needed: no such address, no such verification, or the person switched off, alike.

Events and webhooks

Be told instead of reading again. An event is a type and ids, never content: read what it names to see what it says now. You are told only about what you started, and about addresses you verified lately.

GET/v1/supplier/events?after={cursor}&wait={seconds}

curl
curl \
  https://amail-api-production.up.railway.app/v1/supplier/events?after=now&wait=25 \
  -H 'authorization: Bearer amail_sk_...'
JSON
{
  "events": [
    {
      "id": "evt_524737824d98448ca674acc0dc",
      "type": "verification.confirmed",
      "createdAt": "2026-10-10T12:01:00.000Z",
      "data": { "verificationId": "kyv_z5p6ec2apvmcyzh8n55kxyhehc" }
    },
    {
      "id": "evt_97d3c033dfca45468050bb3d5e",
      "type": "request.answered",
      "createdAt": "2026-10-10T12:09:00.000Z",
      "data": { "requestId": "ask_4t0c6k2m9q1x7v3b8n5d2h6j0p" }
    }
  ],
  "cursor": "UtWOPWELQrbm_1JQhZctIA"
}
Parameter
afterThe cursor of your last call; now to start from the newest event kept; left out, from the oldest (30 days). A cursor works only for you.
waitUp to 25 seconds: a call that finds nothing holds on until an event arrives, or answers empty with the same cursor. Two calls with one key may wait at once.
limitUp to 100 events, oldest first.
TypeWhat happenedRead
verification.confirmed, verification.refused, verification.expiredA verification you opened was confirmed, refused, or can no longer be confirmed. You are never told that it waits for the personGET /v1/supplier/verifications/{verificationId}
verification.completedEvery part of a verification with parts is settled and its agent confirmed: the receipt is readyGET /v1/supplier/verifications/{verificationId}
credential.changedThe person behind an address you hold something on switched off, closed their account, or fell a rung. Dated by the day. Read the address again before you rely on anything it gave youGET /v1/supplier/verifications/{verificationId}, then GET /v1/check
live_test.finishedThe live test inside a verification has its resultthe verification it was asked in
agreement.proposedThe agent proposed terms, or answered yours with othersGET /v1/supplier/agreements/{agreementId}
agreement.waiting_for_person, agreement.accepted, agreement.declined, agreement.endedAn agreement changed. Ended covers every way one endsGET /v1/supplier/agreements/{agreementId}
agreement.expiredTerms nobody answered in fourteen daysGET /v1/supplier/agreements/{agreementId}
request.waiting_for_person, request.answered, request.expired, request.cancelledA request for details changedGET /v1/supplier/requests/{requestId}

Your webhook

PUT/v1/supplier/webhook

curl
curl -X PUT \
  https://amail-api-production.up.railway.app/v1/supplier/webhook \
  -H 'authorization: Bearer amail_sk_...' \
  -H 'content-type: application/json' \
  -d '{"url": "https://larkfern.example/hooks/amail"}'
JSON
{
  "webhook": {
    "url": "https://larkfern.example/hooks/amail",
    "status": "active",
    "createdAt": "2026-10-10T12:00:00.000Z",
    "updatedAt": "2026-10-10T12:00:00.000Z",
    "failingSince": null,
    "pausedAt": null,
    "lastSuccessAt": null,
    "lastFailureAt": null,
    "lastFailure": null,
    "confirmedAt": "2026-10-10T12:00:01.000Z",
    "waiting": 0,
    "notice": null
  },
  "secret": "amail_whsec_..."
}

Answer the challengewhen you set it, Amail first posts webhook.verify with data.challenge. Answer within ten seconds with 200 and {"challenge": "..."}, or the webhook reads unconfirmed and is sent nothing. The call answers after the challenge.

GET /v1/supplier/webhook reads it without the secret; DELETE removes it. One per business; setting it again replaces it, with a new secret. A webhook set before Oct 14, 2026 is unconfirmed until you set it again (notice says so).

Check every delivery before you act on it:

Node

import { createHmac, timingSafeEqual } from 'node:crypto';

// secret: the one shown when you set the webhook. rawBody: the
// body exactly as it arrived, before any JSON parsing.
function fromAmail(headers, rawBody, secret) {
  const at = Number(headers['amail-timestamp']);
  if (!Number.isInteger(at)) return false;
  // More than five minutes either way: refuse it, even if signed.
  if (Math.abs(Date.now() / 1000 - at) > 300) return false;
  const want = Buffer.from('v1=' + createHmac('sha256', secret)
    .update(`${at}.${rawBody}`).digest('hex'));
  // Compared as bytes of equal length: a header outside ASCII is a no.
  const got = Buffer.from(String(headers['amail-signature'] ?? ''));
  return got.length === want.length && timingSafeEqual(got, want);
}
// Then keep each Amail-Event-Id you have handled, and skip one you
// have seen: an event can arrive more than once.

// When the webhook is set, agree to it: give the challenge back.
// (It arrives before you hold the secret, so it cannot be checked.)
function answerChallenge(event) {
  return event.type === 'webhook.verify'
    ? { status: 200, headers: { 'content-type': 'application/json' },
        body: JSON.stringify({ challenge: event.data.challenge }) }
    : null;
}
How deliveries work, in full
  • Each event is one POST of the event as JSON (id, type, createdAt, data), with the headers Amail-Event-Id, Amail-Timestamp (seconds since 1970) and Amail-Signature: v1= and the hex HMAC-SHA256, under your signing secret, of the timestamp, a dot, and the body as sent.
  • Your receiver agrees first. When you set the webhook, Amail posts one event of type webhook.verify, signed like every other, with data.challenge: a one-time value. Answer it within ten seconds with status 200, Content-Type: application/json, and a body of exactly one JSON object whose top-level challenge is the one sent: {"challenge": "whc_..."}, at most 1024 bytes. An answer that only holds the challenge somewhere (the event sent back, the challenge nested under data, as plain text) is not taken: a service that answers with what it was sent agrees to nothing. Until your receiver has, the webhook reads status: "unconfirmed", lastFailure: "not_confirmed" (or timeout, connection, http_ and the status), and it is sent nothing at all; the feed has every event either way. Set the webhook again to be asked again. So nobody can point Amail at someone else's address. The challenge comes before you are shown the secret, so you cannot check its signature: answer it, and check every event after it.
  • Answer an event with any 2xx within five seconds. Anything else is a failure: a redirect is not followed, and what you answer is not read beyond its status.
  • At least once, in order. An event that failed is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours, then given up; the ones after it wait their turn. The feed still has every event either way. An event can arrive twice: use Amail-Event-Id to skip one you have handled.
  • Paused after three days in which nothing got through. What waited for it is given up, and nothing new is queued for it. Read GET on the webhook to see status, failingSince, pausedAt and lastFailure (a fixed word: timeout, connection, redirect, not_public, or http_ and the status). Set the webhook again to start again.
  • Only the public internet. A webhook is https on port 443, with no name or password in it. Its host is looked up when you set it and again before every delivery: if any address it has is private, loopback, link-local, shared (CGNAT), multicast, reserved or for documentation, in IPv4 or IPv6, it is refused, and a delivery to it fails as not_public. The connection goes to the address that was checked; the name is not looked up a second time.
  • Your signing secret is shown once, when you set the webhook, and Amail keeps no copy: it is worked out again for each delivery. Setting the webhook again gives a new secret and the old one stops working at once, asks your receiver to agree again, and drops what was waiting to be sent to the old one (the feed keeps it).

Errors

One shape, everywhere: code for your program, message one plain sentence for a person.

JSON
{ "error": { "code": "supplier_unauthorized", "message": "That key is not valid." } }
JSON
{ "error": { "code": "invalid_request",
    "message": "limit: ... (and 1 more: see details)",
    "details": [ { "path": "limit", "message": "..." },
                 { "path": "cursor", "message": "..." } ] } }

Every statusa path that is no route is 404 not_found in this same shape, whatever its method. Every 429 carries Retry-After in seconds. Something wrong on our side is 500 internal_error.

CodeStatusWhat it means
invalid_request400The body or a value in it was not understood. The message names the value where it can: a term that is not one of the fixed choices, a liveTest that is not true or false, a message check with neither a code nor a Message-ID. Where fields did not fit their shape, details lists each one as {path, message}, never with what you sent.
invalid_idempotency_key400An Idempotency-Key is 1 to 200 printable characters with no spaces.
sandbox_plain_only400The sandbox address confirms a plain verification only: leave out terms, amount and request.
invalid_address400The address is missing, or is not one email address.
invalid_name400A business name is 2 to 80 characters on one line.
invalid_domain400Give the domain your business runs, for example shop.example.
invalid_email400Give one email address.
invalid_label400A key label is up to 60 characters on one line.
invalid_purpose400A purpose is one line of up to 200 characters.
invalid_session_ref400A sessionRef is 1 to 128 printable characters with no spaces: the reference you showed the agent in your own channel.
invalid_amount400Give the amount as a number with two decimals, for example "80.00".
invalid_currency400Give the currency as its three-letter code, for example EUR.
name_reserved400The name reads as Amail's own.
domain_reserved400The domain is one of Amail's own.
public_suffix_domain400Anyone can take a name under that domain (co.uk, myshopify.com), so it is no business's own. Register the name your business runs under it.
invalid_webhook400A webhook is an https address on port 443, of up to 500 characters, with no name or password in it.
webhook_not_public400The webhook's host could not be looked up, or one of its addresses is not on the public internet (private, loopback, link-local, shared, multicast or reserved, in IPv4 or IPv6).
invalid_cursor400The cursor was not one the feed or the list gave you. Pass the cursor of your last call (a list: its next), or none to start from the oldest event kept (a list: the newest item).
too_many_unchecked_requests429Your person already has as many requests from askers that proved no domain as reach them in a day. The code was right; nothing was confirmed and nothing reached them. Tell the business; it can try tomorrow, or prove its domain.
too_many_waits429This key already has two calls to the feed waiting. Wait for one to answer.
too_many_webhook_changes429The webhook was set or removed ten times this hour.
supplier_unauthorized401The key is missing, wrong or revoked. A call to the feed that was waiting answers this the moment its key is revoked.
not_found404There is no such key, verification, live test or agreement of yours, or no such route. Another business's is answered the same way.
too_many_keys409You hold the most keys allowed. Revoke one first.
idempotency_key_reused409That Idempotency-Key was used for another call or another body in the last 24 hours. Use a new key for a new call.
dns_record_not_found409The TXT record was not seen. A new record can take a few minutes.
domain_already_proved409Another business holds the proof of this domain, and its DNS record is still published. Only one business can hold it.
public_suffix_domain409A business registered under a domain anyone can take a name under is never proved.
agreement_exists409You already have an agreement with this address. End it before proposing another.
domain_not_allowed409No agreement is made for a domain that many unrelated senders share.
nothing_to_accept409No terms are waiting for your answer on this agreement.
outside_what_agent_may_agree409Your terms are outside what this agent may agree. It names no limit.
verification_needed409Give a verification of this address that its agent confirmed for you in the last day, with questions left on it.
too_many_requests429A limit below was reached. The message says which. Wait and try again.

Limits

Past a limit: 429 too_many_requests, a message that says which, and Retry-After. Each number is read from the running code.

WhatLimit
Calls with one key120 a minute
Past any limit429, with Retry-After: the seconds until the limit lets one more through; where a limit counts what is waiting rather than a window, 60
A list (verifications, requests, agreements)newest first, a page at a time (limit), and next: the cursor of the page after, or null; every list answers items and next. Verifications: 20 unless asked, at most 50; requests and agreements: up to 100
List calls with one key20 a minute, counted inside its calls
An Idempotency-Key (on POST verifications, requests, agreements and keys)1 to 200 printable characters, scoped to the API key that sends it; the same key and body give the same answer for 24 hours (then 409 idempotency_key_reused for another body); only an answer that succeeded is kept, at most 500 for one business (its oldest goes first), and revoking an API key forgets its answers. Kept in memory only, so a restart forgets it. Asking "authorised?" changes nothing and is safe to send again without one
The sandbox, on a test deployment onlyyour own address, sandbox- and 24 characters nobody else can work out @ the agents' domain, given to you alone (GET /v1/supplier/sandbox): a plain verification of it that you open confirms by itself 5 seconds after it was opened; to any other business it is an address nobody has. Its view says test: true and carries a sample level (Live connection), and its receipt is an amail-test-receipt+jwt, which stands for nobody and which a reader of receipts refuses. No other deployment has the route or the addresses
Keys one business may hold at once5 (then 409 too_many_keys)
Registrations from one network address5 in 10 minutes
A domain proved by DNSits record is looked for again every 24 hours, and 6 hours after a miss; after 5 misses in a row over at least 3 days it is no longer proved. A lookup that fails is not a miss and is asked again after 1 hour. You are emailed at a first miss, once in 7 days at most
A signed check answergood for 5 minutes
A receiptmade out to you alone; good for 15 minutes after it was signed
A session reference (sessionRef)1 to 128 printable characters, no spaces
Verifications one business may open120 an hour
Verifications of one address, by every business with a key30 an hour
A verification code8 characters, good once, for 10 minutes
A verification that is not confirmedmay still be confirmed for 10 minutes and 24 hours after it was opened, whatever keeps it waiting (its person may be deciding); then it reads expired
A code presented by agents that do not control its address, or that name another business5 times, then the verification is refused
Real live tests of one address, whoever asks12 a day unless the deployment sets another number; past it the test answers "unavailable". Each address of a person has its own day, so no answer says two addresses share one
A live test resultreused for 5 minutes for the same address
Being told an address you verified changed (credential.changed)for 30 days after the agent confirmed your verification
A live test inside a verificationgives up after 60 seconds; the receipt waits for it
Message checks one business may make300 an hour
A message code10 characters
Proposals one business may make60 an hour
Proposals waiting at one address20 from businesses with a proven domain, 5 from the rest
A proposal nobody answerslapses after 14 days
A verification, for asking "authorised?"good for 24 hours and 3 questions
"Authorised?" questions about one person in a dayafter 2 answers that were not yes, or 6 questions, no answer is yes until a day has passed
A signed authorisation answergood for 10 minutes
A verification, for asking for detailsgood for 30 days to ask; what you ask a person who has not approved you before waits for them
Requests for details one business may make120 an hour
Requests from one business to one person5 a day; past it a request is taken, waits like any other, and is shown to nobody
A requesta note of up to 280 characters for the person only; a choice of 2 to 6 options
A request nobody answersruns out after 7 days
What you were givencan be read for 24 hours, then it is erased; the signed answer is good for 30 days, or until the person switches their agents off, whichever is first
Verifications with terms, an amount or a request60 an hour for one business
Requests read from mail, for one person2 a day from one sender's domain, whichever mailbox there writes; where anyone can have a mailbox, 2 a day from one address and 4 from all of that domain's; 10 a day from every sender together
How long an event is kept in the feed30 days
Events in one answer of the feed100 at most
How long one call to the feed may wait25 seconds (wait)
Calls to the feed waiting at once2 for one key, 500 on one server (then 429 too_many_waits)
Setting or removing a webhook10 times an hour (then 429 too_many_webhook_changes)
A webhook addresshttps, port 443, a public address, up to 500 characters; its host is looked up for at most 5 seconds
One delivery5 seconds to connect and answer with a 2xx; a redirect is a failure; at most 4096 bytes of the answer are read and none kept
The challenge when a webhook is set10 seconds to answer 200, as application/json, with one JSON object whose top-level challenge is exactly the one sent, in at most 1024 bytes; until then nothing is sent to it
A delivery that failedtried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 12 hours, then given up; the feed still has it
A webhook that keeps failingpaused after 3 days in which nothing got through; set it again to start again

Without a key

WhatLimit
Address checks from one network address (page or GET /v1/check)30 a minute
From one network address, in 10 minutes5 verifications, 10 message checks, 600 reads of a result
By-hand verifications of one address10 an hour, counted apart from businesses with a key
By-hand codes for one address, from one network address3 an hour, on the verify page and the ask page together
A by-hand request whose code nobody confirmeddeleted 60 minutes after the code ran out
Asking by hand, from one network address, in 10 minutes5 requests, 600 reads of where one stands
By-hand requests that reach one person5 a day, once an agent of theirs confirmed each code; past it a request is declined
Verifications from askers that proved no domain (by hand, or a business with no proof) that reach one person10 a day, whichever of their addresses was asked; past it the agent's confirm is refused with too_many_unchecked_requests, nothing reaches the person, and the verification waits for the agent until it runs out
By-hand message checks, and live tests inside by-hand verifications, the person is shownthe newest 5 a day for one address

A network address is one IPv4 address, or one IPv6 /64. Limits per network address and per key are counted by each server on its own.

Rules that always hold

  • Your name and purpose are shown to the agent and the person as you typed them, as text, and marked "unverified business" until your domain is proved.
  • An agent never sees your key; you never see its token. The one-time code is all that passes, and the agent gives it back only under your name.
  • Proving who the agent is gives you nothing else: what you ask of the person goes to them the first time.
  • An event is a type and ids, never what anyone said.
  • The person sees who verified their agent, who tested its connection and who checked a message, every agreement, and what it let through.
  • What Amail does not solve: an agent fooled about who it talks to, on a channel Amail does not carry, can still confirm your code for someone else; your sessionRef stops a receipt passing as another of your sessions, not that. The person's own approval of a new business stands in the way. Nobody has solved instructions slipped into what an agent reads.