Documentation

Pay-per-call HTTP 402 endpoints for AI agents. One key, one header, twelve endpoints.

Quickstart

Get an API key and make your first call in under a minute.

  1. 1
    Buy credits

    Visit the homepage and complete checkout. $1 buys 5 credits. Credits never expire.

  2. 2
    Save your API key

    Stripe redirects you to a success page with an ap_live_... key. Save it — we won't show it again.

  3. 3
    Make your first request

    Bearer auth on every endpoint. 1 credit per successful call.

curl -X POST https://402s.shop/api/v1/qr-code \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello from my agent"}' \
  --output result.png

Authentication

Every endpoint requires a Bearer token in the Authorization header.

Authorization: Bearer ap_live_VyQ_cUtIndDub...
401invalid_api_key

Header missing, malformed, or key not recognized.

402payment_required

Key valid, balance is 0. Response includes WWW-Authenticate with the top-up URL.

Pricing

Pay-per-call. 1 credit per successful endpoint call. Credits never expire.

PackagePriceCredits$ / call
small$15$0.200
medium$530$0.167
large$20150$0.133

4xx and 5xx responses do not deduct credits. Only successful 2xx responses are charged.

Errors

400bad_request

Invalid JSON, missing required fields, or out-of-range values.

401invalid_api_key

Missing or unrecognized Bearer token.

402payment_required

API key valid but credits = 0. Top up to continue.

422processing_failed

External fetch failed (URL unreachable, transcript not found, etc). No credit deducted.

500internal_error

Unexpected server error. No credit deducted.

503ai_unavailable

AI summarization endpoint is offline (missing ANTHROPIC_API_KEY).

HTTP 402 response example

HTTP/1.1 402 Payment Required
WWW-Authenticate: Bearer realm="402s.shop", charge="$1", topup_url="https://402s.shop"
X-Credits-Remaining: 0
Content-Type: application/json

{
  "error": "payment_required",
  "message": "Out of credits. Top up to continue using the API.",
  "topup_url": "https://402s.shop",
  "credits_remaining": 0
}

Endpoints

12 endpoints. All POST. All require Bearer auth. All cost 1 credit per success.

/qr-code

POST/api/v1/qr-code·1 credit

Generate a QR code PNG from any text or URL.

Request body

textstringrequired

Text to encode (1–2048 chars).

sizenumberoptional

Width in pixels (100–1000, default 300).

Response

image/png with X-Credits-Remaining header.

Example

curl -X POST https://402s.shop/api/v1/qr-code \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello from my agent"}' \
  --output result.png

/og-image

POST/api/v1/og-image·1 credit

Generate a 1200×630 social-media OG image with title and subtitle.

Request body

titlestringrequired

1–200 characters.

subtitlestringoptional

Up to 300 characters.

theme"dark" | "light"optional

Default "dark".

Response

image/png with X-Credits-Remaining header.

Example

curl -X POST https://402s.shop/api/v1/og-image \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"title":"AgentPay","subtitle":"HTTP 402 for AI agents","theme":"dark"}' \
  --output result.png

/screenshot

POST/api/v1/screenshot·1 credit

Render a webpage in headless Chromium and return a PNG screenshot.

Request body

urlstringrequired

http(s) URL to screenshot.

viewport{ width, height }optional

320–1920 × 240–2160. Default 1280×800.

fullPagebooleanoptional

Capture full scrolling page. Default false.

Response

image/png with X-Credits-Remaining header.

Example

curl -X POST https://402s.shop/api/v1/screenshot \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://402s.shop","viewport":{"width":1280,"height":800},"fullPage":false}' \
  --output result.png

/pdf-from-url

POST/api/v1/pdf-from-url·1 credit

Render any URL to a print-ready PDF.

Request body

urlstringrequired

http(s) URL.

format"A4" | "Letter" | "Legal"optional

Default "A4".

Response

application/pdf with X-Credits-Remaining header.

Example

curl -X POST https://402s.shop/api/v1/pdf-from-url \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://en.wikipedia.org/wiki/HTTP_402","format":"A4"}' \
  --output result.pdf

/word-count

POST/api/v1/word-count·1 credit

Count words on any webpage and estimate reading time.

Request body

urlstringrequired

http(s) URL.

Response

application/json with X-Credits-Remaining header.

{
  "url": "https://en.wikipedia.org/wiki/HTTP_402",
  "wordCount": 1247,
  "readingTimeMinutes": 7,
  "charCount": 8423
}

Example

curl -X POST https://402s.shop/api/v1/word-count \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://en.wikipedia.org/wiki/HTTP_402"}'

/extract-metadata

POST/api/v1/extract-metadata·1 credit

Extract Open Graph, Twitter card, and standard meta tags.

Request body

urlstringrequired

http(s) URL.

Response

application/json with X-Credits-Remaining header.

{
  "url": "https://github.com",
  "title": "GitHub",
  "description": "GitHub is where over 100 million developers shape the future of software.",
  "image": "https://github.githubassets.com/.../og-image.png",
  "siteName": "GitHub",
  "type": "object",
  "favicon": "https://github.com/favicon.ico",
  "locale": "en"
}

Example

curl -X POST https://402s.shop/api/v1/extract-metadata \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://github.com"}'

/extract-emails

POST/api/v1/extract-emails·1 credit

Find email addresses on a page (mailto links + body text). Deduplicated, max 100.

Request body

urlstringrequired

http(s) URL.

Response

application/json with X-Credits-Remaining header.

{
  "url": "https://www.python.org/about/contact/",
  "emails": [
    "webmaster@python.org",
    "psf@python.org"
  ],
  "count": 2
}

Example

curl -X POST https://402s.shop/api/v1/extract-emails \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.python.org/about/contact/"}'

/website-tech

POST/api/v1/website-tech·1 credit

Detect framework, CMS, analytics, and hosting/CDN from HTML and response headers.

Request body

urlstringrequired

http(s) URL.

Response

application/json with X-Credits-Remaining header.

{
  "url": "https://vercel.com",
  "framework": "Next.js",
  "cms": null,
  "analytics": [
    "Google Analytics"
  ],
  "hosting": "Vercel",
  "server": "Vercel",
  "technologies": [
    "Next.js",
    "Google Analytics",
    "Vercel"
  ]
}

Example

curl -X POST https://402s.shop/api/v1/website-tech \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://vercel.com"}'

/whois

POST/api/v1/whois·1 credit

WHOIS lookup with normalized fields (registrar, dates, nameservers, status).

Request body

domainstringrequired

Domain name like example.com.

Response

application/json with X-Credits-Remaining header.

{
  "domain": "402s.shop",
  "registrar": "Namecheap, Inc.",
  "createdDate": "2026-04-30T00:00:00Z",
  "expiresDate": "2027-04-30T00:00:00Z",
  "updatedDate": "2026-04-30T00:00:00Z",
  "nameservers": [
    "ns1.example.com",
    "ns2.example.com"
  ],
  "status": [
    "clientTransferProhibited"
  ],
  "raw": {
    "...": "full whois record"
  }
}

Example

curl -X POST https://402s.shop/api/v1/whois \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"domain":"402s.shop"}'

/domain-check

POST/api/v1/domain-check·1 credit

Heuristic availability check via WHOIS — best-effort, not authoritative.

Request body

domainstringrequired

Domain name like example.com.

Response

application/json with X-Credits-Remaining header.

{
  "domain": "this-domain-is-probably-available-12345.com",
  "available": true,
  "registrar": null,
  "expiresDate": null
}

Example

curl -X POST https://402s.shop/api/v1/domain-check \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"domain":"this-domain-is-probably-available-12345.com"}'

/youtube-transcript

POST/api/v1/youtube-transcript·1 credit

Fetch a YouTube video transcript with timestamps and computed word count.

Request body

urlstringrequired

YouTube watch / shorts / embed / youtu.be URL.

langstringoptional

BCP-47 language code (default "en").

Response

application/json with X-Credits-Remaining header.

{
  "videoId": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "language": "en",
  "transcript": [
    {
      "text": "We're no strangers to love",
      "offset": 0,
      "duration": 3.5
    },
    {
      "text": "You know the rules and so do I",
      "offset": 3.5,
      "duration": 3.5
    }
  ],
  "fullText": "We're no strangers to love You know the rules and so do I ...",
  "wordCount": 312,
  "durationSeconds": 213
}

Example

curl -X POST https://402s.shop/api/v1/youtube-transcript \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'

/summarize

POST/api/v1/summarize·1 credit

AI-powered summary of supplied text or fetched URL. Uses Claude Haiku 4.5.

Request body

textstringoptional

Provide either text (50–50000 chars) or url, not both.

urlstringoptional

http(s) URL to fetch and summarize.

length"short" | "medium" | "long"optional

Default "medium".

Response

application/json with X-Credits-Remaining header.

{
  "summary": "HTTP 402 Payment Required is a status code defined in the HTTP specification...",
  "originalLength": 8423,
  "summaryLength": 412,
  "compressionRatio": 0.0489,
  "model": "claude-haiku-4-5",
  "length": "medium"
}

Example

curl -X POST https://402s.shop/api/v1/summarize \
  -H "Authorization: Bearer ap_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://en.wikipedia.org/wiki/HTTP_402","length":"medium"}'