# The event log

`GET /events`

Requires the `businesses` scope.

Everything that happened under your key, newest first, whether or not a webhook was subscribed at the time. The place to reconcile after an outage on your side: page back with `before`, act on what you missed. Kept for the same retention as deliveries (30 days by default). With a Connect access token, the connected business's events only: also where an automation platform reads sample data for a trigger.

## Query parameters

| Name | Type | | Description |
|---|---|---|---|
| `businessId` | string |  | Only one business under your key. |
| `event` | string |  | Only one event type. One of: `document.issued`, `document.pdf_ready`, `document.allocation_assigned`, `document.paid`, `expense.recorded`, `export.completed`, `recurring.ran`, `quote.sent`, `quote.accepted`, `quote.declined`, `business.status_changed`, `connection.created`, `connection.revoked`, `ita.connected`, `ita.disconnected`, `ita.expiring`, `ita.expired`. |
| `before` | string |  | Time cursor: events created strictly before this instant. Page by passing the last row's `createdAt`. |
| `limit` | integer |  |  Default `50`. |

## Response

`200`: `{ "ok": true, … }`

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `events` | array of Event | **required** |  |

Errors: `400`, `401`, `403`, `404`, `429`. Every failure answers `{ "error", "reason", "hint", "param", "doc_url", "retryable", "request_id" }`: branch on `reason`, and read `hint` for what to change (https://docs.billos.co.il/errors.md).

## Examples

### cURL

```bash
curl -X GET "$BASE/events?businessId=&event=&before=" \
  -H "X-Api-Key: $KEY"
```
### Node

```node
const res = await fetch(`${BASE}/events`, {
  method: 'GET',
  headers: {
    'X-Api-Key': KEY,
  },
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.get(
    f"{BASE}/events",
    headers={"X-Api-Key": KEY},
)
data = res.json()
```