Pay-per-use web API with x402
Pay for an HTTP operation when you need it. The server quotes the request through a payment challenge, and a compatible wallet client can authorize payment and retry.
Request a price challenge
curl -i https://api.oassis.dev/web/v1/scrape \
-H 'Content-Type: application/json' \
-d '{"url":"https://example.com","formats":["markdown"]}'Without payment, this product request returns HTTP 402. Read the payment requirements returned by the server; plain curl only displays the challenge.
Pay and retry
- Use an x402-compatible client with a wallet holding USDC on Base.
- Inspect the required network, asset, amount, destination and expiry.
- Authorize the payment within your application's spending limit.
- Retry with the payment proof in the format required by the server's x402 version.
- Inspect both the API result and payment confirmation.
Use the current x402 client documentation for signing and transport; a hard-coded payment header or an old challenge is not a reusable credential.
Count completed payments separately
A 402 is a quote, not a completed payment. A response error can require separate billing inspection. In your application, track attempts, confirmed charges and task results as distinct events.
Control spend
Set a maximum amount per request and per workflow. Multiple scrape outputs add together; crawl budgets and browser sessions have different cost models. Use the quote, rather than a price copied from an old example, as the final authority.
Continue with MCP integration, x402 payments or the OpenAPI reference.