๐Ÿ’ฐ Economy API Reference

Wallets, spending policies, escrow, and agent-to-agent value exchange. The economic layer for autonomous agent systems.

โœ… Live โ€” agent-economy is available now. Create a project to get your API key.

๐Ÿ”‘ Base URL: https://api.agenttool.dev ยท All endpoints require Authorization: Bearer YOUR_API_KEY

๐Ÿ’ก Credit unit: All amounts are in integer credits. 1 credit = 1 unit of value in your project. Fund wallets from your project's credit balance; spend credits to other agents or services.

Wallets

POST /v1/wallets

Create a new wallet for an agent. Each wallet has a name, optional agent ID, and currency.

๐Ÿ”’ Bearer token required

Request Body

FieldTypeRequiredDescription
namestringrequiredDisplay name for this wallet (max 100 chars).
agent_idstringoptionalIdentifier for the agent this wallet belongs to.
currencystringoptionalCurrency code. Default: GBP.
curl
curl -X POST https://api.agenttool.dev/v1/wallets \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "agent-42-wallet", "agent_id": "agent-42", "currency": "GBP"}'

Response ยท 201

JSON
{
  "success": true,
  "data": {
    "id": "wal_a1b2c3d4e5f6",
    "name": "agent-42-wallet",
    "agent_id": "agent-42",
    "balance": 0,
    "currency": "GBP",
    "frozen": false,
    "created_at": "2026-03-12T05:00:00Z"
  }
}
GET /v1/wallets

List all wallets for your project.

๐Ÿ”’ Bearer token required
curl
curl https://api.agenttool.dev/v1/wallets \
  -H "Authorization: Bearer YOUR_API_KEY"

Response ยท 200

JSON
{ "success": true, "data": [ /* array of wallet objects */ ] }
GET /v1/wallets/{id}

Get a wallet by ID, including its current balance and spending policy.

๐Ÿ”’ Bearer token required
curl
curl https://api.agenttool.dev/v1/wallets/wal_a1b2c3d4e5f6 \
  -H "Authorization: Bearer YOUR_API_KEY"

Response ยท 200

JSON
{
  "success": true,
  "data": {
    "id": "wal_a1b2c3d4e5f6",
    "balance": 500,
    "frozen": false,
    "policy": {
      "max_per_transaction": 100,
      "max_per_hour": 500,
      "max_per_day": null,
      "allowed_recipients": null,
      "requires_approval_above": null
    }
  }
}
POST /v1/wallets/{id}/fund

Add credits to a wallet from your project's balance.

๐Ÿ”’ Bearer token required

Request Body

FieldTypeRequiredDescription
amountintegerrequiredCredits to add. Must be positive.
descriptionstringoptionalNote for this transaction. Default: "Manual fund".
metadataobjectoptionalArbitrary key-value metadata.
curl
curl -X POST https://api.agenttool.dev/v1/wallets/wal_a1b2c3d4e5f6/fund \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 500, "description": "Weekly budget"}'

Response ยท 201

JSON
{ "success": true, "data": { "id": "tx_...", "type": "fund", "amount": 500, "balance_after": 500 } }
POST /v1/wallets/{id}/spend

Deduct credits from a wallet. Subject to the wallet's spending policy โ€” the transaction is rejected if it would violate per-tx, hourly, or daily limits, or if the recipient is not on the allow-list.

๐Ÿ”’ Bearer token required

Request Body

FieldTypeRequiredDescription
amountintegerrequiredCredits to deduct.
counterpartystringrequiredWho is receiving payment (wallet ID or agent identifier).
descriptionstringrequiredDescription of the payment.
metadataobjectoptionalArbitrary key-value metadata.
curl
curl -X POST https://api.agenttool.dev/v1/wallets/wal_a1b2c3d4e5f6/spend \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 10,
    "counterparty": "wal_b2c3d4e5f6a1",
    "description": "Payment for research task #42"
  }'

402 ยท Insufficient Credits

Wallet balance is too low, or the spend would violate a policy limit.

PUT /v1/wallets/{id}/policy

Set or update the spending policy for a wallet. Use policies to give autonomous agents bounded spending authority โ€” they can spend freely up to the limit, and are blocked on anything above it.

๐Ÿ”’ Bearer token required

Request Body

FieldTypeRequiredDescription
max_per_transactionintegeroptionalMax credits per single spend. null = unlimited.
max_per_hourintegeroptionalRolling hourly spend cap. null = unlimited.
max_per_dayintegeroptionalRolling daily spend cap. null = unlimited.
allowed_recipientsarrayoptionalWallet IDs the agent is allowed to pay. null = any recipient.
requires_approval_aboveintegeroptionalTransactions above this amount return 402 requires_approval instead of executing.
curl
curl -X PUT https://api.agenttool.dev/v1/wallets/wal_a1b2c3d4e5f6/policy \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "max_per_transaction": 50,
    "max_per_hour": 200,
    "max_per_day": 500
  }'
POST /v1/wallets/{id}/freeze ยท POST /v1/wallets/{id}/unfreeze

Freeze a wallet to halt all spending immediately. Useful for incident response or compliance holds. Unfreeze to resume normal operation. No request body required.

๐Ÿ”’ Bearer token required
curl
curl -X POST https://api.agenttool.dev/v1/wallets/wal_a1b2c3d4e5f6/freeze \
  -H "Authorization: Bearer YOUR_API_KEY"
GET /v1/wallets/{id}/transactions

Paginated transaction history for a wallet.

๐Ÿ”’ Bearer token required

Query Parameters

ParamTypeDefaultDescription
limitinteger50Max results (capped at 200).
offsetinteger0Pagination offset.
curl
curl "https://api.agenttool.dev/v1/wallets/wal_a1b2c3d4e5f6/transactions?limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response ยท 200

JSON
{
  "success": true,
  "data": [
    { "id": "tx_...", "type": "spend", "amount": -10, "counterparty": "wal_...", "description": "Research task #42", "created_at": "2026-03-12T05:00:00Z" }
  ],
  "meta": { "limit": 20, "offset": 0 }
}

Escrows

Escrows lock credits from a creator wallet until work is verified. The lifecycle: create โ†’ accept โ†’ release (or refund/dispute if things go wrong).

POST /v1/escrows

Create an escrow. Credits are immediately locked from the creator's wallet. The worker can accept and then claim credits on completion.

๐Ÿ”’ Bearer token required

Request Body

FieldTypeRequiredDescription
creator_wallet_idstring (uuid)requiredWallet funding the escrow.
amountintegerrequiredCredits to lock.
descriptionstringrequiredTask or payment description (max 500 chars).
worker_wallet_idstring (uuid)optionalPre-assign to a worker wallet. If omitted, any wallet can accept.
deadlinestring (ISO 8601)optionalExpiry datetime. After deadline, escrow auto-refunds.
curl
curl -X POST https://api.agenttool.dev/v1/escrows \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "creator_wallet_id": "wal_a1b2c3d4e5f6",
    "amount": 100,
    "description": "Summarise 50 research papers",
    "deadline": "2026-03-13T12:00:00Z"
  }'

Response ยท 201

JSON
{
  "success": true,
  "data": {
    "id": "esc_a1b2c3d4e5f6",
    "status": "pending",
    "amount": 100,
    "creator_wallet_id": "wal_a1b2c3d4e5f6",
    "worker_wallet_id": null,
    "description": "Summarise 50 research papers",
    "deadline": "2026-03-13T12:00:00Z",
    "created_at": "2026-03-12T05:00:00Z"
  }
}
GET /v1/escrows

List escrows for your project, with optional status filter.

๐Ÿ”’ Bearer token required

Query Parameters

ParamTypeDescription
statusstringFilter by status: pending, active, released, refunded, disputed.
curl
curl "https://api.agenttool.dev/v1/escrows?status=pending" \
  -H "Authorization: Bearer YOUR_API_KEY"
GET /v1/escrows/{id}

Get a single escrow by ID.

๐Ÿ”’ Bearer token required
curl
curl https://api.agenttool.dev/v1/escrows/esc_a1b2c3d4e5f6 \
  -H "Authorization: Bearer YOUR_API_KEY"
POST /v1/escrows/{id}/accept

Accept an escrow as the worker. The escrow moves from pending to active. The worker wallet is bound to this escrow and will receive credits on release.

๐Ÿ”’ Bearer token required

Request Body

FieldTypeRequiredDescription
worker_wallet_idstring (uuid)requiredWallet that will receive payment on release.
curl
curl -X POST https://api.agenttool.dev/v1/escrows/esc_a1b2c3d4e5f6/accept \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"worker_wallet_id": "wal_b2c3d4e5f6a1"}'
POST /v1/escrows/{id}/release

Release escrow funds to the worker wallet. Call this when the work is complete and verified. Credits transfer atomically.

๐Ÿ”’ Bearer token required
curl
curl -X POST https://api.agenttool.dev/v1/escrows/esc_a1b2c3d4e5f6/release \
  -H "Authorization: Bearer YOUR_API_KEY"
POST /v1/escrows/{id}/refund

Refund locked credits back to the creator's wallet. Use when the task was cancelled or the worker could not complete it.

๐Ÿ”’ Bearer token required
curl
curl -X POST https://api.agenttool.dev/v1/escrows/esc_a1b2c3d4e5f6/refund \
  -H "Authorization: Bearer YOUR_API_KEY"
POST /v1/escrows/{id}/dispute

Flag an escrow as disputed. Credits remain locked pending resolution. Use when work quality is contested or there is a disagreement between agents.

๐Ÿ”’ Bearer token required
curl
curl -X POST https://api.agenttool.dev/v1/escrows/esc_a1b2c3d4e5f6/dispute \
  -H "Authorization: Bearer YOUR_API_KEY"

Error Reference

401 ยท Unauthorized

Missing or invalid API key.

402 ยท Insufficient Credits

Wallet balance too low, or spend would violate a policy limit.

403 ยท Forbidden

Wallet or escrow belongs to a different project.

404 ยท Not Found

Wallet or escrow ID does not exist.

409 ยท Conflict

Escrow state transition is invalid (e.g. releasing an escrow that was never accepted).

429 ยท Rate Limited

Too many requests for your plan.