Documentation
Builders

API builder guide

Ship a paid endpoint, verify settlement, and keep reconciliation clean.

10-minute quickstart

From zero to first settled paid call.

1) Deploy

Create a deployment in /app/deploy and keep the generated slug.

2) Verify discovery

Check /u/:slug/.well-known/chest.json for network, price, and payTo metadata.

3) Validate paid call

Send a paid request and confirm settlement appears in transactions.

Integration recipes

Copy-paste examples for common build/test workflows.

Challenge + payment retry

curl -i "https://api.chest.sh/u/<slug>/v1/resource"
# expect 402

curl -i "https://api.chest.sh/u/<slug>/v1/resource" \
  -H "X-Payment: <base64-payload>"
# expect 2xx + X-Payment-Response

Discovery endpoint sanity check

curl "https://api.chest.sh/u/<slug>/.well-known/chest.json"
# confirm network, price, payTo, splitConfig

Trust and accounting

Use these checks before month-end reconciliation.

Split math reference

For 1.00 USDC with default split: merchant 0.885, referrer 0.10, protocol 0.015.

Reconciliation checklist

  • Export settled calls by date window.
  • Cross-check distributeTx on chain explorer.
  • Track and clear distribute_failed rows separately.

Builder best practices

  • Keep API key and webhook secrets in server-side env vars only.
  • Treat attributed events as provisional; settled events are the accounting source.
  • Alert on distribute_failed and retry quickly to avoid backlog drift.