> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.eraus.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Events and logs

> Read joins, kills, commands, mod calls and 000 calls, with a cursor so you never miss one.

Everything that happens in the server is stored as an event for **7 days** (up to the newest 5,000 per server). Logs keep working while the server is offline.

## The feed

[`GET /v1/server/events`](https://apidocs.eraus.gg/api/events) returns every event type. The log endpoints return one kind each:

| Endpoint | Event types |
| - | - |
| `/v1/server/logs/joins` | `player.join`, `player.leave` |
| `/v1/server/logs/kills` | `player.kill` |
| `/v1/server/logs/commands` | `staff.command`, `api.command` |
| `/v1/server/logs/modcalls` | `modcall.open`, `modcall.claim` |
| `/v1/server/logs/calls` | `emergency.call` |

Event types and their `data` are the same as for [webhooks](https://apidocs.eraus.gg/webhooks.md#event-data).

## Following new events

Every event has an `id` that goes up by one. Remember the last one you saw and ask for anything after it:

```bash theme={null}
curl "https://api.eraus.gg/v1/server/events?after=4183&limit=100" \
  -H "Authorization: Bearer $ERA_KEY"
```

```json theme={null}
{
  "data": [
    { "id": 4184, "type": "player.join", "timestamp": 1793875470, "data": { "player": { "id": 77123, "name": "sam_rp" } } }
  ],
  "nextCursor": null
}
```

With `after`, results come oldest first. If you get exactly `limit` events back, there may be more, so ask again with the last `id`. Polling every 10 seconds this way never misses or repeats an event.

## Paging back

Without `after`, results come newest first. To go further back, pass the oldest `id` you have as `before`:

```bash theme={null}
curl "https://api.eraus.gg/v1/server/logs/kills?before=3900&limit=50" \
  -H "Authorization: Bearer $ERA_KEY"
```

`nextCursor` is the `id` to pass as `before` for the next page, or `null` when there's nothing older.

## Parameters

| Parameter | Default | |
| - | - | - |
| `limit` | `50` | 1 to 100. |
| `after` | | Only events newer than this id, oldest first. |
| `before` | | Only events older than this id, newest first. |
| `types` | all | `/events` only. Comma separated, such as `player.kill,modcall.open`. |

## What gets logged

* Joins and leaves for every player.
* Every death. `killer` is set when another player hurt them in the 15 seconds before.
* Staff commands from chat and the console, plus every API command and its result.
* Mod calls when opened and when a staff member responds.
* Every new MDT call: 000 calls from players and automatic alerts (robberies, pursuits, crashes, fires).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.