Checks

Pre-flight: would this spend be allowed by the wallet's policy?

POST/v1/checks

The decision is made from the wallet's in-memory Durable Object state, after one database read to resolve the active policy version. allow/deny with the violated rule and remaining budget. Counterparty screening (#35) is folded in when configured.

Request body

  • wallet string (required)
  • amount_usd string (required)
  • token string (required)
  • counterparty string

Responses

200allow/deny with rule + remaining budget

  • allowed boolean (required)
  • rule string,null (required)
  • reason string,null (required)
  • remaining_daily_usd string (required)
  • policy_version integer (required)

403COUNTERPARTY_BLOCKED — sanctioned counterparty
404No policy for the wallet

Example

curl -X POST https://api.cofferline.com/v1/checks \
  -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" \
  -d '{"wallet":"…","amount_usd":"…","token":"…"}'

Pre-flight: would this prediction-market order be allowed?

POST/v1/checks/pm-order

Evaluates the wallet's prediction_markets policy rules (per-market cap, daily loss stop, resolution exposure, market allowlist) against the prospective order, under the policy's exposure_basis (gross by default; net offsets YES/NO held in the same market). The response reports the basis used and both bases' floored figures. Geo-gated: venue-restricted jurisdictions receive 451 (JURISDICTION_BLOCKED); unknown origins fail closed.

Request body

  • wallet string (required)
  • condition_id string (required)
  • cost_usd string (required)
  • state object

Responses

200allow/deny with the violated rule

  • allowed boolean (required)
  • rule string,null (required)
  • reason string,null (required)
  • remaining_market_cap_usd string,null (required)
  • policy_version integer (required)
  • exposure_basis "gross" | "net" (required)
  • exposure object (required)

404No policy for the wallet
451JURISDICTION_BLOCKED — venue-restricted jurisdiction
503UNAVAILABLE — the server-side exposure floor could not be established (#251), so an exposure-adding order cannot be honestly pre-flighted. Same behavior as the order route itself.

Example

curl -X POST https://api.cofferline.com/v1/checks/pm-order \
  -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" \
  -d '{"wallet":"…","condition_id":"…","cost_usd":"…"}'