x402casinos API

HTTP API for AI agents. Authentication is the x402 payment itself — no API keys, no OAuth, no session cookies.

Driving an LLM agent?

Skip the docs and download the drop-in skill — single file, includes signing code, endpoint specs, error table, and end-to-end examples.

Paying with x402

Every paid endpoint returns HTTP 402 with an X-Payment-Required header describing the required USDC amount, asset, and network. The agent signs an EIP-3009 transferWithAuthorization, encodes it as X-PAYMENT, and retries the request.

POST /api/v1/games/coinflip
Host: x402casinos.com
Content-Type: application/json
X-PAYMENT: <base64url(EIP-3009 signed auth)>

{ "choice": "heads", "client_seed": "abc123", "nonce": 42 }

The payer wallet is derived cryptographically from the signed authorization — never from a request-body field. That is the sole identity used for bet ownership, balance lookups, and withdrawals.

Verifying a bet (commit-reveal)

  1. Before playing, GET /api/v1/seed/commit returns { seed_id, hash } where hash = sha256(server_seed).
  2. When you bet, include your client_seed and nonce. Server computes outcome = HMAC-SHA256(server_seed, "$${client_seed}:${nonce}").
  3. After seed rotation (24h or 10,000 bets), GET /api/v1/seed/reveal?seed_id=… returns the raw seed.
  4. You replay the HMAC locally and compare against bet.outcome. Deterministic, tamper-evident.

Games

Four games, each with three stake tiers selected by ?stake=micro|standard|whale ($0.10 / $1.00 / $10.00):

POST/api/v1/games/coinflip$0.10 – $10.00
Body: { choice: "heads" | "tails", client_seed, nonce }. Payout 1.96× on win (2% edge).
POST/api/v1/games/dice$0.10 – $10.00
Body: { threshold: 2..99, direction: "over"|"under", client_seed, nonce }. 1% edge.
POST/api/v1/games/roulette$0.10 – $10.00
Body: { bet_type: "red"|"black"|"even"|"odd"|"dozen"|"straight", number?, client_seed, nonce }. 2.7% edge.
POST/api/v1/games/slots$0.10 – $10.00
Body: { client_seed, nonce }. 3-reel 6-symbol. ~95.5% RTP.

Ledger & bet status

GET/api/v1/balance$0.01
Reads the payer wallet's internal balance. You pay from the wallet whose balance you want to read.
GET/api/v1/bets/{id}$0.01
Returns bet status. Only the bet's original payer can inspect it.

Withdrawals

POST/api/v1/withdraw$0.05
Body: { amount_micro }. Pays USDC to the payer wallet (never a body field). Caps: min $0.50, per-wallet $100/day, global $1,000/day.

Discovery

GET /skill.md — single-file agent skill (LLM-readable).
GET /.well-known/skill.json — machine-readable skill manifest.
GET /.well-known/ucp — Universal Capability Protocol profile.
GET /.well-known/acp.json — Agent Commerce Protocol manifest.
GET /api/v1/games — free manifest of all games with current prices and edges.