Authentication
NervePay uses two types of authentication:
- JWT Token — For dashboard API endpoints. Obtained via Supabase Auth.
- API Key — For agent gateway endpoints. Provided when creating an agent.
# JWT Authentication (Dashboard API)curl -H "Authorization: Bearer <jwt_token>" ...# API Key Authentication (Gateway)curl -H "X-API-Key: np_live_xxxxx" ...# orcurl -H "Authorization: Bearer np_live_xxxxx" ...
Base URL
https://api.nervepay.com
Health & Config
GET /health
Check server health status.
curl https://api.nervepay.com/health
GET /config
Get supported networks and configuration.
curl https://api.nervepay.com/config
{"supported_networks": ["base", "base-sepolia", "solana", "solana-devnet"],"supported_currencies": ["USDC"]}
Agents
Manage your AI agents. Requires JWT authentication.
GET /api/agents
List all your agents.
curl https://api.nervepay.com/api/agents \-H "Authorization: Bearer <jwt>"
POST /api/agents
Create a new agent. Returns the API key only once.
curl -X POST https://api.nervepay.com/api/agents \-H "Authorization: Bearer <jwt>" \-H "Content-Type: application/json" \-d '{"name": "My Agent","slug": "my-agent","wallet_address": "0x...","approval_required": false}'
GET /api/agents/:id
Get a specific agent.
PUT /api/agents/:id
Update an agent.
curl -X PUT https://api.nervepay.com/api/agents/<id> \-H "Authorization: Bearer <jwt>" \-H "Content-Type: application/json" \-d '{"name": "Updated Name","wallet_address": "0x...","approval_required": true}'
DELETE /api/agents/:id
Delete an agent.
Endpoints
Configure pricing for agent routes. Requires JWT authentication.
GET /api/agents/:agent_id/endpoints
List all endpoints for an agent.
POST /api/agents/:agent_id/endpoints
Create a new endpoint with pricing.
curl -X POST https://api.nervepay.com/api/agents/<agent_id>/endpoints \-H "Authorization: Bearer <jwt>" \-H "Content-Type: application/json" \-d '{"method": "GET","path_pattern": "/weather","price_amount": "0.01","price_currency": "USDC","scheme": "exact","network_id": "base"}'
DELETE /api/agents/:agent_id/endpoints/:endpoint_id
Delete an endpoint.
Transactions
View payment transactions. Requires JWT authentication.
GET /api/agents/:agent_id/transactions
List transactions for an agent (last 100).
curl https://api.nervepay.com/api/agents/<agent_id>/transactions \-H "Authorization: Bearer <jwt>"
Approvals
Human-in-the-loop approval workflow. Requires JWT authentication.
GET /api/approvals
List all approval requests for your agents.
GET /api/approvals/:id
Get a specific approval request.
PATCH /api/approvals/:id
Approve or reject a request.
curl -X PATCH https://api.nervepay.com/api/approvals/<id> \-H "Authorization: Bearer <jwt>" \-H "Content-Type: application/json" \-d '{ "status": "approved" }'
Payment Gateway
x402 payment flow. Requires API key authentication.
GET/POST /v1/agents/:slug/*path
Access a paid resource. Without payment, returns 402. With valid PAYMENT-SIGNATURE header, processes payment and returns resource.
Request Headers
X-API-KeyorAuthorization: Bearer— API keyPAYMENT-SIGNATURE— Base64-encoded payment signature (optional)X-Approval-Token— Approval token if required (optional)
402 Response (Payment Required)
{"status": 402,"accepts": [{"scheme": "exact","network": "base","maxAmountRequired": "10000","resource": "/v1/agents/my-agent/weather","payTo": "0x...","maxTimeoutSeconds": 300,"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","extra": null}]}
200 Response (Success)
Returns your resource with PAYMENT-RESPONSE header containing settlement details.