Documentation Index
Fetch the complete documentation index at: https://docs.aegisintent.xyz/llms.txt
Use this file to discover all available pages before exploring further.
x402 Micropayments
The x402 protocol enables AI agents to pay for API services using USDC, no credit cards, no subscriptions, no manual approvals. When an agent calls a 402-gated endpoint, Aegis handles the entire payment negotiation automatically.How x402 Works
Aegis handles the entire payment negotiation and settlement automatically:| Step | Actor / Sender | Receiver | Action / Message | Details & Outcome |
|---|---|---|---|---|
| 1 | AI Agent | Aegis API | POST /v1/actions/pay | Agent requests Aegis to pay for an external API service (serviceUrl & maxAmount specified). |
| 2 | Aegis API | Target Service | Initial HTTP Request | Aegis forwards the request to the target service without payment to trigger the x402 challenge. |
| 3 | Target Service | Aegis API | 402 Payment Required | Target service rejects initial call and returns pricing and recipient wallet details in response headers. |
| 4 | Aegis API | Policy Engine (DB) | Limits Check | Aegis verifies cost against agent’s spending limits. If limits are exceeded, the flow aborts immediately. |
| 5 | Aegis API | Circle DCW | Transaction Signing | Aegis connects to the agent’s secure Circle Developer Controlled Wallet to sign the USDC payment proof. |
| 6 | Aegis API | Target Service | Resubmit with Payment Proof | Aegis resubmits request to target service with the cryptographic payment proof attached. |
| 7 | Target Service | Aegis → Agent | 200 OK + Data Delivery | Target service verifies payment, executes request, and returns data. Aegis forwards it back to the agent. |
1. Agent requests a paid service
Your agent calls
/v1/actions/pay with the target service URL, the HTTP method, and a maximum amount it’s willing to spend.2. Aegis negotiates the payment
Aegis sends an initial request to the target service. If the service responds
with
402 Payment Required, Aegis extracts the payment requirements (price,
token type, and recipient address) from the response headers.3. Policy check
Before authorization, Aegis checks the price against the agent’s spending
policies. If the cost exceeds any configured limit (per-transaction, daily,
weekly, or monthly budgets), the payment is immediately rejected.
4. Payment execution
If the policy allows it, Aegis connects to the agent’s secure Circle Developer
Controlled Wallet (DCW) to sign the USDC transaction authorization payload,
then resubmits the request with the payment proof attached.
Usage
Payment Parameters
| Field | Type | Required | Description |
|---|---|---|---|
serviceUrl | string | Yes | The full URL of the x402-gated API endpoint |
maxAmount | string | Yes | Maximum USDC the agent is willing to pay |
method | string | No | HTTP method (GET, POST, PUT, DELETE, PATCH). Defaults to GET |
data | any | No | Request body to forward to the target service (for POST/PUT) |
headers | array | No | Additional headers to forward (max 10). Format: "Header-Name: value" |
Service Discovery
Before paying, your agent can discover available x402 services through the Marketplace API. You can also inspect a specific service to check its pricing before committing:Cost Estimation
Use the dry-run endpoint to estimate what a payment would cost without executing it:The
maxAmount field acts as a spending cap. If the service’s actual price is
lower, the agent only pays the actual amount. If the price exceeds
maxAmount, the payment is rejected.