# Get the audit log

Source: https://langbot.ai/docs/api/bots/get-audit-log

`GET /v1/bots/audit`

Who created or revoked report tokens, linked wallets, and changed bots and alerts on your account, newest first.

**Auth.** An account token (`Authorization: Bearer lb_…`) or a signed-in web session. A report-only token (`lbr_…`) is refused here with `403 scope_denied`.

**Limits.** Counts against your plan's API requests (60, 600 or 3,000 a minute on Free, Builder and Standard).

## Parameters

### Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `limit` | integer | no | How many entries. 1 to 200. Default `50`. |

## Request

**curl**

```bash
curl "https://api.langbot.ai/v1/bots/audit?limit=2" \
  -H "Authorization: Bearer $LANGBOT_API_TOKEN"
```

**Python**

```python
from langbot import LangbotClient

async with LangbotClient() as lb:  # reads LANGBOT_API_TOKEN
    for e in await lb.bots.audit(limit=20):
        print(e["at"], e["actor"], e["action"], e["target"])
```

**TypeScript**

```ts
import { LangbotClient } from "@langbotai/sdk";

const lb = new LangbotClient(); // reads LANGBOT_API_TOKEN
const entries = await lb.bots.audit({ limit: 20 });
```

## Response

`200 OK`

```json
{
  "entries": [
    {
      "id": 9,
      "actor": "session",
      "action": "alerts.update",
      "target": "bot_01M6G72RFQRQ8JGNG8T1447GGP",
      "meta": {
        "rules": [
          "daily_loss_usd",
          "drift",
          "email",
          "halted",
          "heartbeat_missing_min",
          "webhook_url"
        ],
        "secret_rotated": true
      },
      "ip": "127.0.0.1",
      "at": 1793693150804
    },
    {
      "id": 8,
      "actor": "session",
      "action": "wallet.link",
      "target": "bw_01M6G72VJ4YE3V9SPJRKD7NK0W",
      "meta": {
        "chain": "polygon",
        "bot_id": "bot_01M6G72RFQRQ8JGNG8T1447GGP",
        "address": "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"
      },
      "ip": "127.0.0.1",
      "at": 1793693150791
    }
  ]
}
```

`actor` is `session` for the web app, else the id of the API token used. Entries are append-only and never hold a secret.

## Errors

| Status | `code` | When |
|---|---|---|
| 401 | `auth_required` | No token was sent. |
| 401 | `token_invalid` | The token was not recognised (mistyped, revoked or expired). |
| 422 | `validation_error` | A parameter failed validation; `detail[].loc` names it. |
| 429 | `rate_limited` | Over your request budget; wait `Retry-After` seconds. |

Every error body is `{"detail": …, "code": "…"}`; branch on `code`. All codes: [Errors](https://langbot.ai/docs/api#errors).
