API ReferenceBuyer agent

Ask the buyer agent to buy something

POST
/console/api/buy

The agent proposes a product from the catalog; the mandate check (budget, per item cap, store, category) decides. An allowed purchase writes a signed mandate receipt linked to the order id.

Authorization

consoleSession csrfToken
clearwake_console<token>

Set by GET /console/api/session. HttpOnly, SameSite=Strict, 8 hours.

In: cookie

X-Clearwake-CSRF<token>

The csrf value from GET /console/api/session, an HMAC of the session id. Required on every POST.

In: header

Request Body

application/json

What the owner asked the buyer agent to buy.

The body of buy: what the owner asked the buyer agent for.

request*string

What the owner asked the buyer agent for, in plain printable characters.

Match^[\x20-\x7e]+$
Length1 <= length <= 200

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/console/api/buy" \  -H "Content-Type: application/json" \  -d '{    "request": "a pack of three A5 notebooks"  }'
{  "at": "2026-11-11T05:13:51Z",  "request": "a pack of three A5 notebooks",  "model": "scripted, not AI",  "proposed": "notebook-a5",  "note": "",  "allowed": true,  "reason": "Inside the mandate.",  "checks": {    "merchant allowed": true,    "category allowed": true,    "currency matches": true,    "under per item cap": true,    "inside remaining budget": true  },  "product": {    "id": "notebook-a5",    "name": "A5 dot grid notebook",    "category": "stationery",    "price_minor": 900  },  "price_minor": 900,  "spent_before_minor": 1800,  "label": "local run data"}