osrs-data-hub
Events

Event cursor feed, or the events of a time range

GET
/events

Loot, level-ups, deaths, collection log, diaries, combat tasks and superiors of the accounts whose events the key may read, ordered by the order the hub stored them, for the Discord bot and Home Assistant automations.

Cursor semantics. Start with cursor=now (no events, just the current cursor) or without a cursor (the newest limit events, default 100, at most 500). Then always pass the previous meta.next_cursor: you get the events after it, oldest first, and a new cursor. Fewer than limit events means "caught up for now". The cursor always moves forward, also past events your filters leave out, and is unchanged while nothing new has arrived. Cursors are opaque; keep them as strings.

The feed only serves events stored at least 10 s ago, so a cursor can never skip an event that is still being committed: expect an event 10–15 s after the hub received it. occurred_at is when it happened in game, received_at when the hub got it (the plugin may resend events up to ~10 minutes late).

Time range. With from and/or to the request reads history instead of following the feed: the events with occurred_at from from to to (both included; to defaults to now, from to 30 days before to), newest first, with the same accounts, filters, limit and event shape. meta.next_cursor is the cursor of the next (older) page, or null when the page is the range’s last; pass it as cursor with the same from, to and filters. Pages are keyed on the event’s time and storage order, so every event is visited once, events of the same instant included, whatever arrives meanwhile. There is no settle margin here: an event can appear a few seconds before the feed serves it, and one that arrives late in a stretch already paged isn’t revisited. The two modes have different cursors: cursor=now or a feed cursor with from/to, or a range cursor without them, is a 400.

Authorization

bearerAuth
AuthorizationBearer <token>

An API key from the hub’s API keys page.

In: header

Query Parameters

cursor?string

Without from/to: omitted, the newest limit events and a cursor after them; now, no events, only the current cursor (start following from here); otherwise a meta.next_cursor from an earlier response, for the events after it, oldest first. With from/to: omitted for the first (newest) page, then the previous page’s meta.next_cursor. Cursors are opaque, and one mode’s cursor is a 400 in the other.

types?string

Comma-separated event types: loot, pk_loot, death, level_up, collection_log, superior_spawn, achievement_diary, combat_task, slayer_task_assigned, slayer_task_complete, or an unknown plugin type as sent. Default: every type.

accounts?string

Comma-separated account ids (at most 100); each must be one whose events the key may read, else 404. Default: every such account.

min_value?string

Only events with value_gp ≥ this (events without a value are left out).

Match^\d{1,16}$
item?string

Only loot and pk_loot events with an item whose name contains this, case-insensitive: any item of the drop, not only item_id. A hub from before this parameter ignores it.

npc?string

Only loot and pk_loot (the drop’s source), death (the killer) and superior_spawn events whose NPC name contains this, case-insensitive.

limit?string

Events per page, 1 to 500. Default 100.

Match^\d{1,16}$
from?string

With from and/or to, the request reads a time range instead of following the feed: the events with occurred_at from from to to (both included), newest first. Default: to − 30 days.

Formatdate-time
to?string

End of the range (ISO-8601 date-time). Default: now.

Formatdate-time

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/events?types=loot%2Clevel_up&item=Tumeken&npc=Zulrah"
{  "data": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "type": "string",      "account": {        "id": "string",        "name": "string"      },      "occurred_at": "2019-08-24T14:15:22Z",      "received_at": "2019-08-24T14:15:22Z",      "value_gp": 0,      "item_id": 0,      "npc_id": 0,      "skill": "string",      "level": 0,      "tier": "string",      "points": 0,      "special_world": true,      "data": {        "property1": null,        "property2": null      },      "title": "string",      "line": "string"    }  ],  "meta": {    "generated_at": "2019-08-24T14:15:22Z",    "count": 0,    "next_cursor": "string"  }}