Skip to main content

Getting Started in 5 Minutes

The fastest path from zero to a working Pry instance: start the server, scrape your first page, and make your first x402 payment — all copy-paste runnable. Everything here assumes a machine with Docker installed.

:::note Already have Pry running?

If you've already completed Quickstart, skip to Step 3 — first x402 payment.

:::

1. Start Pry with Docker Compose

git clone https://git.rugmunch.io/RugMunchMedia/pryscraper.git
cd pryscraper

# (optional for local use) cp .env.example .env
docker compose up -d

Compose starts the API plus the FlareSolverr sidecar (Cloudflare bypass). Wait for the healthcheck, then verify:

curl http://localhost:8005/health

You should get a JSON health payload. Pry publishes on host port 8005 → container port 8002; FlareSolverr on host 8192 → container 8191.

:::note Port 8005 vs 8002

From outside the container (host, SDK, CLI) always use http://localhost:8005. Port 8002 is only reachable if you docker exec into the running container.

:::

2. First scrape

curl -X POST http://localhost:8005/v1/scrape \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "formats": ["markdown"]}'

Response (200):

{
"success": true,
"data": {
"url": "https://example.com",
"markdown": "# Example Domain\n\nThis domain is for use in illustrative examples...",
"metadata": {
"title": "Example Domain",
"status_code": 200,
"method_used": "direct"
}
}
}

Out of the box (no PRY_API_KEY set) Pry is loopback-only: requests from non-loopback sources get 401, so a keyless instance is never exposed to the internet. On localhost the call above just works.

Want structured data instead of markdown? Add a JSON schema:

curl -X POST http://localhost:8005/v1/extract/css \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"schema": {
"name": "page",
"fields": [{"name": "title", "selector": "h1", "type": "text"}]
}
}'

3. First x402 payment

x402 turns Pry into a pay-per-call API: clients pay USDC per call from a wallet instead of holding an API key. The middleware is built in — the paid endpoints (/v1/scrape, /v1/crawl, /v1/extract/*, /v1/automate, …) respond 402 Payment Required with a PAYMENT-REQUIRED header when no payment is attached.

Configure your receiving wallet before testing payments:

export PRY_X402_ENABLED=true
export PRY_X402_WALLET=0x... # your receiving EVM wallet (Base by default)

Then add these to your docker-compose.yml pry service environment (or .env), and restart:

docker compose up -d --force-recreate pry

3a. Check the price list

curl http://localhost:8005/v1/x402/pricing

Response (200): per-operation prices in USD, e.g.

{
"success": true,
"data": {
"scrape": {"price_usd": 0.001, "description": "Single URL scrape"},
"crawl": {"price_usd": 0.01, "description": "Crawl up to 10 pages"},
"extract": {"price_usd": 0.005, "description": "Structured extraction"},
"automate": {"price_usd": 0.05, "description": "Browser automation"}
}
}

3b. Hit a paid endpoint — see the 402

curl -i -X POST http://localhost:8005/v1/scrape \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'

You'll get HTTP/1.1 402 Payment Required with a PAYMENT-REQUIRED header (Base64-encoded JSON: wallet, amount, asset, facilitator) — that's the challenge.

3c. Create a payment request

curl -X POST http://localhost:8005/v1/x402/payment \
-H "Content-Type: application/json" \
-d '{"operation": "scrape"}'

Response (200): payment details to act on — { "wallet": "...", "amount": 0.001, "asset": "USDC", "network": "base", ... }.

3d. Pay and replay the token

  1. Send the USDC to the wallet from the 402/payment response.
  2. Submit the tx to POST /v1/x402/pay with operation, tx_hash, payer_wallet, network, asset, amount_usd.
  3. Pry verifies on-chain, returns a payment_id (an access token).
  4. Replay it on any paid endpoint with the X-Payment-Id header until the TTL expires (default 3600s):
curl -X POST http://localhost:8005/v1/scrape \
-H "Content-Type: application/json" \
-H "X-Payment-Id: <payment_id>" \
-d '{"url": "https://example.com"}'

:::note Offline dev shortcut

For local testing without a real wallet, PRY_X402_OFFLINE=true makes every verify succeed without a facilitator — but it requires DEBUG=true (or PRY_DEBUG=true) and must never be enabled in production.

:::

Done — what's next

TopicPage
Full quickstart with SDK + CLIQuickstart
Install options (pip / source)Installation
Compose + env referenceDocker Compose
All 17 data domainsData Domains
Multi-chain x402 (EVM/Solana/TRON)x402 Pay-per-call
AI agentsMCP Integration