Agent Mandate API
Convert user intent into signed mandates and verify consequential agent actions against mandate, policy and approvals.
Quickstart
Three calls: ask for a key, claim it from your inbox, then use it. No account, no dashboard, no card.
1. Ask for a key
curl -X POST https://agentmandate-api.com/v1/keys \
-H 'content-type: application/json' \
-d '{"email":"you@example.com"}'
Answers 202 Accepted and emails a one-time claim token to that address. No key is returned by this call. Proving you control the mailbox is what stops anyone who can guess your address from minting a key on your account and spending your allowance. The token is good for 15 minutes; ask again if it lapses.
2. Claim it
curl -X POST https://agentmandate-api.com/v1/keys/claim \
-H 'content-type: application/json' \
-d '{"token":"PASTE_THE_TOKEN_FROM_THE_EMAIL"}'
This response carries the key, and it is shown once — only a peppered hash is stored, so it cannot be read back later; if you lose it, rotate. Free tier: 500 verified actions/month.
3. Call the API
curl -X POST https://agentmandate-api.com/v1/mandates \
-H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' \
-d '{"principal":"user_8814","agent":"agent_procurement_v3",
"expiresAt":"2026-12-31T23:59:59Z","currency":"USD",
"totalSpendCapMinor":500000,
"grants":[{"action":"payments.transfer","resources":["vendor.acme"],
"maxAmountMinor":100000,"approvalRequiredAboveMinor":25000}]}'
Or skip the terminal: every endpoint below has a Try it panel that sends the real request from this page. Start at the playground.
Authentication
Authorization: Bearer sp_live_…
x-api-key is also accepted. Keys are scoped to this API — a key issued for another
product returns invalid_api_key, identical to an unknown key, so the API will not
confirm a key is valid elsewhere. Never put a key in browser JavaScript; authenticated
endpoints deliberately do not support CORS.
Playground
Every endpoint below carries a Try it panel, prefilled with a working request. Edit it,
press Send, and read what this API actually answered — status, timing, requestId and body,
unedited. Requests go straight from your browser to https://agentmandate-api.com; nothing is proxied
through this page and no request is recorded here.
What happens to this key. It is a live credential, and it is treated as one. It is held
in this page's memory for as long as the tab is open and nowhere else — not
localStorage, not sessionStorage, not a cookie, not the URL, not a
query string. It is never logged, and never sent to the server that serves this page. The only
place it goes is the Authorization: Bearer header of requests you send to
https://agentmandate-api.com. Reloading or closing the tab discards it; Clear discards it now.
Copied curl commands carry $KEY, never the key itself. On a shared machine,
clear it when you are done.
What a call costs. Every panel says so above its Send button, taken from the same contract as the rest of this page. No key required is a public endpoint — no key, no quota, no charge. Free — no quota needs your key but reserves nothing. Billable runs against your real account and reserves the stated quota from your plan before it runs, exactly as it would from your own code. Quota: no fixed cost also runs against your real account, but the contract states no fixed amount: endpoints whose work scales with the payload reserve an amount derived from what you send, so try a small request first.
No key yet? Open the Try it panel on POST /v1/keys, put in your email and
press Send. That call answers 202 and emails you a claim token; paste the token
into the Try it panel on POST /v1/keys/claim and send that. The claim
response is the one that carries the key, and it comes back with a button that loads it
straight into this field.
Endpoints
/v1/keysRequest a free sandbox API key (sends a verification email)
Starts self-serve key issuance. A one-time claim token is emailed to the address you supply; POST it to /v1/keys/claim to receive the key. No key is returned here, and the response is the same whether or not that address already has an account — so this endpoint cannot be used to find out who has one. The email is verified because your account, your usage and your invoice are all keyed to it: issuing on an unverified address would let anyone mint a working key on your account and spend your allowance. Keep using the same address and a paid plan bought with it raises the keys you already hold rather than issuing new ones.
Try itPOST /v1/keysNo key required
Public endpoint. No API key, no quota, nothing billed.
Request body
| Field | Type | Notes | |
|---|---|---|---|
email | string | required | Where the claim token is sent. This becomes your account. Format: email. |
name | string | optional | Optional label for the key, e.g. "staging". Shown in GET /v1/keys. |
Example request
{
"email": "you@example.com",
"name": "staging"
}
curl
curl -X POST https://agentmandate-api.com/v1/keys \
-H 'content-type: application/json' \
-d '{"email":"you@example.com","name":"staging"}'
Response
| Field | Type | Notes |
|---|---|---|
status | "verification_sent" | |
email | string | Format: email. |
expiresAt | string | After this, request a new one. Format: date-time. |
next | string | The endpoint that turns the emailed token into a key. |
message | string | |
requestId | string |
/v1/keysList your API keys for this API
Every key on YOUR account for this API — label, non-secret prefix, status, when it was created, when it was last used, and what it has consumed this period. Authenticate with any active key on the account; the account is taken from that key, never from a parameter, so this can only ever return your own keys. Keys you hold for other APIs in the portfolio are not listed here. Secrets are not returned and cannot be: only a peppered hash is stored. Free, and consumes no quota.
Try itGET /v1/keysFree — no quota
Needs your API key. The contract gives this endpoint no quota cost and it takes no request body, so nothing is reserved and nothing is billed.
Using the API key from the playground key field — no key set yet. It is sent only in the Authorization: Bearer header, only to https://agentmandate-api.com.
Your browser will not send an Authorization header to this API from this page: authenticated endpoints do not enable cross-origin access, deliberately, so that a key can never be read out of a web app’s front-end. Press Show as curl and run the request from a terminal instead — your edits are carried into it.
curl
curl -X GET https://agentmandate-api.com/v1/keys \
-H "Authorization: Bearer $KEY"
Response
| Field | Type | Notes |
|---|---|---|
product | string | |
accountId | string | |
keys | object[] | |
requestId | string |
/v1/mandatesIssue a signed mandate
Signs a grant of authority to an agent and returns the mandate with a detached HMAC-SHA256 signature over its canonical bytes. The document is self-contained — store it wherever you like and present it on every verification. The signing key is per-account and never leaves the service, so a mandate signed for one account cannot verify under another.
Try itPOST /v1/mandatesQuota: no fixed cost
Runs against your real account. The contract gives this endpoint no fixed quota cost: nothing is reserved before it runs, and endpoints whose work scales with the payload reserve an amount derived from the body instead — so a large request here can cost more than one unit. Send a small one first.
Using the API key from the playground key field — no key set yet. It is sent only in the Authorization: Bearer header, only to https://agentmandate-api.com.
Your browser will not send an Authorization header to this API from this page: authenticated endpoints do not enable cross-origin access, deliberately, so that a key can never be read out of a web app’s front-end. Press Show as curl and run the request from a terminal instead — your edits are carried into it.
Request body
| Field | Type | Notes | |
|---|---|---|---|
principal | string | required | Who granted the authority — the user or org the agent acts for. |
agent | string | required | Who holds it. A verification for a different agent is denied. |
notBefore | string | optional | Defaults to now. Format: date-time. |
expiresAt | string | required | Required. A mandate without an end is not a mandate. Format: date-time. |
grants | object[] | required | At least 1. At most 100. |
totalSpendCapMinor | integer | optional | Ceiling across every action, integer minor units. Range 0…∞. |
currency | string | optional | ISO-4217. Required whenever any monetary cap is set. |
metadata | object | optional | Carried into the receipt, never interpreted. |
Example request
{
"principal": "user_8814",
"agent": "agent_procurement_v3",
"expiresAt": "2026-12-31T23:59:59Z",
"currency": "USD",
"totalSpendCapMinor": 500000,
"grants": [
{
"action": "payments.transfer",
"resources": [
"vendor.acme",
"vendor.globex"
],
"maxAmountMinor": 100000,
"approvalRequiredAboveMinor": 25000
},
{
"action": "invoices.*",
"maxCount": 50
}
]
}
curl
curl -X POST https://agentmandate-api.com/v1/mandates \
-H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' \
-d '{"principal":"user_8814","agent":"agent_procurement_v3","expiresAt":"2026-12-31T23:59:59Z","currency":"USD","totalSpendCapMinor":500000,"grants":[{"action":"payments.transfer","resources":["vendor.acme","vendor.globex"],"maxAmountMinor":100000,"approvalRequiredAboveMinor":25000},{"action":"invoices.*","maxCount":50}]}'
Response
| Field | Type | Notes |
|---|---|---|
mandate | object | |
signature | string | v1:<hex>. Detached — keep it with the mandate. |
/v1/verifyVerify proposed actions against a mandate
Deny-by-default: an action matching no grant is denied. Returns a receipt per action with the decision, the grant that decided it, every violation (not just the first) and a digest that pins the evaluation. Send one "action" or up to 500 in "actions" — billing is one unit per action verified.
Try itPOST /v1/verifyQuota: no fixed cost
Runs against your real account. The contract gives this endpoint no fixed quota cost: nothing is reserved before it runs, and endpoints whose work scales with the payload reserve an amount derived from the body instead — so a large request here can cost more than one unit. Send a small one first.
Using the API key from the playground key field — no key set yet. It is sent only in the Authorization: Bearer header, only to https://agentmandate-api.com.
Your browser will not send an Authorization header to this API from this page: authenticated endpoints do not enable cross-origin access, deliberately, so that a key can never be read out of a web app’s front-end. Press Show as curl and run the request from a terminal instead — your edits are carried into it.
Request body
| Field | Type | Notes | |
|---|---|---|---|
mandate | object | required | The object returned by POST /v1/mandates — claims plus signature. |
action | object | optional | |
actions | object[] | optional | At least 1. At most 500. |
Example request
{
"mandate": {
"mandate": {
"id": "mnd_…",
"principal": "user_8814",
"agent": "agent_procurement_v3",
"notBefore": "2026-08-31T00:00:00Z",
"expiresAt": "2026-12-31T23:59:59Z",
"currency": "USD",
"totalSpendCapMinor": 500000,
"grants": [
{
"action": "payments.transfer",
"resources": [
"vendor.acme",
"vendor.globex"
],
"maxAmountMinor": 100000,
"approvalRequiredAboveMinor": 25000
},
{
"action": "invoices.*",
"maxCount": 50
}
]
},
"signature": "v1:…"
},
"action": {
"agent": "agent_procurement_v3",
"action": "payments.transfer",
"resource": "vendor.acme",
"amountMinor": 30000,
"currency": "USD",
"priorSpendMinor": 120000
}
}
curl
curl -X POST https://agentmandate-api.com/v1/verify \
-H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' \
-d '{"mandate":{"mandate":{"id":"mnd_…","principal":"user_8814","agent":"agent_procurement_v3","notBefore":"2026-08-31T00:00:00Z","expiresAt":"2026-12-31T23:59:59Z","currency":"USD","totalSpendCapMinor":500000,"grants":[{"action":"payments.transfer","resources":["vendor.acme","vendor.globex"],"maxAmountMinor":100000,"approvalRequiredAboveMinor":25000},{"action":"invoices.*","maxCount":50}]},"signature":"v1:…"},"action":{"agent":"agent_procurement_v3","action":"payments.transfer","resource":"vendor.acme","amountMinor":30000,"currency":"USD","priorSpendMinor":120000}}'
Response
| Field | Type | Notes |
|---|---|---|
count | integer | |
receipts | object[] |
/v1/mandates/{id}/revokeRevoke a mandate
Adds the mandate to your account's revocation list. Idempotent — revoking twice is not an error. Verifications read a briefly cached copy of that list so they never block on the database, so a revocation takes effect within about ten seconds rather than instantly. That window is stated here rather than hidden.
Try itPOST /v1/mandates/{id}/revokeQuota: no fixed cost
Runs against your real account. The contract gives this endpoint no fixed quota cost: nothing is reserved before it runs, and endpoints whose work scales with the payload reserve an amount derived from the body instead — so a large request here can cost more than one unit. Send a small one first.
Using the API key from the playground key field — no key set yet. It is sent only in the Authorization: Bearer header, only to https://agentmandate-api.com.
Your browser will not send an Authorization header to this API from this page: authenticated endpoints do not enable cross-origin access, deliberately, so that a key can never be read out of a web app’s front-end. Press Show as curl and run the request from a terminal instead — your edits are carried into it.
Request body
| Field | Type | Notes | |
|---|---|---|---|
reason | string | optional |
Example request
{
"reason": "agent decommissioned"
}
curl
curl -X POST https://agentmandate-api.com/v1/mandates/{id}/revoke \
-H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' \
-d '{"reason":"agent decommissioned"}'
Response
| Field | Type | Notes |
|---|---|---|
mandateId | string | |
revoked | boolean | |
effectiveWithinSeconds | integer |
/v1/revocationsList the mandates you have revoked
Account-scoped. Useful for reconciling your own records against the list verifications actually consult.
Try itGET /v1/revocationsFree — no quota
Needs your API key. The contract gives this endpoint no quota cost and it takes no request body, so nothing is reserved and nothing is billed.
Using the API key from the playground key field — no key set yet. It is sent only in the Authorization: Bearer header, only to https://agentmandate-api.com.
Your browser will not send an Authorization header to this API from this page: authenticated endpoints do not enable cross-origin access, deliberately, so that a key can never be read out of a web app’s front-end. Press Show as curl and run the request from a terminal instead — your edits are carried into it.
curl
curl -X GET https://agentmandate-api.com/v1/revocations \
-H "Authorization: Bearer $KEY"
Response
| Field | Type | Notes |
|---|---|---|
count | integer | |
mandateIds | string[] |
/v1/demo/verifyPublic demo — issue and verify in one call, without a key
Signs the mandate you describe with a throwaway demo key, then verifies your actions against it. The real engine, capped at 10 actions. Nothing is stored, nothing is metered, and the demo signature is not usable on the authenticated endpoint.
Try itPOST /v1/demo/verifyNo key required
Public endpoint. No API key, no quota, nothing billed.
Request body
| Field | Type | Notes | |
|---|---|---|---|
mandate | object | required | |
action | object | optional | |
actions | object[] | optional | At most 10. |
Example request
{
"mandate": {
"principal": "user_8814",
"agent": "agent_procurement_v3",
"expiresAt": "2026-12-31T23:59:59Z",
"currency": "USD",
"totalSpendCapMinor": 500000,
"grants": [
{
"action": "payments.transfer",
"resources": [
"vendor.acme",
"vendor.globex"
],
"maxAmountMinor": 100000,
"approvalRequiredAboveMinor": 25000
},
{
"action": "invoices.*",
"maxCount": 50
}
]
},
"action": {
"action": "payments.transfer",
"resource": "vendor.acme",
"amountMinor": 30000,
"currency": "USD"
}
}
curl
curl -X POST https://agentmandate-api.com/v1/demo/verify \
-H 'content-type: application/json' \
-d '{"mandate":{"principal":"user_8814","agent":"agent_procurement_v3","expiresAt":"2026-12-31T23:59:59Z","currency":"USD","totalSpendCapMinor":500000,"grants":[{"action":"payments.transfer","resources":["vendor.acme","vendor.globex"],"maxAmountMinor":100000,"approvalRequiredAboveMinor":25000},{"action":"invoices.*","maxCount":50}]},"action":{"action":"payments.transfer","resource":"vendor.acme","amountMinor":30000,"currency":"USD"}}'
Response
/v1/violationsEvery violation code the engine can return
Branch on these rather than on the human-readable detail, which may change.
Try itGET /v1/violationsNo key required
Public endpoint. No API key, no quota, nothing billed.
curl
curl -X GET https://agentmandate-api.com/v1/violations
Response
/v1/checkoutStart a hosted Square checkout for a paid tier
Returns a Square-hosted payment URL for the requested tier. No API key is needed — a prospect has not got one yet. The email Square collects becomes the account, so a key issued later for the same address inherits the paid quota. Enterprise returns a contact route rather than a payment link.
Try itPOST /v1/checkoutNo key required
Public endpoint. No API key, no quota, nothing billed.
Request body
| Field | Type | Notes | |
|---|---|---|---|
tier | string | required | developer | growth | scale | enterprise |
Example request
{
"tier": "developer"
}
curl
curl -X POST https://agentmandate-api.com/v1/checkout \
-H 'content-type: application/json' \
-d '{"tier":"developer"}'
Response
| Field | Type | Notes |
|---|---|---|
checkoutUrl | string | Square-hosted payment page. Redirect the buyer here. Format: uri. |
tier | string | |
sku | string | |
requestId | string |
/v1/invoicesEvery invoice issued against this account, newest first (dashboard session required)
Returns the stored `api_plan_invoices` rows for this account and this API — the rows the billing run actually wrote, never a reconstruction. Each one reconciles against itself: the included allowance and base fee shown are the PRORATED figures applied to that window, `overageMinorRaw` is the uncapped overage and `overageMinorCapped` is what was charged, and `baseChargedMinor` says how much of the base fee this invoice collected — 0 when Square’s recurring subscription had already taken it. An account with no billing history yet gets an empty list and a `note` explaining why, never a fabricated row. AUTHENTICATION IS YOUR DASHBOARD SESSION, NOT AN API KEY. Send the `@sp/core` session cookie this API sets when you sign in, from the same origin. An API key is refused here on purpose: it is a data-plane credential that lives in CI and in third-party integrations, and it must never be able to change what you are billed, cancel your account, or read your payment history. Errors: 401 `unauthenticated` when there is no valid session, 403 `forbidden` when the request is cross-origin or its `x-csrf-token` header is missing or wrong.
Try itGET /v1/invoicesSign-in required
Needs a signed-in dashboard session, not an API key. Your account comes from the session cookie, so this cannot be called with a bearer token and cannot act on another account.
curl
curl -X GET https://agentmandate-api.com/v1/invoices
Response
| Field | Type | Notes |
|---|---|---|
product | string | |
count | integer | |
note | string | null | Present only when the list is empty: says why, in a sentence a customer can act on. |
invoices | object[] | |
requestId | string |
/v1/keys/{id}/revokeRevoke one of your API keys
Kills a key immediately: the very next request made with it is refused with 401 invalid_api_key. There is no propagation delay and no cache to wait out. You may revoke the key you are authenticating with — that is the correct move when it has leaked, though you will then need another key, or the email flow, to get back in; rotate does both in one call. A key belonging to another account, or to another API, answers 404 exactly as an unknown id does, so this cannot be used to probe for keys you do not own. Idempotent, and free.
Try itPOST /v1/keys/{id}/revokeFree — no quota
Needs your API key. The contract gives this endpoint no quota cost and it takes no request body, so nothing is reserved and nothing is billed.
Using the API key from the playground key field — no key set yet. It is sent only in the Authorization: Bearer header, only to https://agentmandate-api.com.
Your browser will not send an Authorization header to this API from this page: authenticated endpoints do not enable cross-origin access, deliberately, so that a key can never be read out of a web app’s front-end. Press Show as curl and run the request from a terminal instead — your edits are carried into it.
The contract declares no request schema for this endpoint, so there is nothing to prefill. See the description above for what it accepts.
curl
curl -X POST https://agentmandate-api.com/v1/keys/{id}/revoke \
-H "Authorization: Bearer $KEY"
Response
| Field | Type | Notes |
|---|---|---|
id | string | |
status | "revoked" | |
message | string | |
requestId | string |
/v1/keys/{id}/rotateReplace one of your API keys with a new secret
Issues a replacement key and revokes the old one. This is the answer to a leaked or lost key: the new secret is returned once, the old secret stops working immediately, and the label carries over unless you supply a new one. The replacement is issued at your account's current allowance — your paid plan if you have one — not at the old key's. Rotating does not count against the active-key limit, because it replaces rather than adds. Free, and it works while you are out of quota.
Try itPOST /v1/keys/{id}/rotateQuota: no fixed cost
Runs against your real account. The contract gives this endpoint no fixed quota cost: nothing is reserved before it runs, and endpoints whose work scales with the payload reserve an amount derived from the body instead — so a large request here can cost more than one unit. Send a small one first.
Using the API key from the playground key field — no key set yet. It is sent only in the Authorization: Bearer header, only to https://agentmandate-api.com.
Your browser will not send an Authorization header to this API from this page: authenticated endpoints do not enable cross-origin access, deliberately, so that a key can never be read out of a web app’s front-end. Press Show as curl and run the request from a terminal instead — your edits are carried into it.
Request body
| Field | Type | Notes | |
|---|---|---|---|
name | string | optional | Optional new label. Defaults to the old key's. |
Example request
{
"name": "production (rotated)"
}
curl
curl -X POST https://agentmandate-api.com/v1/keys/{id}/rotate \
-H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' \
-d '{"name":"production (rotated)"}'
Response
| Field | Type | Notes |
|---|---|---|
apiKey | string | The new secret. Shown once. |
keyId | string | |
replaced | string | The id of the key that was revoked. |
product | string | |
quotaPerPeriod | integer | null | |
plan | string | |
warning | string | |
requestId | string |
/v1/keys/claimExchange an emailed claim token for the API key
Spends the token emailed by POST /v1/keys and returns the key. The key is shown ONCE — only a peppered hash is stored, so it can never be read back; if you lose it, rotate. The key works only on this API, and the allowance it is issued with reflects your account: your paid plan when you have one, the free sandbox allowance when you do not.
Try itPOST /v1/keys/claimNo key required
Public endpoint. No API key, no quota, nothing billed.
Request body
| Field | Type | Notes | |
|---|---|---|---|
token | string | required | The claim token from the verification email. |
Example request
{
"token": "eyJ2IjoxLCJlIjoieW91QGV4YW1wbGUuY29tIn0.ZXhhbXBsZQ"
}
curl
curl -X POST https://agentmandate-api.com/v1/keys/claim \
-H 'content-type: application/json' \
-d '{"token":"eyJ2IjoxLCJlIjoieW91QGV4YW1wbGUuY29tIn0.ZXhhbXBsZQ"}'
Response
| Field | Type | Notes |
|---|---|---|
apiKey | string | Shown once and never again. Store it now. |
keyId | string | Use this with /v1/keys/{id}/revoke and /v1/keys/{id}/rotate. |
product | string | The key works only on this API. |
quotaPerPeriod | integer | null | |
plan | string | The tier this allowance came from, or "sandbox" on the free tier. |
warning | string | |
usage | string | |
requestId | string |
/v1/paymentsEvery payment attempted against this account and how it went (dashboard session required)
The money movements behind your invoices, newest first: what was charged, whether it succeeded, and the processor’s payment id when it did. A billing period that came to nothing produces NO row here — it was closed without asking the processor for anything, and listing it would show you a payment that never happened. A failed attempt does appear, with its reason, because that is why an account goes past due. AUTHENTICATION IS YOUR DASHBOARD SESSION, NOT AN API KEY. Send the `@sp/core` session cookie this API sets when you sign in, from the same origin. An API key is refused here on purpose: it is a data-plane credential that lives in CI and in third-party integrations, and it must never be able to change what you are billed, cancel your account, or read your payment history. Errors: 401 `unauthenticated` when there is no valid session, 403 `forbidden` when the request is cross-origin or its `x-csrf-token` header is missing or wrong.
Try itGET /v1/paymentsSign-in required
Needs a signed-in dashboard session, not an API key. Your account comes from the session cookie, so this cannot be called with a bearer token and cannot act on another account.
curl
curl -X GET https://agentmandate-api.com/v1/payments
Response
| Field | Type | Notes |
|---|---|---|
product | string | |
count | integer | |
note | string | null | |
payments | object[] | |
requestId | string |
/v1/subscriptionYour current plan, billing window and available changes (dashboard session required)
Reports the plan this account is on, the billing window it is in, any tier change already staged for the next invoice, and the full pricing ladder marked up so you can see which rungs are an upgrade and which a downgrade. `planChangesGoThrough` is the field to branch on: `self_serve` means POST /v1/subscription/plan can move you; `checkout` means Square’s own recurring subscription holds your price and the tier has to move with it. All money is in integer minor units (cents). AUTHENTICATION IS YOUR DASHBOARD SESSION, NOT AN API KEY. Send the `@sp/core` session cookie this API sets when you sign in, from the same origin. An API key is refused here on purpose: it is a data-plane credential that lives in CI and in third-party integrations, and it must never be able to change what you are billed, cancel your account, or read your payment history. Errors: 401 `unauthenticated` when there is no valid session, 403 `forbidden` when the request is cross-origin or its `x-csrf-token` header is missing or wrong.
Try itGET /v1/subscriptionSign-in required
Needs a signed-in dashboard session, not an API key. Your account comes from the session cookie, so this cannot be called with a bearer token and cannot act on another account.
curl
curl -X GET https://agentmandate-api.com/v1/subscription
Response
| Field | Type | Notes |
|---|---|---|
product | string | |
subscribed | boolean | False when this account has never had a paid plan on this API. |
status | "sandbox" | "active" | "past_due" | "canceled" | "sandbox" when there is no paid plan at all — the same vocabulary GET /v1/usage reports. |
plan | object | null | The tier in force right now. |
pendingPlan | object | null | A tier change already staged, applied when the current window is invoiced. |
planChangesGoThrough | "self_serve" | "checkout" | |
baseFeeOwner | "internal" | "provider" | Who collects the flat monthly fee: us, or Square’s own recurring subscription. |
cancellation | object | What cancelling would do, stated before you do it. |
tiers | object[] | The published ladder, each rung marked current / upgrade / downgrade. |
requestId | string |
/v1/subscription/cancelCancel this plan and end metered access (dashboard session required)
Cancels the plan and drops every API key on this account for this product to a ceiling of 0, so access ends at the moment you cancel rather than at some later date nothing would enforce. The open billing window is never invoiced, so on a plan we bill directly the charging stops at the same instant the access does. When Square’s own recurring subscription collects your flat monthly fee (`baseFeeOwner` is `provider`) this API cannot stop that charge, so the request is refused with 409 unless you send `acknowledgeProviderBilling: true` — that flag exists so nobody ends up with a ceiling of zero and a live monthly charge without having been told first. AUTHENTICATION IS YOUR DASHBOARD SESSION, NOT AN API KEY. Send the `@sp/core` session cookie this API sets when you sign in, from the same origin. An API key is refused here on purpose: it is a data-plane credential that lives in CI and in third-party integrations, and it must never be able to change what you are billed, cancel your account, or read your payment history. Errors: 401 `unauthenticated` when there is no valid session, 403 `forbidden` when the request is cross-origin or its `x-csrf-token` header is missing or wrong.
Try itPOST /v1/subscription/cancelSign-in required
Needs a signed-in dashboard session, not an API key. Your account comes from the session cookie, so this cannot be called with a bearer token and cannot act on another account.
Request body
| Field | Type | Notes | |
|---|---|---|---|
acknowledgeProviderBilling | boolean | optional | Required only when `baseFeeOwner` is `provider`: confirms you understand Square will keep charging the monthly fee until you stop it there. |
Example request
{
"acknowledgeProviderBilling": true
}
curl
curl -X POST https://agentmandate-api.com/v1/subscription/cancel \
-H 'content-type: application/json' \
-d '{"acknowledgeProviderBilling":true}'
Response
| Field | Type | Notes |
|---|---|---|
canceled | boolean | |
canceledAt | string | Format: date-time. |
entitlement | object | The ceiling now enforced. 0 — access has ended. |
money | object | Exactly what happens to the charges, per base-fee owner. |
requestId | string |
/v1/subscription/planUpgrade or downgrade to another plan (dashboard session required)
Moves this account to another rung of the published pricing ladder and re-derives the ceiling enforced against every API key on it, so an upgrade is usable immediately rather than at the next invoice. The change is STAGED, not overwritten: the current billing window is closed at this instant and priced against the tier that was actually in force for it, and the incoming tier opens the next window with the original billing anniversary preserved. A downgrade therefore never re-prices days you already consumed on the dearer plan. Refused with 409 when Square’s own recurring subscription holds your price (`baseFeeOwner` is `provider`) — read `planChangesGoThrough` from GET /v1/subscription first; that case changes tier and price together through checkout. AUTHENTICATION IS YOUR DASHBOARD SESSION, NOT AN API KEY. Send the `@sp/core` session cookie this API sets when you sign in, from the same origin. An API key is refused here on purpose: it is a data-plane credential that lives in CI and in third-party integrations, and it must never be able to change what you are billed, cancel your account, or read your payment history. Errors: 401 `unauthenticated` when there is no valid session, 403 `forbidden` when the request is cross-origin or its `x-csrf-token` header is missing or wrong.
Try itPOST /v1/subscription/planSign-in required
Needs a signed-in dashboard session, not an API key. Your account comes from the session cookie, so this cannot be called with a bearer token and cannot act on another account.
Request body
| Field | Type | Notes | |
|---|---|---|---|
planId | string | required | Tier id from GET /v1/subscription `tiers[].id`, e.g. "growth". |
Example request
{
"planId": "growth"
}
curl
curl -X POST https://agentmandate-api.com/v1/subscription/plan \
-H 'content-type: application/json' \
-d '{"planId":"growth"}'
Response
| Field | Type | Notes |
|---|---|---|
changed | boolean | |
direction | "upgrade" | "downgrade" | |
from | string | |
to | string | |
entitlement | object | The ceiling now enforced on this account’s keys, and when it took effect. |
billing | object | Which tier the closed window is priced against, and when the new one starts. |
requestId | string |
/v1/usageYour consumption and remaining allowance for this period
Reports what this API key has consumed in the current quota period, the ceiling being enforced against it, and when that ceiling resets. Free, and it consumes no quota, so it still answers once you are getting 429 quota_exceeded — which is the point: compare "used" against "ceiling" and read "period.resetsAt" to tell a period you have simply exhausted from a plan that is no longer active, which shows as a "status" of canceled and a ceiling of 0. "used" counts billing units (see "unit"), not HTTP requests: a single request can consume several. All money is in integer minor units (cents), never a decimal. The period reported here is the quota period — the calendar month in UTC, resetting at 00:00 UTC on the 1st. Your invoice window is anchored to the date you subscribed and is a different window; the amounts here are what this period’s usage has accrued so far, not a bill.
Try itGET /v1/usageFree — no quota
Needs your API key. The contract gives this endpoint no quota cost and it takes no request body, so nothing is reserved and nothing is billed.
Using the API key from the playground key field — no key set yet. It is sent only in the Authorization: Bearer header, only to https://agentmandate-api.com.
Your browser will not send an Authorization header to this API from this page: authenticated endpoints do not enable cross-origin access, deliberately, so that a key can never be read out of a web app’s front-end. Press Show as curl and run the request from a terminal instead — your edits are carried into it.
curl
curl -X GET https://agentmandate-api.com/v1/usage \
-H "Authorization: Bearer $KEY"
Response
| Field | Type | Notes |
|---|---|---|
product | string | The API this key is bound to. A key works only on one. |
tier | string | null | The plan tier you are billed on, e.g. "developer". Null on a free sandbox key with no paid plan. |
status | "sandbox" | "active" | "past_due" | "canceled" | State of your plan. "sandbox" means no paid plan; "canceled" explains a ceiling of 0. |
unit | string | The billing unit this API meters. "used", "included", "ceiling" and "remaining" are all counted in these, not in requests. |
period | object | The quota period: the calendar month in UTC. |
included | integer | Units your flat monthly fee already covers, before overage pricing applies. 0 without a paid plan. |
used | integer | Units consumed so far this period. |
ceiling | integer | null | The hard limit enforced against this key: requests are refused beyond it. Null means unlimited. |
remaining | integer | null | ceiling minus used, never below 0. Null when the ceiling is unlimited. |
overageSoFarMinor | integer | What this period’s usage beyond "included" has accrued, in minor units, before your spend cap is applied. 0 without a paid plan. |
spendCapMinor | integer | The most the overage part of one period can ever cost you, in minor units. Your flat base fee is separate and is never capped away. |
requestId | string | Quote this when reporting a problem. |
/Service index — endpoints, auth and error format
Try itGET /No key required
Public endpoint. No API key, no quota, nothing billed.
curl
curl -X GET https://agentmandate-api.com/
Response
/healthLiveness and deployed version
Try itGET /healthNo key required
Public endpoint. No API key, no quota, nothing billed.
curl
curl -X GET https://agentmandate-api.com/health
Response
Errors
Every failure returns the same shape. Branch on code — it is a stable enum.
message is for humans and may change.
{
"error": {
"code": "quota_exceeded",
"message": "Quota exceeded for this billing period.",
"requestId": "0f3c8b12-…"
}
}
| Code | HTTP | Meaning |
|---|---|---|
missing_api_key | 401 | No Authorization or x-api-key header |
invalid_api_key | 401 | Unknown, revoked, or issued for a different API |
quota_exceeded | 429 | Allowance used for this period |
rate_limited | 429 | Too many requests |
invalid_request | 400 | Validation failed — details.path names the exact field |
not_found | 404 | No such route or resource |
internal_error | 500 | Our fault, not yours |
requestId appears on every response — success or failure — and in the
x-request-id header. Quote it and we can find the exact request. The playground
shows it above each response.
SDKs
Single files, zero dependencies — no requests, no axios — so they drop
into any environment without a dependency negotiation.
Python
from agent_mandate import AgentMandate
client = AgentMandate() # reads AGENT_MANDATE_API_KEY
signed = client.issue_mandate(
principal="user_8814",
agent="agent_procurement_v3",
expires_at="2026-12-31T23:59:59Z",
currency="USD",
total_spend_cap_minor=500_000,
grants=[{
"action": "payments.transfer",
"resources": ["vendor.acme"],
"maxAmountMinor": 100_000,
"approvalRequiredAboveMinor": 25_000,
}],
)
res = client.verify(signed, {
"agent": "agent_procurement_v3",
"action": "payments.transfer",
"resource": "vendor.acme",
"amountMinor": 30_000,
"currency": "USD",
})
receipt = res["receipts"][0]
if receipt["decision"] == "allow":
do_transfer()
elif receipt["decision"] == "requires_approval":
queue_for_human(receipt)
else:
log_denied(receipt["violations"])
TypeScript
import { AgentMandate } from './agent-mandate.js'
const client = new AgentMandate() // reads AGENT_MANDATE_API_KEY
const signed = await client.issueMandate({
principal: 'user_8814',
agent: 'agent_procurement_v3',
expiresAt: '2026-12-31T23:59:59Z',
currency: 'USD',
totalSpendCapMinor: 500_000,
grants: [{
action: 'payments.transfer',
resources: ['vendor.acme'],
maxAmountMinor: 100_000,
approvalRequiredAboveMinor: 25_000,
}],
})
const { receipts } = await client.verify(signed, {
agent: 'agent_procurement_v3',
action: 'payments.transfer',
resource: 'vendor.acme',
amountMinor: 30_000,
currency: 'USD',
})
switch (receipts[0].decision) {
case 'allow': return doTransfer()
case 'requires_approval': return queueForHuman(receipts[0])
case 'deny': return logDenied(receipts[0].violations)
}
Download
| File | Size | Notes |
|---|---|---|
Python SDK agent_mandate.py | 14.4 kB | Single file, no dependencies — no requests, no httpx. Python 3.9+. |
TypeScript SDK agent_mandate.ts | 15.8 kB | Single file, no dependencies — no axios, no node-fetch. Node 18+, Deno, Bun and Workers. |
Postman collection postman_collection.json | 25.7 kB | Every endpoint, generated from the same contract as this page. Import it and set the key variable. |
These are the files from the repo, published here so they are reachable from the site rather than only from a checkout. They are regenerated with this page, so what you download is the version this reference describes.