402 Index API

Programmatic access to the paid API directory. Free tier available, L402 payments for higher limits.

Machine-Readable API Docs

OpenAPI 3.1 Spec (JSON) · API Docs (Markdown)

Base URL

https://402index.io/api/v1

Endpoints

GET /api/v1/services

List and search services with filtering, sorting, and pagination.

ParameterTypeDescription
protocolstringFilter by protocol: l402 or x402
categorystringFilter by category (prefix match — crypto matches crypto/nft)
healthstringFilter by health: healthy, degraded, down, unknown
sourcestringFilter by source: bazaar, satring, l402apps, sponge, well-known, exclusive, self-registered, discovery
featuredbooleanOnly featured services: true
qstringSearch by name, description, or URL
max_price_usdnumberMaximum price in USD
payment_assetstringFilter by payment asset (e.g. BTC, USDC)
payment_validbooleanOnly x402 services with verified payment requirements: true
sortstringSort by: name, price, latency, uptime, reliability
orderstringSort order: asc or desc
limitintegerResults per page (default 50, max 200)
offsetintegerPagination offset
GET /api/v1/services?protocol=l402&health=healthy
GET /api/v1/services/:id

Get full details for a single service, including recent health check history.

GET /api/v1/services/1
GET /api/v1/categories

List all categories with service counts, organized as a tree with subcategories.

GET /api/v1/categories
GET /api/v1/health

System health and sync status. Returns endpoint counts, distinct service/provider counts by protocol, health status breakdowns, source counts, and last sync timestamps.

GET /api/v1/health
POST /api/v1/register

Register an L402 endpoint. The URL is probed to verify L402 compliance. Registrations are reviewed before appearing in the directory. Rate limited to 10 registrations per hour per IP.

ParameterTypeDescription
urlstringRequired. The endpoint URL to register
namestringRequired. Display name for the service
protocolstringRequired. Currently only L402 is supported
http_methodstringHTTP method that triggers the L402 paywall. Default: GET. Allowed: GET, POST, PUT, DELETE
probe_bodystringJSON body to send during health checks and verification probes. Required for endpoints that validate the request body before issuing the L402 challenge. Must be valid JSON.
descriptionstringDescription of what the service does
price_satsintegerPrice per request in satoshis
price_usdnumberPrice per request in USD
payment_assetstringPayment asset (e.g. BTC, USDC)
payment_networkstringPayment network (e.g. Lightning, Base, Solana)
categorystringCategory (e.g. bitcoin). Defaults to uncategorized
providerstringOrganization or developer name
contact_emailstringContact email (not displayed publicly)
curl -X POST https://402index.io/api/v1/register \ -H 'Content-Type: application/json' \ -d '{ "url": "https://api.example.com/resource", "name": "My L402 API", "protocol": "L402", "provider": "My Org" }'

Response codes:

StatusMeaning
201Registered and pending review. Returns the service record (with status: "pending") and verification details. Re-registering an existing URL+protocol updates the record.
400Missing required fields, invalid protocol, invalid URL, or field exceeds max length.
422L402 verification failed. The response includes actionable details: wrong HTTP status, missing WWW-Authenticate header, unreachable endpoint, or SSRF blocked.
429Rate limit exceeded (10 registrations per hour per IP).

.well-known Auto-Discovery

If your endpoint returns 400 or 406 during verification and you haven't provided a probe_body, we'll check https://your-host/.well-known/l402-services for probe configuration. If your discovery document lists the endpoint with a request_schema, we'll construct a minimal probe body automatically. Learn more about .well-known discovery.

GET /api/v1/export.csv L402 Required

Export the full directory as CSV. Requires L402 payment — no free tier. Supports the same filters as /api/v1/services.

CSV columns: id, name, description, url, protocol, price_sats, price_usd, payment_asset, payment_network, category, provider, source, health_status, uptime_30d, latency_p50_ms, last_checked, http_method, reliability_score

Sats-only prices are automatically converted to USD using the current BTC/USD rate.

curl -H 'Authorization: L402 <macaroon>:<preimage>' \ 'https://402index.io/api/v1/export.csv?protocol=l402'

Response codes:

StatusMeaning
200CSV file download (Content-Type: text/csv)
402L402 payment required. Add ?l402=require to get a Lightning invoice challenge.

Distribution

GET /feed.xml

RSS 2.0 feed of indexed services with a custom l402:service XML namespace. Each item includes <l402:endpoint>, <l402:protocol>, and <l402:price> tags.

ParameterTypeDescription
protocolstringFilter: L402 or x402
healthstringFilter: healthy, degraded, down
typestringnew for services added in the last 7 days
GET /feed.xml?protocol=L402&health=healthy
GET /api/v1/opportunities

Ecosystem gap analysis — identifies categories with poor coverage, missing protocols, single-provider dependencies, and failing services. Useful for developers looking for underserved niches.

ParameterTypeDescription
protocolstringFilter opportunities by protocol: L402 or x402
GET /api/v1/opportunities
POST /api/v1/webhooks

Register a webhook to receive real-time notifications when services are added, change health, or go down. Deliveries are signed with HMAC-SHA256 (X-402Index-Signature header). Rate limited to 5 registrations per hour per IP.

ParameterTypeDescription
urlstringRequired. HTTPS callback URL
secretstringRequired. Shared secret for HMAC signing (min 16 chars)
eventsstringComma-separated events: service.new, service.health_changed, service.down. Default: service.new
protocol_filterstringOnly deliver for: L402 or x402
curl -X POST https://402index.io/api/v1/webhooks \ -H 'Content-Type: application/json' \ -d '{ "url": "https://example.com/webhook", "secret": "your-secret-min-16-chars", "events": "service.new,service.down" }'

Management:

MethodPathDescription
GET/api/v1/webhooks/:idCheck webhook status. Requires X-Webhook-Secret header.
DELETE/api/v1/webhooks/:idRemove webhook. Requires X-Webhook-Secret header.

Webhooks are auto-deactivated after 10 consecutive delivery failures.

Response Format

The services list endpoint returns JSON with the following structure:

{ "services": [ { "id": 1, "name": "Example Weather API", "description": "Real-time weather data from NOAA", "url": "https://api.example.com/weather", "protocol": "L402", "price_sats": 5, "price_usd": 0.002, "payment_asset": "BTC", "payment_network": "Lightning", "category": "real-time-data/weather", "provider": "Example Corp", "source": "exclusive", "featured": 1, "health_status": "healthy", "uptime_30d": 0.997, "latency_p50_ms": 245, "last_checked": "2025-02-28T12:00:00Z", "registered_at": "2025-01-15T08:30:00Z", "http_method": "GET", "reliability_score": 92.5, "x402_payment_valid": null, "x402_facilitator_reachable": null, "x402_asset_known": null } ], "total": 7595, "limit": 50, "offset": 0 }

Upcoming Fields

The following fields are present in the schema but currently null for all services. They will be populated as providers adopt these standards.

FieldTypeDescription
l402_versionstringProtocol version (bLIP-0026)
agent_spec_urlstringURL to agent-spec.md for this endpoint (bLIP-0026)
capabilitiesstringJSON array of declared agent capabilities (bLIP-0026)
token_formatstringToken format: macaroon, opaque, or jwt
invoice_typestringInvoice type: bolt11, bolt12, or taproot_asset
pricing_modelstringPricing model: per-request, time-bounded, or token-bucket
content_domainstringKnowledge domain for AI/media endpoints (e.g. bitcoin-media, ai-inference)

Rate Limits & L402 Payments

API endpoints are rate-limited to ensure fair usage. Pay via Lightning Network to unlock higher limits.

TierLimitHow
Free100 req/min per IPNo auth needed
L4021,000 req/min per IPAuthorization: L402 <macaroon>:<preimage>

When you exceed the free tier, the API returns 402 Payment Required with a Lightning invoice in the WWW-Authenticate header. Pay the invoice, then include the L402 token in subsequent requests.

Exempt from rate limiting: /, /about, /api-docs, /service/*, /api/v1/health, /feed.xml, /opportunities

402 Index is the first service listed in its own directory — the CSV export endpoint is L402-gated, so we eat our own dog food.

MCP Server

Query the 402 Index directory directly from Claude, GPT, Cursor, or any MCP-compatible AI assistant.

Quick Start

npx @402index/mcp-server

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{ "mcpServers": { "402index": { "command": "npx", "args": ["@402index/mcp-server"] } } }

Claude Code

claude mcp add 402index -- npx @402index/mcp-server

Cursor

Add to .cursor/mcp.json:

{ "mcpServers": { "402index": { "command": "npx", "args": ["@402index/mcp-server"] } } }

Available Tools

ToolDescription
search_servicesSearch/filter paid APIs by protocol, category, health, price
get_service_detailFull details + health check history for a service
list_categoriesAll categories with endpoint counts
get_directory_statsEcosystem health, totals, sync timestamps