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-endpoint

Credit 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

HeaderPurpose
X-PaymentBase64-encoded payment proof with signed transaction
x-wallet-addressWallet address for credit-based endpoints

Response Codes

CodeMeaning
200Success - payment verified
402Payment required - includes payment details
400Bad request - invalid payment data
401Unauthorized - invalid signature

Payment Pages

/pay/{slug}

Hosted payment page

/pay/credits/{slug}

Credit purchase page