x402 API for AI agents
pay per call in USDC on Base
Pay-per-call data APIs for AI agents using the x402 protocol. YouTube transcript API (USD 0.005), Airbnb listing scraper API (USD 0.02) and Airbnb search API (USD 0.05), paid per request in USDC on Base. No API key, no account, HTTP 402 flow.
Endpoints and prices
Airbnb listing details
GET /api/airbnb/listingScrape one public Airbnb room page into structured JSON: title, description, location, coordinates, rating, reviews, host, amenities, bedrooms/beds/baths, guests and photos. No browser, no login. Input: airbnb.com/rooms/<id> URL.
url * | Airbnb listing URL, e.g. https://www.airbnb.com/rooms/577971748947083358 (any airbnb.* domain; the numeric id is extracted) |
currency | ISO 4217 currency used to render the page (reserved for price fields). Default: USD. |
curl -s "https://agent-data-api.netlify.app/api/airbnb/listing?url=https%3A%2F%2Fwww.airbnb.com%2Frooms%2F577971748947083358¤cy=USD"
Airbnb listing preview (free)
GET /api/airbnb/previewFree x402 resource (price 0): a compact preview of one public Airbnb room page as JSON: title, location, rating, review count, property type and photo count. Same parser as the paid /api/airbnb/listing endpoint, which returns the full record (description, host, amenities, rooms, coordinates, photos) for USD 0.02. Input: airbnb.com/rooms/<id> URL.
url * | Airbnb listing URL, e.g. https://www.airbnb.com/rooms/577971748947083358 (any airbnb.* domain; the numeric id is extracted) |
curl -s "https://agent-data-api.netlify.app/api/airbnb/preview?url=https%3A%2F%2Fwww.airbnb.com%2Frooms%2F577971748947083358"
Airbnb search results
GET /api/airbnb/searchScrape the first page of any public Airbnb search URL (city, dates, guests, filters) into an array of listing cards with id, title, nightly price, currency, rating, review count and cover photo. Up to 18 results per call.
url * | Airbnb search URL, e.g. https://www.airbnb.com/s/Lisbon/homes (dates, guests and filters in the URL are respected) |
max | Maximum number of results to return (1-18). Default: 18. |
currency | ISO 4217 currency for prices. Default: USD. |
curl -s "https://agent-data-api.netlify.app/api/airbnb/search?url=https%3A%2F%2Fwww.airbnb.com%2Fs%2FLisbon%2Fhomes&max=18"
Payment facts
| Protocol | x402 v1, scheme exact |
|---|---|
| Network | Base mainnet (base, chain id 8453) |
| Asset | USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (6 decimals) |
| payTo | 0x4F77782B5A7Be537F161631569D661F93b6e1ae6 |
| Facilitator | https://facilitator.payai.network (gas paid by the facilitator, no key needed) |
| Headers | request X-PAYMENT · response X-PAYMENT-RESPONSE |
| Not charged | 400/404 input or not-found errors, 502 upstream failures: settlement only happens after the data is ready. |
How the 402 flow works
- Call the endpoint without payment. You get
HTTP 402with{ x402Version: 1, accepts: [ ... ] }. - Sign an EIP-3009
transferWithAuthorization(EIP-712, domain USDC on Base) topayToformaxAmountRequired. - Retry the same request with the base64 payment payload in the
X-PAYMENTheader. - Receive
200with JSON data and theX-PAYMENT-RESPONSEreceipt (transaction hash on Base).
# 1) challenge
curl -i "https://agent-data-api.netlify.app/api/airbnb/listing?url=https%3A%2F%2Fwww.airbnb.com%2Frooms%2F577971748947083358¤cy=USD"
# HTTP/2 402
# {"x402Version":1,"error":"X-PAYMENT header is required","accepts":[{"scheme":"exact","network":"base","maxAmountRequired":"20000","resource":"https://agent-data-api.netlify.app/api/airbnb/listing","payTo":"0x4F77782B5A7Be537F161631569D661F93b6e1ae6","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",...}]}
# 2) with a client library (Node)
import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";
const fetchWithPay = wrapFetchWithPayment(fetch, privateKeyToAccount(process.env.PRIVATE_KEY));
const res = await fetchWithPay("https://agent-data-api.netlify.app/api/airbnb/listing?url=https%3A%2F%2Fwww.airbnb.com%2Frooms%2F577971748947083358¤cy=USD");
console.log(await res.json());
Machine-readable docs
- /openapi.json — OpenAPI 3.1 with
x-x402payment terms - /llms.txt — plain-text guide for LLM agents
- /.well-known/x402 — x402 resource list (same shape as the facilitator's discovery API)
- /.well-known/ard.json — Agentic Resource Discovery manifest
- /.well-known/api-catalog — RFC 9727 API catalog
- PayAI Bazaar listing
Data comes from public pages of YouTube and Airbnb at request time; availability depends on those sites. Nothing is charged when the data cannot be delivered.