Documentation Index
Fetch the complete documentation index at: https://docs.x402layer.cc/llms.txt
Use this file to discover all available pages before exploring further.
Creating Endpoints
Endpoints are the core of x402 Studio. They turn your APIs into paid services that accept crypto payments automatically.Endpoint Types
Pay-Per-Request
Charge a fixed price for each API call. Best for:
- High-value API responses
- Compute-intensive operations
- Premium data access
Credit-Based
Sell credit packs upfront. Best for:
- High-volume APIs
- Subscription-like access
- Lighter per-call pricing
Pricing Limits
All prices must be at least 0.01 USDC. This applies to:
- Pay-per-request pricing
- Credit package prices
- Agentic access pricing
Creating a New Endpoint
Step 1: Navigate to Endpoints
Go to Dashboard → Endpoints and click New Endpoint.Step 2: Basic Information
| Field | Description |
|---|---|
| Name | A descriptive name for your endpoint |
| Description | What this endpoint does (shown to users) |
| Origin URL | Your actual API endpoint URL |
Step 3: Set Your Payout Address
Enter the wallet address where you want to receive payments:⚠️ Double-check this address. Payments are irreversible once sent.
Origin Protection (API Key Security)
Important: When you create an endpoint, x402 Studio generates an Origin Protection Key (API Key). This key is used by the x402 Gateway to authenticate requests to your origin server. Without proper API key validation, your endpoint will not accept payments. The gateway performs a health check before allowing payments, and if your origin returns a 401/403 error, the payment button will be disabled.
How It Works
- When you create an endpoint, an API key is generated and shown once
- Add this key to your server’s environment variables (e.g.,
X402_API_KEY) - Your server must validate incoming requests using this key
- The x402 Gateway sends the key in the
X-API-Keyheader
Server-Side Validation Examples
Public Endpoints: If you don’t want to require API key validation (e.g., your API is already public), you can disable the “Require API Key” toggle when creating the endpoint. However, this means anyone who discovers your origin URL can access it without payment.
Health Check (Service Availability)
Before showing the payment button, x402 Studio runs a health check against your origin URL to verify your service is reachable. If the check fails, the payment page shows “Service Unavailable” and disables the pay button — protecting customers from paying for a down service.How the Health Check Works
- We send a
HEADrequest to your origin URL (with your API key in headers if configured) - If
HEADfails or returns 400+, we retry with aGETrequest - Responses of 2xx, 3xx, or 402 mean your service is up
- Responses of 401/403 (auth error), 404 (not found), or 5xx (server error) mark the service as unavailable
- No response within 10 seconds is treated as a timeout
Troubleshooting “Service Unavailable”
| Symptom | Cause | Fix |
|---|---|---|
| 401/403 | API key missing or incorrect | Re-check the key in your server’s environment variables |
| 404 | No route at the root path | Make sure GET / returns something (even a simple 200 OK) |
| Timeout | Server took >10s to respond | Check if your server is running and reachable from the public internet |
| Network error | Server unreachable | Ensure your server isn’t behind a firewall blocking external requests |
Payment Page Inputs (API Schema)
You can define custom input forms that appear on your endpoint’s payment page. This lets customers provide data (like a prompt, email, or configuration) when they pay for your API.Auto-Detect from OpenAPI
If your origin server has an OpenAPI or Swagger spec, x402 Studio will automatically detect it when you enter your origin URL. Detected routes are pre-populated in the form builder — you can edit or remove them.Manual Builder
Use the form builder to define routes and input fields manually:- Click Add Route to add an API route (GET, POST, PUT, etc.)
- Give it a Service Name — this is what customers see
- Add Input Fields — each field becomes a form input on the payment page
- Set labels, placeholders, and whether the field is required
- Use the Preview toggle to see exactly what customers will see
Where the Schema Appears
| Surface | What’s Shown |
|---|---|
| Payment page | Interactive form with your defined inputs |
| Marketplace listing | API documentation with routes and parameters |
| 402 challenge response | Machine-readable api_schema field for agents |
| Agentic endpoints API | Returned in GET/list responses |
Testing Your Endpoint
After creation, test that everything works:Managing Endpoints
From the Dashboard, you can:- Edit – Update pricing, origin URL, or settings
- Pause – Temporarily disable the endpoint
- Delete – Permanently remove the endpoint
- View Analytics – See payment history and usage stats
🤖 AI Integration Helper
Don’t know how to use your API key? After creating an endpoint, you’ll see a purple card with a “Copy AI Integration Prompt” button. Click it to copy a pre-written prompt, then paste it into any AI assistant:💡 This is the easiest way to integrate x402 payments into your project with zero coding knowledge!
- Cursor – Paste in chat to generate integration code
- ChatGPT / Claude – Get step-by-step integration help
- GitHub Copilot – Use as context for code suggestions
