Authentication
AgentUtil supports three authentication methods:
1. API Key
Traditional auth — prepay for credits, use an API key.
curl https://api.agentutil.dev/v1/tools/dns.lookup/tasks \ -H "Authorization: Bearer sk_live_xxxxx" \ -H "Content-Type: application/json" \ -d '{"domain": "example.com"}'
When to use: Testing, traditional integrations, prepaid usage.
2. x402 Micropayments
Pay-per-request with USDC on Base. No signup required.
1. POST /v1/tools/{tool}/tasks (no auth)
2. Get 402 with payment requirements
3. Sign EIP-3009 authorization with wallet
4. Retry with PAYMENT-SIGNATURE header
5. Get task_id + poll_token
When to use: AI agents, autonomous payments, no account needed.
3. Poll Token
Task-scoped tokens returned when you create a task. Use them to poll results without additional auth.
How it works
When you create a task (via API key or x402), you get:
{ "task_id": "task_abc123", "poll_token": "pt_eyJhbGci...", "status": "pending", "poll_url": "/v1/tasks/task_abc123" }
Use the poll_token to poll:
curl https://api.agentutil.dev/v1/tasks/task_abc123 \ -H "Authorization: Bearer pt_eyJhbGci..."
Properties
- Format:
pt_xxxxx(JWT) - Expiry: 24 hours
- Scope: Single task only
- Self-validating: No database lookup required
Why poll tokens?
For x402 payments, you only pay once (to create the task). The poll token lets you check status and retrieve results without signing additional payments or maintaining a wallet connection.
Header Format
All auth methods use the Authorization header:
| Method | Format |
|---|---|
| API Key | Authorization: Bearer sk_xxxxx |
| Poll Token | Authorization: Bearer pt_xxxxx |
| x402 Payment | PAYMENT-SIGNATURE: <base64> |
Which to use?
| Scenario | Recommended |
|---|---|
| Testing/development | API Key |
| Traditional backend | API Key |
| AI agent (autonomous) | x402 |
| Polling task results | Poll Token |
| Wallet-based identity | x402 + SIWX |