# An agent's spent and left

Source: https://immiscible.fly.dev/docs/api/get-api-w-wid-agents-aid-money

`GET /api/w/:wid/agents/:aid/money`

What the agent has spent and has left. `ai` is its AI spend this month against its own budget, in micro-dollars (`budgetMicros`, `usedMicros`, `leftMicros`, with `periodStart` and `periodEnd`); it is `null` when the agent has no budget. `payments` has one entry per active payment rule: `limit`, `used` and `left` in minor units, and `resetsAt`. `increase` is a temporary increase waiting for an owner, or `null`, and `canAskIncrease` says whether the caller may ask for one.

This response is from Amethyst, the made-up demo company:

## Authentication

Session cookie. A signed-in person: the console's session cookie. Every state-changing request also carries the header `x-immiscible-csrf: 1`, and the member's role decides what it may do. Bearer tokens are ignored on these routes, so no machine credential can reach them.

## Path parameters

- `wid` (string, required): Workspace id
- `aid` (string, required): Agent id

## Request

curl:

```bash
curl "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/agents/agt_4f2c91a7/money" \
  -H "cookie: __Host-sid=$IMMISCIBLE_SESSION"
```

Node:

```ts
const res = await fetch('https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/agents/agt_4f2c91a7/money', {
  headers: {
    cookie: `__Host-sid=${process.env.IMMISCIBLE_SESSION}`,
  },
});
const data = await res.json();
console.log(res.status, data);
```

Python:

```python
import os
import requests

res = requests.get(
    "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/agents/agt_4f2c91a7/money",
    headers={
        "cookie": f"__Host-sid={os.environ['IMMISCIBLE_SESSION']}",
    },
)
print(res.status_code, res.json())
```

## Response

```json
{
  "agentId": "agt_429a3259974ce55fa2f07026",
  "ai": {
    "budgetMicros": 331910000,
    "usedMicros": 40987356,
    "leftMicros": 290922644,
    "utilisation": 0.1235,
    "periodStart": "2026-10-01T00:00:00.000Z",
    "periodEnd": "2026-11-01T00:00:00.000Z",
    "owner": "priya@amethyst.example"
  },
  "payments": [
    { "mandateId": "mdt_8d73c92504af05703cd16564", "title": "Supplier invoices", "currency": "GBP", "period": "month", "limit": 20000000, "used": 480000, "left": 19520000, "resetsAt": "2026-11-01T00:00:00.000Z" }
  ],
  "increase": null,
  "canAskIncrease": true
}
```
