{
  "info": {
    "name": "AgentKit Public API",
    "description": "Sandbox-ready Postman collection for the AgentKit public API. Every request is wired to the production sandbox at {{baseUrl}} — the only variable you need to set after import is `agentkitApiKey`, which you get from `POST /api/wallets` (the `api_key` field, shown once). Import the companion `agentkit.postman_environment.json` to get the `baseUrl` and `agentkitApiKey` variables pre-wired. The `Sandbox` folder works without a key; every other folder requires `X-API-Key: {{agentkitApiKey}}`.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://agentkit-2.polsia.app" },
    { "key": "agentkitApiKey", "value": "" }
  ],
  "item": [
    {
      "name": "Auth & Wallets",
      "item": [
        {
          "name": "POST /api/wallets",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"agent_id\": \"agent-001\",\n  \"spending_limit_cents\": 100000,\n  \"initial_balance_cents\": 25000,\n  \"allowed_providers\": [\"openai\", \"anthropic\"]\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/wallets", "host": ["{{baseUrl}}"], "path": ["api", "wallets"] }
          },
          "response": [
            {
              "name": "201 Created",
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "header": [{ "key": "Content-Type", "value": "application/json" }],
              "body": "{\n  \"wallet\": {\n    \"id\": 42,\n    \"agent_id\": \"agent-001\",\n    \"spending_limit_cents\": 100000,\n    \"current_balance_cents\": 25000,\n    \"policies\": [\n      { \"provider\": \"openai\", \"daily_limit_cents\": null },\n      { \"provider\": \"anthropic\", \"daily_limit_cents\": null }\n    ]\n  },\n  \"api_key\": \"ak_live_5f3...\",\n  \"warning\": \"Store api_key — it is shown once and cannot be retrieved\"\n}"
            }
          ]
        },
        {
          "name": "GET /api/wallets",
          "request": {
            "method": "GET",
            "header": [{ "key": "X-API-Key", "value": "{{agentkitApiKey}}" }],
            "url": { "raw": "{{baseUrl}}/api/wallets", "host": ["{{baseUrl}}"], "path": ["api", "wallets"] }
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "body": "{\n  \"wallet\": {\n    \"id\": 42,\n    \"agent_id\": \"agent-001\",\n    \"spending_limit_cents\": 100000,\n    \"current_balance_cents\": 24800,\n    \"policies\": [\n      { \"provider\": \"openai\", \"daily_limit_cents\": null }\n    ]\n  }\n}"
            }
          ]
        },
        {
          "name": "PATCH /api/wallets",
          "request": {
            "method": "PATCH",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"spending_limit_cents\": 250000\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/wallets", "host": ["{{baseUrl}}"], "path": ["api", "wallets"] }
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "body": "{\n  \"wallet\": {\n    \"id\": 42,\n    \"agent_id\": \"agent-001\",\n    \"spending_limit_cents\": 250000,\n    \"current_balance_cents\": 24800,\n    \"policies\": []\n  }\n}"
            }
          ]
        },
        {
          "name": "POST /api/wallets/policies",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"providers\": [\n    { \"provider\": \"openai\", \"daily_limit_cents\": 50000 },\n    { \"provider\": \"anthropic\" }\n  ]\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/wallets/policies", "host": ["{{baseUrl}}"], "path": ["api", "wallets", "policies"] }
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "body": "{\n  \"wallet\": {\n    \"id\": 42,\n    \"agent_id\": \"agent-001\",\n    \"spending_limit_cents\": 100000,\n    \"current_balance_cents\": 24800,\n    \"policies\": [\n      { \"provider\": \"openai\", \"daily_limit_cents\": 50000 },\n      { \"provider\": \"anthropic\", \"daily_limit_cents\": null }\n    ]\n  }\n}"
            }
          ]
        },
        {
          "name": "POST /api/wallets/api-key",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"label\": \"rotated-key\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/wallets/api-key", "host": ["{{baseUrl}}"], "path": ["api", "wallets", "api-key"] }
          },
          "response": [
            {
              "name": "201 Created",
              "status": "Created",
              "code": 201,
              "body": "{\n  \"api_key\": \"ak_live_a7b...\",\n  \"warning\": \"Store api_key — it is shown once and cannot be retrieved\"\n}"
            }
          ]
        },
        {
          "name": "POST /api/wallets/:id/credit",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount_cents\": 50000\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/wallets/1/credit", "host": ["{{baseUrl}}"], "path": ["api", "wallets", "1", "credit"] }
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "body": "{\n  \"wallet\": {\n    \"id\": 1,\n    \"agent_id\": \"agent-001\",\n    \"spending_limit_cents\": 100000,\n    \"current_balance_cents\": 74800,\n    \"policies\": []\n  }\n}"
            }
          ]
        },
        {
          "name": "POST /api/v1/wallets/:agentId/fund",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount_cents\": 2500,\n  \"currency\": \"USD\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/v1/wallets/agent-001/fund", "host": ["{{baseUrl}}"], "path": ["api", "v1", "wallets", "agent-001", "fund"] }
          },
          "response": [
            {
              "name": "201 Created",
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "body": "{\n  \"fund_intent_id\": 1234,\n  \"payment_url\": \"https://buy.stripe.com/test_...\",\n  \"amount_cents\": 2500,\n  \"currency\": \"USD\",\n  \"expires_at\": \"2026-07-30T12:00:00.000Z\"\n}"
            },
            {
              "name": "400 amount_mismatch",
              "status": "Bad Request",
              "code": 400,
              "body": "{\n  \"error\": \"amount_mismatch\",\n  \"reason\": \"fund amount must match the configured top-up denomination\",\n  \"expected_amount_cents\": 2500\n}"
            },
            {
              "name": "422 unsupported_currency",
              "status": "Unprocessable Entity",
              "code": 422,
              "body": "{\n  \"error\": \"unsupported_currency\",\n  \"reason\": \"only USD is supported in this version\"\n}"
            }
          ]
        },
        {
          "name": "POST /api/v1/wallets/:agentId/fund/claim",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"session_id\": \"cs_test_a1b2c3...\",\n  \"fund_intent_id\": 1234\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/v1/wallets/agent-001/fund/claim", "host": ["{{baseUrl}}"], "path": ["api", "v1", "wallets", "agent-001", "fund", "claim"] }
          },
          "response": [
            {
              "name": "200 Completed",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "body": "{\n  \"status\": \"completed\",\n  \"replay\": false,\n  \"transaction\": {\n    \"id\": 9876,\n    \"status\": \"approved\",\n    \"amount_cents\": 2500,\n    \"provider\": \"stripe_topup\",\n    \"merchant_ref\": \"fund:1234\",\n    \"idempotency_key\": \"fund:1234\",\n    \"posted_at\": \"2026-07-30T11:42:08.000Z\"\n  },\n  \"balance\": {\n    \"available\": 27500,\n    \"reserved\": 0,\n    \"currency\": \"USD\",\n    \"as_of\": \"2026-07-30T11:42:08.123Z\"\n  }\n}"
            },
            {
              "name": "402 payment_not_verified",
              "status": "Payment Required",
              "code": 402,
              "body": "{\n  \"error\": \"payment_not_verified\",\n  \"reason\": \"stripe session has not been verified yet, retry shortly\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Charges",
      "item": [
        {
          "name": "POST /api/pay",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"provider\": \"openai\",\n  \"amount_cents\": 420,\n  \"idempotency_key\": \"req-001\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/pay", "host": ["{{baseUrl}}"], "path": ["api", "pay"] }
          },
          "response": [
            {
              "name": "201 Approved",
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "body": "{\n  \"status\": \"approved\",\n  \"transaction\": {\n    \"id\": 8801,\n    \"wallet_id\": 42,\n    \"provider\": \"openai\",\n    \"amount_cents\": 420,\n    \"status\": \"approved\",\n    \"blocked_reason\": null,\n    \"idempotency_key\": \"req-001\",\n    \"created_at\": \"2026-07-20T12:00:00.000Z\"\n  },\n  \"balance_cents\": 24380\n}"
            },
            {
              "name": "403 Blocked — provider_not_allowed",
              "status": "Forbidden",
              "code": 403,
              "body": "{\n  \"status\": \"blocked\",\n  \"reason\": \"provider_not_allowed\",\n  \"transaction\": {\n    \"id\": 8802,\n    \"wallet_id\": 42,\n    \"provider\": \"stripe\",\n    \"amount_cents\": 1000,\n    \"status\": \"blocked\",\n    \"blocked_reason\": \"provider_not_allowed\",\n    \"idempotency_key\": null,\n    \"created_at\": \"2026-07-20T12:00:01.000Z\"\n  }\n}"
            }
          ]
        },
        {
          "name": "GET /api/transactions",
          "request": {
            "method": "GET",
            "header": [{ "key": "X-API-Key", "value": "{{agentkitApiKey}}" }],
            "url": {
              "raw": "{{baseUrl}}/api/transactions?provider=openai&status=approved&limit=50&offset=0",
              "host": ["{{baseUrl}}"],
              "path": ["api", "transactions"],
              "query": [
                { "key": "provider", "value": "openai" },
                { "key": "status", "value": "approved" },
                { "key": "limit", "value": "50" },
                { "key": "offset", "value": "0" }
              ]
            }
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "body": "{\n  \"transactions\": [\n    {\n      \"id\": 8801,\n      \"wallet_id\": 42,\n      \"provider\": \"openai\",\n      \"amount_cents\": 420,\n      \"status\": \"approved\",\n      \"blocked_reason\": null,\n      \"idempotency_key\": \"req-001\",\n      \"created_at\": \"2026-07-20T12:00:00.000Z\"\n    }\n  ],\n  \"limit\": 50,\n  \"offset\": 0\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Transfers",
      "item": [
        {
          "name": "POST /api/v1/wallet/transfer",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"from_wallet_id\": 1,\n  \"to_wallet_id\": 2,\n  \"amount_cents\": 1500,\n  \"idempotency_key\": \"xfer-001\",\n  \"description\": \"settle invoice 42\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/v1/wallet/transfer", "host": ["{{baseUrl}}"], "path": ["api", "v1", "wallet", "transfer"] }
          },
          "response": [
            {
              "name": "201 Completed",
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "body": "{\n  \"status\": \"completed\",\n  \"transfer_id\": 9017,\n  \"from_wallet_id\": 1,\n  \"to_wallet_id\": 2,\n  \"amount_cents\": 1500,\n  \"description\": \"settle invoice 42\",\n  \"from_balance_cents\": 8500,\n  \"to_balance_cents\": 11500,\n  \"idempotency_key\": \"xfer-001\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Subscriptions & Webhooks",
      "item": [
        {
          "name": "POST /api/v1/webhooks",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"https://example.com/agentkit-hook\",\n  \"events\": [\"fund_received\", \"charge_sent\", \"balance_low\"]\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/v1/webhooks", "host": ["{{baseUrl}}"], "path": ["api", "v1", "webhooks"] }
          },
          "response": [
            {
              "name": "201 Created",
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "body": "{\n  \"webhook\": {\n    \"id\": 7,\n    \"url\": \"https://example.com/agentkit-hook\",\n    \"events\": [\"fund_received\", \"charge_sent\", \"balance_low\"],\n    \"is_active\": true\n  },\n  \"signing_secret\": \"a3f1c8...64hex\",\n  \"warning\": \"Store signing_secret — it is shown once and cannot be retrieved\"\n}"
            }
          ]
        },
        {
          "name": "GET /api/v1/webhooks",
          "request": {
            "method": "GET",
            "header": [{ "key": "X-API-Key", "value": "{{agentkitApiKey}}" }],
            "url": { "raw": "{{baseUrl}}/api/v1/webhooks", "host": ["{{baseUrl}}"], "path": ["api", "v1", "webhooks"] }
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "body": "{\n  \"webhooks\": [\n    {\n      \"id\": 7,\n      \"url\": \"https://example.com/agentkit-hook\",\n      \"events\": [\"fund_received\", \"charge_sent\", \"balance_low\"],\n      \"is_active\": true,\n      \"created_at\": \"2026-07-20T11:30:00.000Z\"\n    }\n  ]\n}"
            }
          ]
        },
        {
          "name": "POST /api/v1/webhooks/test",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-API-Key", "value": "{{agentkitApiKey}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"event\": \"test\"\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/v1/webhooks/test", "host": ["{{baseUrl}}"], "path": ["api", "v1", "webhooks", "test"] }
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "body": "{\n  \"dispatched\": 1,\n  \"results\": [{ \"webhook_id\": 7, \"url\": \"https://example.com/agentkit-hook\" }]\n}"
            }
          ]
        },
        {
          "name": "DELETE /api/v1/webhooks/:id",
          "request": {
            "method": "DELETE",
            "header": [{ "key": "X-API-Key", "value": "{{agentkitApiKey}}" }],
            "url": { "raw": "{{baseUrl}}/api/v1/webhooks/7", "host": ["{{baseUrl}}"], "path": ["api", "v1", "webhooks", "7"] }
          },
          "response": [
            {
              "name": "204 No Content",
              "status": "No Content",
              "code": 204,
              "body": ""
            }
          ]
        }
      ]
    },
    {
      "name": "Sandbox",
      "item": [
        {
          "name": "GET /api/v1/sandbox/balance",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/api/v1/sandbox/balance", "host": ["{{baseUrl}}"], "path": ["api", "v1", "sandbox", "balance"] }
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "body": "{\n  \"wallet\": {\n    \"id\": 99,\n    \"agent_id\": \"sandbox-agent\",\n    \"spending_limit_cents\": 50000,\n    \"current_balance_cents\": 12345,\n    \"policies\": [\n      { \"provider\": \"openai\", \"daily_limit_cents\": null },\n      { \"provider\": \"anthropic\", \"daily_limit_cents\": null }\n    ]\n  },\n  \"sandbox\": true\n}"
            }
          ]
        },
        {
          "name": "POST /api/v1/sandbox/simulate",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"provider\": \"openai\",\n  \"amount_cents\": 250\n}"
            },
            "url": { "raw": "{{baseUrl}}/api/v1/sandbox/simulate", "host": ["{{baseUrl}}"], "path": ["api", "v1", "sandbox", "simulate"] }
          },
          "response": [
            {
              "name": "201 Approved (sandbox)",
              "status": "Created",
              "code": 201,
              "_postman_previewlanguage": "json",
              "body": "{\n  \"status\": \"approved\",\n  \"transaction\": {\n    \"id\": 81234,\n    \"wallet_id\": 99,\n    \"provider\": \"openai\",\n    \"amount_cents\": 250,\n    \"status\": \"approved\",\n    \"blocked_reason\": null,\n    \"idempotency_key\": null,\n    \"created_at\": \"2026-07-20T12:05:00.000Z\"\n  },\n  \"balance_cents\": 12095,\n  \"sandbox\": true\n}"
            }
          ]
        }
      ]
    }
  ]
}
