# RevRule API — payload-rail.fly.dev RevRule by Payload: a programmable revenue rules engine. Define a Revenue Graph, send economic events, get auditable entitlements. Your payment rail moves the money. RevRule determines the economics. RevRule never holds funds or moves money. Base URL: https://payload-rail.fly.dev OpenAPI: https://payload-rail.fly.dev/openapi.json x402 manifest: https://payload-rail.fly.dev/.well-known/x402 Console: https://payload-rail.fly.dev/revrule-console/ Docs: https://payloadhq.github.io/revrule-api.html ## Quickstart (3 calls) 1. POST /v1/access-keys {"label":"..."} -> {"key":"...","accountId":"..."} (free, 5/IP/24h) 2. POST /v1/graphs (Bearer key) {id, participants[], rules[]} -> 201 3. POST /v1/graphs/{id}/events (Bearer key) {event:{eventId,graphId,amountMicros,currency,occurredAt}} -> entitlements[] ## Key endpoints - GET /health -> {"ok":true} - POST /v1/graphs/{id}/activate — activate a draft graph - POST /v1/graphs/{id}/simulate — dry run, no side effects - GET /v1/graphs/{id}/ledger — hash-chained ledger entries - GET /v1/x402/public/evaluate — x402 v2 402 challenge: pay $0.01 USDC on Base, no API key - POST /v1/x402/public/evaluate — {event, txHash} after paying - GET /v1/crypto/config — machine-readable payment config (network, asset, prices) - POST /v1/purchases/orders — create a wallet-bound purchase order (returns message_to_sign) - POST /v1/purchases/redeem — redeem { order_id, tx_hash, signature } -> entitlement + API key - POST /v1/crypto/purchase — DEPRECATED (bare txHash, front-runnable); use /v1/purchases/* instead ## Rules Rule types: percentage, fixed, remainder, referral, recoupment, waterfall, caps. Amounts in micro-units (1,000,000 = 1.00). Events idempotent on eventId. Errors: {"error":{"code":"...","message":"..."}}.