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/listing
USD 0.02 per call (20000 USDC atomic)

Scrape 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)
currencyISO 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&currency=USD"

Airbnb listing preview (free)

GET /api/airbnb/preview
USD 0 per call (0 USDC atomic)

Free 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/search
USD 0.05 per call (50000 USDC atomic)

Scrape 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)
maxMaximum number of results to return (1-18). Default: 18.
currencyISO 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

Protocolx402 v1, scheme exact
NetworkBase mainnet (base, chain id 8453)
AssetUSDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (6 decimals)
payTo0x4F77782B5A7Be537F161631569D661F93b6e1ae6
Facilitatorhttps://facilitator.payai.network (gas paid by the facilitator, no key needed)
Headersrequest X-PAYMENT · response X-PAYMENT-RESPONSE
Not charged400/404 input or not-found errors, 502 upstream failures: settlement only happens after the data is ready.

How the 402 flow works

  1. Call the endpoint without payment. You get HTTP 402 with { x402Version: 1, accepts: [ ... ] }.
  2. Sign an EIP-3009 transferWithAuthorization (EIP-712, domain USDC on Base) to payTo for maxAmountRequired.
  3. Retry the same request with the base64 payment payload in the X-PAYMENT header.
  4. Receive 200 with JSON data and the X-PAYMENT-RESPONSE receipt (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&currency=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&currency=USD");
console.log(await res.json());

Machine-readable docs

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.