---
site: steel.dev
collection: docs
canonical_url: https://steel.dev/docs/integrations/x402
markdown_url: https://steel.dev/docs/integrations/x402.md
content_signal: ai-input=yes, ai-train=yes, search=yes
title: Pay for Steel with x402
description: Pay for Steel's Quick actions per request with USDC through the x402 payment protocol.
summary: Pay for Steel's Quick actions per request with USDC through the x402 payment protocol.
type: integration-guide
stage: beta
reviewed: 2026-11-12
prerequisites: []
related:
  - https://steel.dev/docs/integrations/stripe-projects.md
agent_setup: https://setup.steel.dev/install.md
docs_index: https://steel.dev/docs/sitemap.md
---

# Pay for Steel with x402

x402 lets you call Steel's Quick actions, [Scrape](https://steel.dev/docs/control/scrape), [Screenshot](https://steel.dev/docs/control/scrape#take-a-screenshot) and [PDF](https://steel.dev/docs/control/scrape#create-a-pdf), and pay for each request with USDC from a wallet. You need no Steel account and no API key. The [x402 protocol](https://www.x402.org/) uses the HTTP status `402 Payment Required` to ask for a payment, and an x402 client library pays it for you.

Steel serves x402 requests at `https://x402.steel.dev`. Each request costs $0.01 in USDC (`10000` base units), on the network that you pay from. There is no subscription and no charge for browser time. See [Pricing](https://steel.dev/docs/platform/pricing) for the other ways to pay.

## Before you begin

- A wallet on Base or Solana that holds USDC.
- For the program on this page, Node.js and a Base wallet's private key in the `PRIVATE_KEY` environment variable.

Steel accepts USDC on these networks:

| Network | USDC contract address |
| - | - |
| Base (mainnet) | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` |
| Solana (mainnet) | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` |

> **Warning**
>
> The private key controls the funds in the wallet. Read it from an environment variable or a secret store, and use a wallet that holds only what you plan to spend.

## Set up the integration

### Payment flow

An x402 client library does steps 2 and 3 of a paid request for you:

1. You send a request to an endpoint. Steel returns `402 Payment Required`, with the amount, networks and recipient.
2. Your wallet signs a payment authorization for that amount.
3. You send the request again with the signed payment in the `PAYMENT-SIGNATURE` header. Steel returns `200 OK` with the result.

To see the payment details, send a request without a payment:

```sh
curl -i -X POST https://x402.steel.dev/v1/scrape \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "format": ["markdown"]}'
```

The response has the status `402 Payment Required`. Its JSON body lists the payment options in `accepts`, one on Base and one on Solana, each for `10000` base units of USDC. The `PAYMENT-REQUIRED` header has the same details, encoded in base64.

### Pay for a request

This program pays for one scrape with x402 and prints the result.

```ts file=x402-scrape.mts
import { ExactEvmScheme } from "@x402/evm";
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

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

const response = await fetchWithPay("https://x402.steel.dev/v1/scrape", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://example.com", format: ["markdown"] }),
});

console.log(response.status);
console.log(await response.json());
```

It wraps `fetch` with `@x402/fetch`, so that it pays when Steel asks. Steel uses version 2 of the protocol. The older `x402-fetch` package is for version 1, and it cannot read Steel's response.

Install the libraries and run the program:

```sh
npm install @x402/fetch @x402/evm viem
npx tsx x402-scrape.mts
```

The program prints `200`, then the scrape result as JSON. Each run pays $0.01 in USDC from the wallet.

If the wallet does not hold enough USDC, the program prints `402` and a response with the error `invalid_exact_evm_insufficient_balance`.

### Endpoints and parameters

Every endpoint takes a `POST` with a JSON body and returns JSON.

| Endpoint | What it does |
| - | - |
| `POST /v1/scrape` | Loads a page and returns it as HTML, Markdown or readable text, with a screenshot or a PDF if you ask for one. |
| `POST /v1/screenshot` | Takes a screenshot of a page. |
| `POST /v1/pdf` | Renders a page as a PDF. |

| Parameter | Type | Endpoints | Description |
| - | - | - | - |
| `url` | `string` | All | The URL of the page to load. Required. |
| `format` | `string[]` | Scrape | The output formats: `html`, `readability`, `cleaned_html` or `markdown`. The default is `html`. |
| `screenshot` | `boolean` | Scrape | Adds a screenshot to the response. |
| `pdf` | `boolean` | Scrape | Adds a PDF to the response. |
| `fullPage` | `boolean` | Screenshot | Captures the full page, not only the visible part. |
| `delay` | `number` | All | The time to wait before the action, in milliseconds. |
| `useProxy` | `boolean` | All | Routes the request through a residential proxy from Steel. |

## Next steps

- [x402 protocol](https://www.x402.org/): How the protocol works, and its client libraries.
- [Quick actions API](https://steel.dev/docs/reference/api/quick-actions): The endpoints for callers with a Steel account.
