Seal

Documentation

Payment approval quick start

Last updated November 2026

For a developer whose agent pays supplier invoices. By the end, a payment from your agent clears only with a person's signed approval of that one invoice.

What you get

A payment clears only when a person you named has signed an approval that fixes the exact payee, payee account, amount and currency. Anything else is refused: a changed bank account, an amount one cent higher, an approval used a second time, or an approval the agent signed for itself. Every decision, refusals included, comes back as a signed ACTION-v1 record that anyone can check offline against Seal's published key.

Make an approver key

Each approver needs an Ed25519 key pair. Run one of these on the approver's own machine. It writes the private key to approver-key.pem, readable only by its owner, and prints the public key in strict base64url (43 characters, no padding).

Python (pip install cryptography):

python
import base64, os
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey

key = Ed25519PrivateKey.generate()
pem = key.private_bytes(
    serialization.Encoding.PEM, serialization.PrivateFormat.PKCS8, serialization.NoEncryption()
)
fd = os.open("approver-key.pem", os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)  # never overwrites
with os.fdopen(fd, "wb") as f:
    f.write(pem)

public = key.public_key().public_bytes_raw()
print(base64.urlsafe_b64encode(public).decode().rstrip("="))

Node 18 or later, no packages (save as make-approver-key.mjs):

js
import { generateKeyPairSync } from 'node:crypto'
import { writeFileSync } from 'node:fs'

const { privateKey, publicKey } = generateKeyPairSync('ed25519')
writeFileSync('approver-key.pem', privateKey.export({ type: 'pkcs8', format: 'pem' }), {
  mode: 0o600,
  flag: 'wx', // never overwrites
})
console.log(publicKey.export({ format: 'jwk' }).x) // JWK x is already base64url without padding

Both write the same PKCS#8 format, so a key made with one signs with the other.

Where the private key lives: with the approver, never with the agent. Not in the agent's environment, its container, its prompt or its tools. If the agent can read the key, it can approve its own payments and the check means nothing. For a first test a file on the approver's laptop is fine; for real payments, keep it in your key management system or a hardware key and sign there. Seal never needs the private key, only the public one.

Create the policy

In the console, open Settings, then Policies, and choose Use template on Payment approval. Paste the approver's public key (one per approver; any one of them can sign), keep the tool pattern payments.*, and keep all four fields ticked. It saves one policy, as a draft, with two rules:

json
[
  { "type": "require_grant", "value": "payments.*:<approver public key>" },
  { "type": "require_match", "value": "payments.*:payee,payee_account,amount_cents,currency" }
]

require_grant checks who signed the approval. require_match checks that the approval fixes those four values and that the agent's call carries exactly the same strings. A draft enforces nothing: set the policy to active in the policy list. From then on, every tool whose name starts with payments. needs both.

Sign an approval

An approval is a GRANT-v1 record. The approver signs one per invoice. This one fixes the payee, account, amount and currency, can be used once, and expires in 15 minutes. The output, grant.json, contains no secret: hand it to the agent with the invoice.

Set SEAL_ORG_ID to your organisation id first. It is the org_id in any record Seal returns to your API key, for example the refusal you get from calling a payments. tool without an approval.

Python:

python
import base64, json, os, uuid
from datetime import datetime, timedelta, timezone
from cryptography.hazmat.primitives import serialization

invoice = {
    "payee": "HARBOUR-PRINT",
    "payee_account": "IE29AIBK93115212345678",
    "amount_cents": "480000",  # EUR 4,800.00 in minor units, always a string
    "currency": "EUR",
}

with open("approver-key.pem", "rb") as f:
    key = serialization.load_pem_private_key(f.read(), password=None)

b64url = lambda b: base64.urlsafe_b64encode(b).decode().rstrip("=")
canonical = lambda o: json.dumps(o, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode()

grant = {
    "v": "grant-1",
    "grant_id": str(uuid.uuid4()),
    "intent_ref": "invoice:HP-2026-0412",
    "org_id": os.environ["SEAL_ORG_ID"],
    "approver": "finance-lead",
    "signing_mode": "approver-signed",
    "scope_tool": "payments.pay_invoice",
    "scope_resource": "",
    "scope_environment": "",
    "max_uses": "1",
    "not_before": "",
    "not_after": (datetime.now(timezone.utc) + timedelta(minutes=15)).isoformat(timespec="seconds"),
    "require_args": [],
    "scope_args": sorted(f"{k}={v}" for k, v in invoice.items()),
    "public_key": b64url(key.public_key().public_bytes_raw()),
}
grant["signature"] = b64url(key.sign(canonical(grant)))

with open("grant.json", "w") as f:
    json.dump(grant, f, indent=2)

Node (save as sign-approval.mjs):

js
import { createPrivateKey, createPublicKey, randomUUID, sign } from 'node:crypto'
import { readFileSync, writeFileSync } from 'node:fs'

const orgId = process.env.SEAL_ORG_ID
if (!orgId) throw new Error('Set SEAL_ORG_ID to your organisation id')

const invoice = {
  payee: 'HARBOUR-PRINT',
  payee_account: 'IE29AIBK93115212345678',
  amount_cents: '480000', // EUR 4,800.00 in minor units, always a string
  currency: 'EUR',
}

const privateKey = createPrivateKey(readFileSync('approver-key.pem'))
const publicKey = createPublicKey(privateKey).export({ format: 'jwk' }).x

// Canonical JSON: keys sorted at every level, no spaces, UTF-8.
const sortKeys = (v) => Array.isArray(v) ? v.map(sortKeys)
  : v && typeof v === 'object' ? Object.fromEntries(Object.keys(v).sort().map((k) => [k, sortKeys(v[k])])) : v
const canonical = (o) => Buffer.from(JSON.stringify(sortKeys(o)), 'utf8')

const grant = {
  v: 'grant-1',
  grant_id: randomUUID(),
  intent_ref: 'invoice:HP-2026-0412',
  org_id: orgId,
  approver: 'finance-lead',
  signing_mode: 'approver-signed',
  scope_tool: 'payments.pay_invoice',
  scope_resource: '',
  scope_environment: '',
  max_uses: '1',
  not_before: '',
  not_after: new Date(Date.now() + 15 * 60e3).toISOString().replace(/\.\d+Z$/, 'Z'),
  require_args: [],
  scope_args: Object.entries(invoice).map(([k, v]) => `${k}=${v}`).sort(),
  public_key: publicKey,
}
grant.signature = sign(null, canonical(grant), privateKey).toString('base64url')

writeFileSync('grant.json', JSON.stringify(grant, null, 2))

What the fields do:

  • scope_args fixes the four values as sorted name=value strings. The agent's call must carry each one as exactly that string: no trimming, no case folding, and a JSON number never matches "480000".
  • max_uses: "1" makes the approval single use. Every field is a string, including this one.
  • intent_ref names the authorisation, here the invoice. Uses are counted against it rather than against the grant, so if the agent retries and the approver signs a fresh grant for the same invoice, the fresh one finds the use already spent. To pay the same invoice twice on purpose, use a different intent_ref.
  • not_after is RFC 3339 with an explicit offset. Keep it short.
  • approver is a label for the person, carried in the approval. Authority comes from public_key being one you put in the policy.
  • The signature covers every field. Seal refuses a grant with a field it does not recognise, a missing field, a numeric value or unsorted lists. To bind the approval to one agent key, add agent_key_id with the id GET /v1/api-keys lists for that key.

The agent's call

The agent sends the payment it intends to make, with the approval under args.aqta_grant, and pays only if the outcome is ALLOWED. Build the request (this uses jq):

bash
jq -n --slurpfile grant grant.json '{
  tool: "payments.pay_invoice",
  agent: "ap-agent/1.0",
  args: {
    payee: "HARBOUR-PRINT",
    payee_account: "IE29AIBK93115212345678",
    amount_cents: "480000",
    currency: "EUR",
    aqta_grant: $grant[0]
  }
}' > request.json

Then send it with the agent's API key:

bash
curl -sS -X POST https://api.aqta.ai/v1/actions/authorize \
  -H "Authorization: Bearer $SEAL_API_KEY" \
  -H "Content-Type: application/json" \
  --data @request.json -o response.json

A refusal is a result, not an HTTP error: both outcomes return 200 with a signed record. Treat anything other than "outcome": "ALLOWED" as do not pay.

Allowed (ids, hashes, keys and signatures shortened here):

json
{
  "outcome": "ALLOWED",
  "action_id": "2ecf042e-...",
  "record": {
    "v": "action-1",
    "action_id": "2ecf042e-...",
    "org_id": "<your org id>",
    "session_id": "",
    "intent_hash": "",
    "agent": "ap-agent/1.0",
    "tool": "payments.pay_invoice",
    "args_hash": "72838136...",
    "outcome": "ALLOWED",
    "policy_applied": ["policy_payment_approval"],
    "timestamp": "2026-11-15T22:43:54.218370+00:00",
    "public_key": "<Seal issuer key>",
    "signature": "7Yxg3LFQ..."
  },
  "verify": "npx aqta-verify-receipt <record.json> --profile action-1 --key <key from /v1/attestation/public-key>",
  "args_bound": {
    "payee": "HARBOUR-PRINT",
    "payee_account": "IE29AIBK93115212345678",
    "amount_cents": "480000",
    "currency": "EUR",
    "aqta_grant_id": "ecf04121-...",
    "aqta_grant_hash": "cc940932..."
  },
  "grant_use": { "use_index": 1, "max_uses": 1, "remaining": 0 },
  "use_record": { "v": "use-1", "action_id": "2ecf042e-...", "grant_id": "ecf04121-...", "use_index": "1", "max_uses": "1", "...": "..." }
}

args_bound is what args_hash commits to: your arguments, with the approval replaced by its id and content hash. use_record is a signed record of which use of the approval this payment spent.

The same approval, but the agent was told the supplier changed its bank details:

json
{
  "outcome": "BLOCKED",
  "action_id": "c29d6f55-...",
  "record": { "outcome": "BLOCKED", "policy_applied": ["policy_payment_approval"], "...": "..." },
  "reason": "Blocked by policy 'Payment approval': tool 'payments.pay_invoice' requires a grant from a designated approver and none authorises this action: action does not match the value this grant fixes for: payee_account",
  "required": { "kind": "grant", "reason": "action does not match the value this grant fixes for: payee_account", "...": "..." },
  "...": "..."
}

The reason names the field, never the value. The refusal does not use up the approval.

The approved payment sent a second time, or with a fresh approval for the same intent_ref:

json
{
  "outcome": "BLOCKED",
  "action_id": "1287b168-...",
  "record": { "outcome": "BLOCKED", "policy_applied": ["grant_consumption", "policy_payment_approval"], "...": "..." },
  "reason": "Blocked: the grant presented does not have a use left. grant already used 1 of 1 times.",
  "required": { "kind": "grant_exhausted", "grant_id": "ecf04121-...", "...": "..." },
  "...": "..."
}

Two concurrent calls with one single-use approval: exactly one clears.

Keep record, args_bound and use_record from each response with grant.json. Together they are the evidence for that payment.

Check a record offline

Anyone holding a record can check it without Seal, using the published verifier. Take the record out of the response, and fetch Seal's public key once from https://api.aqta.ai/v1/attestation/public-key (its public_key field):

bash
jq .record response.json > record.json
curl -sS https://api.aqta.ai/v1/attestation/public-key | jq -r .public_key > seal.pub

Then check it with either package. They are separate implementations and give the same verdict.

bash
npx aqta-verify-receipt record.json --profile action-1 --key "$(cat seal.pub)"
bash
pip install aqta-verify-receipt
aqta-verify-receipt record.json --profile action-1 --key "$(cat seal.pub)"

Exit code 0 means the record is intact and signed by that key; 1 means it is not. Add --json for machine-readable output. --key pins the key you fetched, so a record carrying some other key fails. Refusals check the same way as approvals.

To check the approval, its one use and the payment decision together, bundle them and use the chain profile. GRANT-v1 and USE-v1 are draft formats, so this profile may change.

bash
jq -n --slurpfile grant grant.json --slurpfile res response.json '{
  v: "chain-1",
  grants: $grant,
  uses: [$res[0].use_record],
  actions: [{ record: $res[0].record, args: $res[0].args_bound }]
}' > bundle.json
npx aqta-verify-receipt bundle.json --profile chain --key "$(cat seal.pub)" --approver-keys <approver public key>

Limits

  • The signatures prove the records were not changed after signing, and the chain check shows that a key you designated approved those exact values. They do not prove the supplier is genuine, that the account belongs to them, or that any money moved. Your payment system and your supplier checks still decide that.
  • On the default free plan an API key may make 5 requests a minute. The sixth within a minute gets 429, after which the key is refused with 403 for 60 seconds; five of those within ten minutes block it for 24 hours. Pace retries and never loop against the API. Paid plans have higher limits.
  • Approvers sign in their own code for now. Approval from a phone is coming; until then, run the signing step wherever the approver's key lives.