x402 Index API Documentation

A list of all x402 websites implementing the x402 protocol.

API Endpoints

GET /api/all

Retrieves a list of all products (websites, services, etc.) that have been submitted to the x402 Index and implement the x402 protocol.

x402 Protocol Integration

This endpoint adheres to the x402 Payment Required protocol. If a payment is necessary to access the list (e.g., for premium API access or high-volume requests), the server will respond with an HTTP 402 Payment Required status. The response body will contain the necessary payment instructions, typically including a facilitator URL and payment details.

To successfully retrieve the data after a 402 response:

  1. The client (e.g., your application, an AI agent) uses the payment instructions to make a payment.
  2. Upon successful payment, the client receives a cryptographic proof of payment.
  3. The client then retries the GET /api/all request, including the proof of payment in the X-PAYMENT HTTP header.
  4. The server verifies this payment with the facilitator. If valid, it returns the list of products with an HTTP 200 OK status.
Request

Method: GET
URL: https://x402index.com/api/all

Headers (if payment made):

X-PAYMENT: <cryptographic_proof_of_payment>
Responses

200 OK - Successful Retrieval

Returned when the request is successful (either no payment was required, or a valid payment was provided).

[
  {
    "id": "prod_1a2b3c4d",
    "name": "Awesome AI Service",
    "description": "An AI-powered service for generating creative text.",
    "url": "https://awesomeaiservice.com/api",
    "x402_facilitator": "https://x402.org/facilitator",
    "submitter_wallet": "0x123...",
    "submitted_at": "2025-05-09T10:00:00Z"
  },
  {
    "id": "prod_5e6f7g8h",
    "name": "Data Analytics API",
    "description": "Provides real-time data analytics.",
    "url": "https://dataanalyticsapi.dev/v1",
    "x402_facilitator": "https://x402.org/facilitator",
    "submitter_wallet": "0x456...",
    "submitted_at": "2025-05-08T14:30:00Z"
  }
  // ... more products
]

402 Payment Required - Payment Needed

Returned when payment is required to access the resource. The response body will contain payment instructions.

{
  "error": "Payment Required",
  "message": "Access to this resource requires payment.",
  "payment_details": {
    "facilitator_url": "https://x402.org/facilitator", // Example facilitator
    "recipient_address": "0xYourReceivingWalletAddress",
    "amount": "0.01", // Example amount
    "currency": "USD", // Example currency (could be crypto ticker)
    "network": "base-sepolia", // Example network
    "description": "Access to x402 Index API /api/all"
  }
}

Note: The structure of payment_details may vary based on the facilitator and payment requirements.

Example Usage (Conceptual)

1. Initial request (may receive 402 if payment is gated):

curl https://x402index.com/api/all

2. If 402 is received, follow payment instructions from the response body. Then, retry with payment proof:

curl -H "X-PAYMENT: your_payment_proof_here" https://x402index.com/api/all