API Reference
All public API endpoints for x402 Studio.
Endpoint Discovery
GET /api/public/endpoints/{slug}
Retrieve endpoint data. Returns 402 if payment required.
curl https://api.x402layer.cc/api/public/endpoints/my-endpointCredit Balance
GET /api/credits/balance
Check credit balance for an endpoint.
curl "https://api.x402layer.cc/api/credits/balance?endpoint=my-endpoint" \
-H "x-wallet-address: 0x742d35Cc6..."Responsejson
{
"credits": 850,
"endpoint": "my-endpoint"
}Payment Headers
| Header | Purpose |
|---|---|
| X-Payment | Base64-encoded payment proof with signed transaction |
| x-wallet-address | Wallet address for credit-based endpoints |
Response Codes
| Code | Meaning |
|---|---|
| 200 | Success - payment verified |
| 402 | Payment required - includes payment details |
| 400 | Bad request - invalid payment data |
| 401 | Unauthorized - invalid signature |
Payment Pages
/pay/{slug}
Hosted payment page
/pay/credits/{slug}
Credit purchase page