API Reference
Beta
Complete API reference for protected routes endpoints, schemas, and response formats.
Dashboard Endpoints (JWT Auth)
These endpoints require JWT authentication and are used by the dashboard.
GET
/v1/billing/protected-routesGET
/v1/billing/protected-routes/{id}PATCH
/v1/billing/protected-routes/{id}DELETE
/v1/billing/protected-routes/{id}SDK Endpoints (API Key Auth)
These endpoints use API key authentication and are used by SDKs.
GET
/v1/protected-routes/routesPOST
/v1/protected-routes/routes/registerGET
/v1/protected-routes/match?path=...&method=...Protected Route Schema
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
| id | string | Optional | Unique route identifier (UUID) | — |
| route_pattern | string | Optional | URL pattern (e.g., /api/premium/*) | — |
| method | string | Optional | HTTP method (GET, POST, *, etc.) | — |
| amount | string | Optional | Price per request (e.g., '0.10') | — |
| currency | string | Optional | Currency code (USD, USDC, etc.) | — |
| name | string? | Optional | Optional friendly name | — |
| description | string? | Optional | Description shown in 402 response | — |
| status | string | Optional | active or paused | — |
| allow_anonymous | boolean | Optional | Allow requests without customer ID | — |
| source | string? | Optional | Origin: 'sdk-python-fastapi', 'dashboard', etc. | — |
| receiver_config_id | string? | Optional | Optional payment receiver config | — |
402 Response Format
When a request requires payment, the SDK returns a 402 Payment Required response:
{
"error": "Payment Required",
"charge_id": "chg_01HXYZ123ABC",
"amount": "0.10",
"currency": "USD",
"description": "Access to premium data endpoint",
"x402_requirements": {
"rail_config": {
"scheme": "exact",
"network": "solana-mainnet",
"asset": "USDC",
"pay_to_address": "...",
"max_timeout_seconds": 3600
},
"amount": "0.10",
"currency": "USD",
"external_ref": "chg_01HXYZ123ABC"
}
}
Request Examples
List Protected Routes
cURL
curl -X GET "https://api.orvion.sh/v1/billing/protected-routes" \-H "Authorization: Bearer YOUR_JWT_TOKEN"
Register a Route (SDK)
cURL
curl -X POST "https://api.orvion.sh/v1/protected-routes/routes/register" \-H "Authorization: Bearer YOUR_API_KEY" \-H "Content-Type: application/json" \-d '{"route_pattern": "/api/premium","method": "GET","amount": "0.10","currency": "USDC","name": "Premium API Access","description": "Access to premium features"}'
Match a Route
cURL
curl -X GET "https://api.orvion.sh/v1/protected-routes/match?path=/api/premium&method=GET" \-H "Authorization: Bearer YOUR_API_KEY"
Related Documentation
- Protected Routes Overview - General protected routes guide
- Python SDK - Python SDK integration
- Node.js SDK - Node.js SDK integration