Payment flow (x402)
Sentiment402 is a paid API. Instead of API keys, it uses the x402 HTTP micropayments pattern:
Request a paid endpoint (no payment header).
Receive a
402 Payment Requiredchallenge with payment requirements.Sign those requirements locally (your private key never leaves your machine).
Retry the same request with a payment signature header.
v2 vs v1 (important)
Both versions return identical JSON payloads, but differ in payment mechanics:
v2
/v2
Base (EVM) + Solana (SVM)
PAYMENT-SIGNATURE
PAYMENT-REQUIRED
v1 (legacy)
/v1
Base (EVM) only
X-PAYMENT
X-PAYMENT-REQUIRED
The challenge/response flow
Client Server
│ GET /v2/snapshot/global │
│──────────────────────────────────────────>│
│ 402 + PAYMENT-REQUIRED │
│<──────────────────────────────────────────│
│ (Sign locally with wallet) │
│ GET /v2/snapshot/global │
│ PAYMENT-SIGNATURE: <encodedSignature> │
│──────────────────────────────────────────>│
│ 200 + JSON │
│<──────────────────────────────────────────│What’s inside PAYMENT-REQUIRED
PAYMENT-REQUIREDThe server returns one or more accepts[] options. Each option corresponds to a network you can pay on (e.g., Base or Solana on v2). Your client selects one option, signs it, and returns the signature.
Notes:
The header is the source of truth. Some HTTP clients or proxies drop
402bodies; robust clients should be able to decodePAYMENT-REQUIRED.The price is denominated in USDC. Today, the base price is
$0.02(20,000 micro‑USDC).
Safety
Never send or log private keys.
Prefer v2 unless you have a legacy x402 v1 client.
Treat a “paid retry” as billable work: validate your URL and query params before automating high-frequency retries.
Last updated
