> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ironflow.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Pay per call with x402: Hyperliquid data for agents, no account

> AI agents can pay for single Ironflow API calls in USDC on Base with x402: from $0.001 a request and $0.01 a SQL query, no account or key, at free-key limits.

An agent that needs more than the free limits does not have to buy a plan first. It can pay for the one call it needs, in USDC on Base, using [x402](https://x402.org), the HTTP payment standard.

| | Price | What the call gets |
| - | - | - |
| Markets snapshot, order book (`/v1/markets/snapshot`, `/v1/book`) | \$0.001 | Every market's price, open interest, funding and volume; a live L2 book |
| Trades, candles, funding (`/v1/trades`, `/v1/candles`, `/v1/funding`) | \$0.002 | Free-key limits for that call: 14 days of history |
| Any other data request | \$0.005 | Free-key limits for that call |
| SQL query (`/v1/query`) | \$0.01 | Free-key SQL: the last 30 days, 10 s, 1,000 rows (100 rows for a query that reads `hl.liquidations`: a liquidation row counts 10 times). `hl.builder_fills` (builder fee data) is on Builder and Enterprise only, never per call |
| Every market's liquidation map (`/v1/liquidations/map/all`, or the map without `market`) | \$0.05 | The Builder feature for that one call: every perp's map from one snapshot |

No account, no key, no subscription. Calls inside your free limits stay free. A paid call is for personal use (Terms 15.2); more history, more rows and commercial use are on [Explorer and Builder](https://docs.ironflow.sh/concepts/plans-and-payment.md). One wallet can read 20 billion rows an hour on paid calls.

## How it works

When a request without a key hits a limit that one paid call lifts (the keyless daily credits, history older than 24 hours, a query window, SQL time), the API answers **402 Payment Required** instead of 403 or 429. A paid call has free-key limits, so with a key only the all-markets liquidation map (below Builder) answers 402; other limits of a key stay 403 or 429 and name the plan that lifts them. The response still carries the usual JSON error, plus x402's `PAYMENT-REQUIRED` header with the price and where to pay. An x402 client signs a USDC payment and retries the same request with a `PAYMENT-SIGNATURE` header; the API serves it at free-key limits and returns `PAYMENT-RESPONSE` with the transaction.

To pay from the first call, use the same paths under `/x402`: `https://api.ironflow.sh/x402/v1/liquidations` always asks for payment, then serves exactly what `/v1/liquidations` serves.

You are charged only for calls that succeed: a call that fails is not settled, and if a payment cannot be settled, no data is sent.

## With @x402/fetch

```typescript theme={null}
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
const fetchWithPayment = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }], // Base
});

// BTC liquidations from a week ago: older than keyless access reaches (24
// hours), so this call pays $0.005 and is served at free-key limits (14 days)
const res = await fetchWithPayment(
  "https://api.ironflow.sh/v1/liquidations?market=BTC&from=-7d&to=-6d&limit=100",
);
console.log(await res.json());
```

The wallet needs a little USDC on Base; the payment covers gas, so it needs no ETH. Coinbase's AgentKit, Cloudflare's agents SDK and other x402 clients work the same way.

## Listed in the x402 Bazaar

These are declared to Coinbase's x402 Bazaar (agentic.market), with descriptions, example inputs and output schemas, so an agent searching it can find and call them. The same list, with prices and schemas, is at [api.ironflow.sh/openapi.json](https://api.ironflow.sh/openapi.json) (OpenAPI 3.1 with `x-payment-info`), which x402 registries such as x402scan read. [api.ironflow.sh/.well-known/x402](https://api.ironflow.sh/.well-known/x402) lists the same resources in the x402 discovery format:

| Endpoint | Price | Use it for |
| - | - | - |
| `GET /x402/v1/liquidations` | \$0.005 | Liquidations by market, wallet or window |
| `GET /x402/v1/liquidations/summary` | \$0.005 | Long and short USD liquidated per window and market |
| `GET /x402/v1/analytics/liquidation-levels` | \$0.005 | Price levels where longs and shorts were liquidated |
| `GET /x402/v1/liquidations/map` | \$0.005 | Where open positions would be liquidated, by price |
| `GET /x402/v1/liquidations/map/all` | \$0.05 | The same for every market, in one call |
| `GET /x402/v1/trades` | \$0.002 | Every fill for a market or wallet |
| `GET /x402/v1/candles` | \$0.002 | OHLCV, 1m to 1w |
| `GET /x402/v1/funding` | \$0.002 | Funding rate history |
| `GET /x402/v1/markets/snapshot` | \$0.001 | Every market's price, open interest, funding and volume |
| `GET /x402/v1/book` | \$0.001 | Live L2 order book of a market |
| `GET /x402/v1/open-interest/changes` | \$0.005 | Open interest movers |
| `GET /x402/v1/analytics/user-state` | \$0.005 | A wallet's open positions |
| `GET /x402/v1/analytics/leaderboard-pnl` | \$0.005 | Top traders by realized PnL |
| `GET /x402/v1/predictions/summary` | \$0.005 | HIP-4 outcome market activity |
| `POST /x402/v1/query` | \$0.01 | SQL over every hl.\* table |

## What can be paid for

Every read endpoint under `/v1`, and SQL. Live streams, liquidation alerts, keys and billing need a [free key](https://ironflow.sh/key) instead, and the per-minute rate limit and the hourly read limit still answer 429 with `Retry-After`. For steady use a [plan](https://docs.ironflow.sh/concepts/plans-and-payment.md) is cheaper: Explorer at 49 USDC for 30 days costs what 10,000 to 25,000 paid calls would.

## Buy a plan with x402

An agent with a Base wallet can also buy a plan in one call, with no person and no Hyperliquid transfer. With an API key, the plan goes on the key's own account:

```bash theme={null}
curl -X POST https://api.ironflow.sh/v1/billing/buy \
  -H "Authorization: Bearer if_..." -H "Idempotency-Key: my-bot-1" \
  -H "Content-Type: application/json" -d '{"plan": "explorer"}'
```

It answers 402 with the plan's exact price (Explorer 49 USDC, Builder 199, Pro 499; the yearly plans explorer-12m 468, builder-12m 1,908, pro-12m 4,788). Pay it with any x402 client and send the same request again; the same `Idempotency-Key` never charges twice. Without a key, buy for an email:

```bash theme={null}
curl -X POST https://api.ironflow.sh/x402/v1/plans/explorer/buy \
  -H "Content-Type: application/json" -d '{"email": "you@example.com"}'
```

The first call answers 402 with the plan's price: Explorer 49 USDC, Builder 199 USDC or Pro 499 USDC. Pay it with any x402 client and send the same request again with `PAYMENT-SIGNATURE`. Once the payment settles, the email's account moves to the plan for 30 days: its keys move up, or a new key is emailed there if it has none. The response has a `status_url` that shows when the plan is live. A refused purchase (a bad email, or a wallet already paying for another email) is not charged.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.