// 5-step curl walkthrough — proven end-to-end agent payment flow

Quickstart

Five curl calls: provision, fund, reserve, commit, verify. No SDK. No setup beyond a terminal.

base url https://agentkit-2.polsia.app
01

Provision a wallet

No auth needed. Give your agent an ID, a spending cap, an initial balance, and an allowed-provider list. Save the returned api_key — it is shown once.

curl -X POST https://agentkit-2.polsia.app/api/wallets \n
  -H "Content-Type: application/json" \n
  -d '{
    "agent_id": "my-agent-001",
    "spending_limit_cents": 50000,
    "initial_balance_cents": 10000,
    "allowed_providers": ["openai"]
  }'
→ Response
{
  "wallet": {
    "id": 12,
    "agent_id": "my-agent-001",
    "spending_limit_cents": 50000,
    "current_balance_cents": 10000,
    "reserved_balance_cents": 0,
    "policies": [{ "provider": "openai" }]
  },
  "api_key": "ak_live_xxxxxxxx",
  "warning": "Store api_key — it is shown once and cannot be retrieved"
}
02

Fund it

Add cents to the wallet you just created. Use your new api_key (stored as API_KEY in the shell from here on). Substitute the real wallet.id from step 01 for :id.

curl -X POST https://agentkit-2.polsia.app/api/wallets/:id/credit \n
  -H "Content-Type: application/json" \n
  -H "X-API-Key: ak_live_xxxxxxxx" \n
  -d '{ "amount_cents": 5000 }'
→ Response
{
  "wallet": {
    "id": 12,
    "agent_id": "my-agent-001",
    "spending_limit_cents": 50000,
    "current_balance_cents": 15000,
    "reserved_balance_cents": 0,
    "policies": [{ "provider": "openai" }]
  }
}
03

Reserve funds

Pre-authorize a charge by moving amount_cents from available into reserved. The reservation has a TTL — if you don't commit it in time, the hold releases automatically. The idempotency_key keeps a retry from creating a second reservation.

curl -X POST https://agentkit-2.polsia.app/api/v1/wallets/my-agent-001/reservations \n
  -H "Content-Type: application/json" \n
  -H "X-API-Key: ak_live_xxxxxxxx" \n
  -d '{
    "amount_cents": 2000,
    "currency": "USD",
    "ttl_seconds": 300,
    "memo": "pre-auth openai",
    "idempotency_key": "rsv-quickstart-01"
  }'
→ Response
{
  "reservation_id": 1,
  "status": "active",
  "replay": false,
  "amount_cents": 2000,
  "currency": "USD",
  "memo": "pre-auth openai",
  "idempotency_key": "rsv-quickstart-01",
  "expires_at": "2026-08-10T12:05:00.000Z",
  "balance": {
    "available": 13000,
    "reserved": 2000,
    "currency": "USD",
    "as_of": "2026-08-10T12:00:00.000Z"
  }
}
04

Commit the reservation

Finalize the hold. The reserved amount is deducted from your real balance and a ledger row with provider="reservation_commit" is written. The reservation_id in the URL is idempotent — replaying commit returns the same transaction.

curl -X POST https://agentkit-2.polsia.app/api/v1/wallets/my-agent-001/reservations/1/commit \n
  -H "X-API-Key: ak_live_xxxxxxxx"
→ Response
{
  "reservation_id": 1,
  "status": "committed",
  "replay": false,
  "transaction_id": 101,
  "balance": {
    "available": 13000,
    "reserved": 0,
    "currency": "USD",
    "as_of": "2026-08-10T12:00:05.000Z"
  }
}
05

Verify via transaction history

Filter the ledger by provider=reservation_commit. The row written in step 04 appears with idempotency_key="reservation:<id>" — the same key is a replay deduper so audit trails stay clean.

curl "https://agentkit-2.polsia.app/api/transactions?provider=reservation_commit" \n
  -H "X-API-Key: ak_live_xxxxxxxx"
→ Response
{
  "transactions": [
    {
      "id": 101,
      "wallet_id": 12,
      "provider": "reservation_commit",
      "amount_cents": 2000,
      "status": "approved",
      "idempotency_key": "reservation:1"
    }
  ],
  "limit": 50,
  "offset": 0
}

Need to verify incoming webhooks? See the HMAC signature & retry guide →