# FurlPay — Complete Developer & Agent Markdown Reference

> Policy-Gated Stablecoin & AI Agent Financial Infrastructure.
> Fail-closed mandates, Cloud KMS transactionGuard signing boundaries, WebAuthn
> step-up approvals, and multi-chain programmable settlement.

## Discovery & Machine-Readable Specs

- Summary index: https://furlpay.com/llms.txt
- Full reference (this document): https://furlpay.com/llms-full.txt
- OpenAPI 3.1 JSON: https://furlpay.com/openapi.json
- Auto-generated Postman v2.1 Collection: https://furlpay.com/api/developer/postman
- Live operational rail registry: https://furlpay.com/api/rails
- Human system status board: https://furlpay.com/status

## 1. Stateful 5-Minute Sandbox Loop

Obtain a short-lived trial key (`fp_test_...`) scoped exclusively to `/api/sandbox/*`:

```bash
# 1. Mint a 24-hour sandbox key (no login needed)
curl -s -X POST https://furlpay.com/api/sandbox/keys \
  -H "Content-Type: application/json" \
  -H "FurlPay-Version: 2026-11" \
  -d '{"label":"agent-quickstart"}'

# 2. Create sandbox entity + simulate KYB approval
curl -s -X POST https://furlpay.com/api/sandbox/customers \
  -H "Authorization: Bearer fp_test_..." \
  -H "FurlPay-Version: 2026-11" \
  -d '{"type":"business","legalName":"Acme AI Corp","email":"ops@example.com","country":"US"}'

curl -s -X POST https://furlpay.com/api/sandbox/customers/ent_sbx_.../simulate-kyb \
  -H "Authorization: Bearer fp_test_..." \
  -d '{"outcome":"approved"}'

# 3. Lock a quote (forward sourceAmount OR reverse destinationAmount as decimal strings)
curl -s -X POST https://furlpay.com/api/sandbox/quotes \
  -H "Authorization: Bearer fp_test_..." \
  -d '{"sourceAmount":"250.00","sourceChain":"arbitrum","destinationChain":"base","platformFeeBps":25}'

# 4. Create settlement bound to quoteId with Idempotency-Key -> simulate deposit -> pull events
curl -s -X POST https://furlpay.com/api/sandbox/settlements \
  -H "Authorization: Bearer fp_test_..." \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"quoteId":"qut_sbx_...","customerId":"ent_sbx_...","destinationAddress":"0x1111111111111111111111111111111111111111"}'

curl -s -X POST https://furlpay.com/api/sandbox/settlements/ord_sbx_.../simulate-deposit \
  -H "Authorization: Bearer fp_test_..."

# 5. Simulate x402 / MPP mandate-checked settlement
curl -s -X POST https://furlpay.com/api/sandbox/x402/simulate-settlement \
  -H "Authorization: Bearer fp_test_..." \
  -d '{"resource":"/api/x402/market-data","amount":"0.25","maxPolicyAmount":"5.00","chain":"base","protocol":"x402"}'

# 6. Checkpointed PULL webhook event feed
curl -s "https://furlpay.com/api/sandbox/events?cursor=0&limit=25" \
  -H "Authorization: Bearer fp_test_..."
```

## 2. Canonical API Standards

- **Headers**: `FurlPay-Version: 2026-11` (or `X-Api-Version: 2026-11` / `2026-07-01`). Both are echoed on responses.
- **Auth**: `Authorization: Bearer <key>` or `X-Api-Key: <key>` for developer/API callers; WebAuthn step-up or signed Ed25519/RFC 9421 agent assertions for high-privilege approvals.
- **Money Types**: Always strict decimal strings (`"250.00"`, never IEEE-754 floats) and UTC ISO-8601 timestamps.
- **Prefixed Public IDs**: `ent_` entities, `wlt_` wallets, `mnd_` mandates, `qut_` quotes, `ord_` orders/settlements, `txn_` transactions, `evt_` events.
- **Idempotency**: Mutating `POST` settlement creation requires `Idempotency-Key` (24h retention; mismatched payload returns `422 ERR_IDEMPOTENCY_CONFLICT`).
- **Errors**: Standard JSON envelope with `error.type`, `error.code`, `error.message`, optional `error.details[]`, and `requestId` / `traceId`.
- **Webhooks (PUSH + PULL)**: Every surface signs the identical versioned `X-FurlPay-Signature: t=<unix>,v1=<hmac-sha256>,v2=<hmac-sha512>` over `${timestamp}.${rawBodyBytes}`; verify `v2` when present else `v1`, and never re-serialize parsed JSON before checking signatures. Recover missed events via cursor PULL (`GET /api/sandbox/events`).

## 3. Core Pillars & Three-Dimension Capability Honesty

FurlPay separates every product capability into three orthogonal dimensions (`/status`, `/api/rails`, and `/docs#availability`):
1. **Product Availability**: `Live`, `Sandbox-only`, `In development`, `Preview`, `Planned`, `Deprecated`, or `Temporarily unavailable`.
2. **Production Eligibility**: `Active` vs `Gated (External Signer / Credentials)` vs `Partner & License Required`.
3. **Operational Availability**: Live health signal measured dynamically via `/api/rails`.

Four integrated pillars:
1. **Programmable Stablecoin Payments**: Non-custodial calldata builders (live), merchant checkout/payroll/gasless patterns (sandbox/gated).
2. **Policy-Governed AI Agent Finance**: Scoped MCP server (`/api/mcp`, OAuth 2.1 + DPoP), signed AP2/TAP mandates, `@furlpay/x402-guard` (F1-F5), `x402` & `MPP` gateways, and `@furlpay/cli`.
3. **Verifiable Financial Execution**: Strict decimal strings (`bigint` micros), `Idempotency-Key` conflict checks (`422`), and versioned raw-byte webhooks (`v1` HMAC-SHA256 + `v2` HMAC-SHA512).
4. **Institutional Settlement & Treasury**: Separate Decision (`PaymentPhase`) and Execution (`SettlementLifecycleStatus`) state machines, maker-checker approvals, Cloud KMS `transactionGuard`, double-entry `@furlpay/ledger`, and Par 1:1 simulator.

## 4. Documentation Sections & SDK Parity

- Navigation Sections: `01. Get Started`, `02. Payments and Money Movement`, `03. AI Agents and Autonomous Finance`, `04. Treasury and Institutional Finance`, `05. API, SDK and CLI Reference`, `06. Security and Production Operations`, `07. Resources and Support`.
- Developer Workbench (`/developer`): Scenario Lab, Unified Transaction Explorer, Webhook Workbench, Agent Execution Monitor, and Pre-Flight Diagnostics.
- Official SDKs (`sdks/*`): `@furlpay/furlpay-node` (full `client.sandbox.*` + `verifyRawSignature512`), Python (`verify_raw_sha512` + stdlib HTTP), Go (`VerifyRawSHA512` + `net/http`), and Rust (pure-Rust SHA-256 HMAC + origin config).
