Quick Start
Get from zero to first payment in 3 API calls. No SDK required — just curl (or any HTTP client).
Step 1: Register your platform
curl -X POST https://clawdpay.me/v1/auth/register \ -H "Content-Type: application/json" \ -d '{ "name": "my-platform", "contact_email": "dev@example.com" }' # Response: { "platform_id": "550e8400-...", "name": "my-platform", "api_key": "agx_pk_aBcDeFgH...", // Save this! "message": "Platform registered..." }
Step 2: Create an agent
curl -X POST https://clawdpay.me/v1/agents \ -H "Authorization: Bearer agx_pk_aBcDeFgH..." \ -H "Content-Type: application/json" \ -d '{ "name": "research-bot", "monthly_limit": 1000 }' # Response: { "agent_id": "770e8400-...", "api_key": "agx_sk_xYzAbC...", // Agent's key "wallet_balance": 100 // Signup bonus! }
Step 3: Make a payment
curl -X POST https://clawdpay.me/v1/pay \ -H "Authorization: Bearer agx_sk_xYzAbC..." \ -H "Content-Type: application/json" \ -d '{ "to": "weather-api", "amount": 5, "memo": "Beijing weather" }' # Response: { "payment_id": "pay_abc123", "status": "completed", "amount": 5, "balance_after": 95, "currency": "AGX" }
That's it. Three calls, zero certificates, zero signatures, zero human intervention.
Authentication
ClawdPay uses Bearer token authentication. There are two key types:
| Key Type | Prefix | Who Uses It | Permissions |
|---|---|---|---|
| Platform Key | agx_pk_ | Platform backend | Create/manage agents, create products |
| Agent Key | agx_sk_ | AI Agent | Pay, check balance, view transactions |
Include the key in every request:
Authorization: Bearer agx_sk_your_key_here
Register Platform
POST /v1/auth/register
Register a new platform to start creating agents. No authentication required.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique slug (2-100 chars) |
display_name | string | No | Human-readable name |
contact_email | string | Yes | Email for notifications |
website | string | No | Platform URL |
description | string | No | What your platform does |
Create Agent
POST /v1/agents
Create a new agent under your platform. Requires agx_pk_ key.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Agent name (unique per platform) |
display_name | string | No | Friendly name |
external_id | string | No | Your platform's agent ID |
monthly_limit | int | No | Max credits/month (0 = unlimited) |
Each new agent receives 100 AGX bonus credits.
Wallet
GET /v1/wallet
Check the agent's wallet balance. Requires agx_sk_ key.
{
"balance": 950,
"frozen": 0,
"available": 950,
"total_earned": 200,
"total_spent": 350,
"total_topup": 1100,
"currency": "AGX"
}
POST /v1/wallet/topup
Add credits to the wallet. Requires agx_sk_ key.
| Field | Type | Required | Description |
|---|---|---|---|
amount | int | Yes | Credits to add (> 0) |
memo | string | No | Note for the record |
Make Payment
POST /v1/pay
The core API. Pay another agent, buy a product, or tip a creator. Requires agx_sk_ key.
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient: agent UUID, agent name, or product slug |
amount | int | Yes | Credits to pay (> 0) |
product_id | string | No | Product slug (for product purchase) |
memo | string | No | Payment description |
idempotency_key | string | No | Prevent duplicate charges |
GET /v1/pay/{payment_id}
Retrieve details for a specific payment.
Products
POST /v1/products
Create a priced product (tool, API, content). Requires agx_pk_ key.
| Field | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | URL-safe ID: weather-api-call |
name | string | Yes | Human-readable name |
price | int | Yes | Credits per unit (0 = free) |
pricing_model | string | No | per_call | subscription | one_time |
provider_agent_id | string | No | Agent that receives payment |
GET /v1/products
List all active products. No authentication required.
GET /v1/products/{slug}
Get product details by slug.
Transactions
GET /v1/transactions
List the agent's transaction history. Requires agx_sk_ key.
| Param | Type | Description |
|---|---|---|
tx_type | string | Filter: pay / topup / refund / earn |
limit | int | 1-100, default 20 |
offset | int | Pagination offset |
Error Codes
All errors return a JSON body with error (human-readable) and code (machine-readable).
| HTTP | Code | Meaning |
|---|---|---|
| 401 | auth_required | Missing or invalid API key |
| 401 | invalid_key | API key not found in database |
| 402 | insufficient_balance | Wallet balance too low |
| 403 | monthly_limit_exceeded | Monthly spending limit reached |
| 404 | recipient_not_found | Cannot resolve the to field |
| 409 | duplicate | Name/slug already exists |
| 422 | no_wallet | Agent has no wallet (system error) |
Idempotency
Pass idempotency_key in the payment body. If a payment with the same key already exists, the original result is returned without charging again. Keys are unique globally.
# First call — creates payment POST /v1/pay { "to": "api", "amount": 5, "idempotency_key": "req-001" } → { "status": "completed", "balance_after": 95 } # Retry (network glitch) — returns same result, no double charge POST /v1/pay { "to": "api", "amount": 5, "idempotency_key": "req-001" } → { "status": "completed", "balance_after": 95 } // Same!
Rate Limits
Default limits (will increase as the platform scales):
| Scope | Limit |
|---|---|
| Per agent key | 100 requests/minute |
| Per platform key | 300 requests/minute |
| Payment endpoint | 60 payments/minute per agent |