sigelo Approval API
MONERO.md §4.1 step 8 — the second signature above `approval_above`.
MONERO.md §4.1 step 8 — the second signature above `approval_above`.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/sigelo-io:sigelo-io-approval-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: sigelo-spend keeper Approval API
version: 0.1.19
summary: The bounded-spending keeper (MONERO.md §4) — loopback HTTP, one agent per bearer token.
license:
name: MIT
identifier: MIT
description: 'A non-LLM service over one `monero-wallet-rpc`. Each agent is one Monero **account** with its
own bearer token, caps, allowlist and derived sigelo identity. The request never names an
account: the token decides it. Loopback only (127.0.0.1); experimental: stagenet by default, mainnet
with small amounts; no outside review yet.
**Errors.** Every error response is `{error, code, …}` (`#/components/schemas/Error`):
`error` names the failing check in prose, `code` is that check as a token (the reason''s
prefix, see `Error.code`), and a cap refusal adds `facts`. Some answers carry more fields
beside those (a replay''s `txid`, a revoke''s `revoked`, /health''s `service`); they are listed
per response. An unexpected exception on any route is `500 {error: "service: …", code: internal}`.
**Status codes.** 200 · 202 approval needed · 400 malformed request (`request`, or `body`
for a broken stream) · 401 missing, unknown or revoked token (`token`; every route but
`/approve`, which takes no token) · 403 refused by policy · 404 unknown route or foreign
`?agent=` · 408 body too slow (10 s, `body`) · 409 `ref` reused for a different payment
(`repeat`) · 413 body over 1 MB (`body`) · 500 the log could not be written (`log`) or an
unexpected exception (`internal`) · 502 the wallet refused, failed or answered malformed
(`wallet`, `wallet_locked`, `wallet_funds`, `wallet_offline`, `wallet_slow`) — and, on `/pay` and `/fund`, UNCERTAIN (`code:
relay_failed`: the money may have moved; never retry) · 503 the keeper''s clock is behind the
newest line it signed, or before its build''s floor (`clock_behind`, every route that signs:
nothing was signed, logged or sent; try later), or (`busy`, with `Retry-After: 1`) more
than 64 requests already wait in the one-at-a-time lane (`/pay`, `/delegate`, `/fund`,
`/revoke`, `/approve`; at most 4 of them `/approve`): nothing was done, try again in seconds.
**Who may call (every route, before any token or body).** The `Host` header must be
`127.0.0.1`, `localhost` or `[::1]`, with this keeper''s port if a port is given; any `Origin`
header (`null` included) is refused: both **403, `code: origin`** — browsers send `Origin` on
every POST and a DNS-rebound page sends its own `Host`; no keeper client sends either. A POST
must be `Content-Type: application/json` (else **415**, `code: request`): a web page can post
`text/plain` to 127.0.0.1 without a CORS preflight, never JSON. On the lane routes but
`/approve` the token is checked before the body is read or the request waits, so a
token-less post never delays a real one; it is checked again when the request''s turn comes.
**Free and paid (`licence_required`).** A keeper without a valid licence (apps/keeper/README.md
"Install") is the free tier: one keeper, one agent, that agent''s whole policy. The paid
verbs refuse with **403, `code: licence_required`** — a refusal like every other check, not
402 — and the message names the feature and why the licence is not valid, then says that
nothing was signed, logged or sent: `POST /delegate`, `POST /fund`, `POST /approve`, and a
`/pay` that would need an approval (above `approval_above`; refused, never paid without
one). `POST /revoke`, `GET /delegates` and every other route are never gated. The licence
is a sigelo attestation, verified offline at start, on a policy reload and before each paid
verb; an expired one makes the paid verbs refuse from that second and changes nothing else.'
servers:
- url: http://127.0.0.1:38090
description: The default port (`sigelo-spend serve --port`). Loopback only; never exposed.
security:
- bearer: []
tags:
- name: Approval
description: MONERO.md §4.1 step 8 — the second signature above `approval_above`.
paths:
/approve:
post:
tags:
- Approval
operationId: approve
summary: An approver's signature over a pending spend-approval request
description: 'No bearer token: the approver''s signature, its bundle (verified offline, its CURRENT DID
in the policy''s `approvers`) and the pending line''s nonce are the authorisation. Pays
nothing; the agent''s next run of the same pay does, once.'
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- body
- sig
- bundle
additionalProperties: false
properties:
body:
$ref: '#/components/schemas/SpendApproval'
sig:
$ref: ../../schema/common.json#/$defs/signature
description: The approver's current identity key over "sigelo\n" ‖ JCS(body).
bundle:
$ref: ../../schema/bundle.json
description: The approver's own bundle.
responses:
'200':
description: Approved; a keeper-signed `approved` line was written.
content:
application/json:
schema:
type: object
required:
- status
- ref
- agent
- approver
- nonce
- exp
- next
properties:
status:
const: approved
ref:
type: string
agent:
type: string
description: The requesting agent's name.
approver:
$ref: ../../schema/common.json#/$defs/did
nonce:
type: string
exp:
$ref: ../../schema/common.json#/$defs/unixSeconds
next:
type: string
'400':
description: 'The body is not strict JSON (`code: request`) or its stream broke (`code: body`).'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Refused; `code` is `approval` and `error` names the check (shape, keeper/net, time, approver bundle, signature, pending request, self-approval, single use) — or `licence_required` on a keeper without a valid licence (approvals are paid), checked first.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'408':
$ref: '#/components/responses/BodyTimeout'
'413':
$ref: '#/components/responses/BodyTooLarge'
'500':
$ref: '#/components/responses/LogFailed'
'503':
$ref: '#/components/responses/ClockBehind'
/refuse:
post:
tags:
- Approval
operationId: refuse
summary: An approver's no to a pending spend-approval request
description: 'The same body as /approve with `typ: spend-refusal`, signed the same way, and every check of
/approve. Writes a keeper-signed `refused` line; until the request''s `exp` the agent''s same pay
is `403 refused` with the reason. Free on every tier.'
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- body
- sig
- bundle
additionalProperties: false
properties:
body:
$ref: '#/components/schemas/SpendRefusal'
sig:
$ref: ../../schema/common.json#/$defs/signature
description: The approver's current identity key over "sigelo\n" ‖ JCS(body).
bundle:
$ref: ../../schema/bundle.json
description: The approver's own bundle.
reason:
type: string
maxLength: 200
description: What the agent is told. Not signed.
responses:
'200':
description: Refused; a keeper-signed `refused` line was written.
content:
application/json:
schema:
type: object
required:
- status
- ref
- agent
- approver
- nonce
- exp
- reason
properties:
status:
const: refused
ref:
type: string
agent:
type: string
approver:
$ref: ../../schema/common.json#/$defs/did
nonce:
type: string
exp:
$ref: ../../schema/common.json#/$defs/unixSeconds
reason:
type: string
'400':
description: 'The body is not strict JSON (`code: request`) or its stream broke (`code: body`).'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Refused; `code` is `approval` and `error` names the check, as for /approve.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'408':
$ref: '#/components/responses/BodyTimeout'
'413':
$ref: '#/components/responses/BodyTooLarge'
'500':
$ref: '#/components/responses/LogFailed'
'503':
$ref: '#/components/responses/ClockBehind'
components:
schemas:
Error:
type: object
required:
- error
- code
properties:
error:
type: string
description: The failing check in prose. Safe to show; never parse it — use `code`.
code:
type: string
description: 'The check that refused: the reason''s prefix before `:` (apps/keeper/service.ts `codeOf`),
except an allowlist refusal that is really a spent or expired invoice (`invoice`) and
the wallet''s two kinds of "not enough" (`wallet_locked`, `wallet_funds`) and a wallet
with no connection to its daemon (`wallet_offline`), and a build that ran out the
keeper''s build wait (`wallet_slow`). Values the
code produces: token, bucket, request, purpose, ref, to, to.addr, to.did, allowlist,
invoice, amount, per_tx_max, per_period_max, rate_per_minute, repeat, approval,
relay_failed, wallet, wallet_locked, wallet_funds, wallet_offline, wallet_slow, log, body, route, bind, delegate,
fund, revoke, dry_run, paused (403: the Owner paused this agent), owner (403: a refused
POST /policy or /agents), licence_required (403: a paid verb on a keeper without a valid
licence), clock_behind (503), busy (503: the lane is full), origin (403: a foreign
Host or an Origin header), internal (the catch-all 500), service (a
reason with no prefix). Not closed: new checks add values.
'
examples:
- allowlist
- per_period_max
- wallet_locked
- licence_required
facts:
$ref: '#/components/schemas/Facts'
Atomic:
type: string
pattern: ^(0|[1-9][0-9]*)$
description: Atomic units as a decimal string (1 XMR = 10^12). Never a JSON number.
SpendApproval:
type: object
description: The keeper-local spend-approval body (apps/keeper/approval.ts; not a SPEC object, no bundle slot accepts it). The approver signs exactly the body the 202 handed out.
required:
- v
- typ
- keeper
- net
- agent
- ref
- to
- amount
- purpose
- nonce
- iat
- exp
additionalProperties: false
properties:
v:
const: sigelo/0
typ:
const: spend-approval
keeper:
$ref: ../../schema/common.json#/$defs/did
net:
$ref: '#/components/schemas/Net'
agent:
$ref: ../../schema/common.json#/$defs/did
ref:
type: string
minLength: 1
to:
type: string
description: The resolved destination address.
amount:
$ref: '#/components/schemas/Atomic'
purpose:
type: string
minLength: 1
nonce:
type: string
pattern: ^[0-9a-f]{32}$
iat:
$ref: ../../schema/common.json#/$defs/unixSeconds
exp:
$ref: ../../schema/common.json#/$defs/unixSeconds
Facts:
type: object
description: The numbers behind a cap refusal (per_tx_max, per_period_max), so a client can say it without parsing `error`.
required:
- cost
- limit
- fee_included
properties:
cost:
$ref: '#/components/schemas/Atomic'
limit:
$ref: '#/components/schemas/Atomic'
fee_included:
type: boolean
description: true when the check ran on amount + fee (after the wallet priced it).
left:
$ref: '#/components/schemas/Atomic'
until:
$ref: ../../schema/common.json#/$defs/unixSeconds
description: When the oldest debit in the window rolls out.
amount:
$ref: '#/components/schemas/Atomic'
description: After pricing only. The payment alone; at most `limit` on a per_tx_max refusal means the fee pushed it over.
fee:
$ref: '#/components/schemas/Atomic'
description: After pricing only. The fee the wallet priced.
inputs:
type: integer
minimum: 1
description: After pricing
when wallet-rpc's reply lists spent_key_images. The inputs the transaction spends.: null
Net:
enum:
- mainnet
- stagenet
- testnet
SpendRefusal:
type: object
description: The spend-approval body with `typ` spend-refusal (approval.ts `checkRefusal`), so a refusal never passes for an approval.
required:
- v
- typ
- keeper
- net
- agent
- ref
- to
- amount
- purpose
- nonce
- iat
- exp
additionalProperties: false
properties:
v:
const: sigelo/0
typ:
const: spend-refusal
keeper:
$ref: ../../schema/common.json#/$defs/did
net:
$ref: '#/components/schemas/Net'
agent:
$ref: ../../schema/common.json#/$defs/did
ref:
type: string
minLength: 1
to:
type: string
amount:
$ref: '#/components/schemas/Atomic'
purpose:
type: string
minLength: 1
nonce:
type: string
pattern: ^[0-9a-f]{32}$
iat:
$ref: ../../schema/common.json#/$defs/unixSeconds
exp:
$ref: ../../schema/common.json#/$defs/unixSeconds
responses:
ClockBehind:
description: 'The keeper''s clock reads more than 300 s behind the newest `ts` it signed in spend.log, or
before the build''s floor (`code: clock_behind`, MONERO.md §4.1 "Clock"). Nothing was signed,
logged or sent; the same request succeeds once the host clock is set (NTP).
'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BodyTimeout:
description: 'The body did not arrive in full within 10 s (`code: body`); the connection is closed.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BodyTooLarge:
description: 'The body is over 1 MB (`code: body`); the connection is closed.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
LogFailed:
description: 'spend.log could not be written (`code: log`); the message says what did not happen.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
securitySchemes:
bearer:
type: http
scheme: bearer
description: 'The agent''s token (64 hex characters from `sigelo-spend token new` or `/delegate`),
sent as `Authorization: Bearer <token>` — the prefix `Bearer ` exactly, case-sensitive.
The keeper stores only its SHA-256. A missing, unknown and revoked token get the same
answer on every route: 401, `code: token`.
'