osrs-data-hub

API overview

Authentication, conventions, limits and errors of the hub's read-only REST API (v1).

A read-only JSON API over the OSRS account data your guild's RuneLite plugins send to the hub. It is pull-only: poll /snapshot and follow the /events cursor feed. There are no webhooks.

This reference follows the newest hub. An older hub ignores parameters it doesn't know and answers 404 not_found on endpoints it doesn't have; its own /openapi.json says what it serves.

  • Base URL: https://<your hub>/api/v1
  • OpenAPI 3.1 document: https://<your hub>/api/v1/openapi.json (public), or the copy on this site
  • On your hub: an interactive reference at https://<your hub>/docs/api

The pages in this section are generated from the hub's OpenAPI document. Each one lists parameters and response schemas, and has a playground.

Using the playground

Set the hub server variable to your hub's origin (such as https://hub.example.com) and paste an API key. Your browser then calls your hub directly: the key goes only from your browser to your hub, not to this site. The hub allows this because every API response carries Access-Control-Allow-Origin: *.

Authentication

Send a key on every request:

GET /api/v1/me
Authorization: Bearer ohub_<prefix>_<secret>

Members create keys on API keys, admins create integration keys on Admin → Integrations. See Which key?. Cookies are ignored.

These all get the same 401 unauthorized with WWW-Authenticate: Bearer: a missing, malformed, unknown, revoked or expired key, or a key whose creator left the guild.

POST /mcp also takes the hub's own sign-in token (ohat_…) of an assistant that connected by signing in, such as Claude.ai. It acts as the key the member's Allow made, and no other endpoint takes it. See AI assistant.

What a key can read is worked out on every request: its categories, its accounts, and what its creator can see right now. An integration key reads what the guild audience sees, and it alone can ask /members/{discord_id} whether a Discord account is a member of the hub.

Conventions

  • Success: { "data": …, "meta": { "generated_at": "…" } }. Lists add meta.count.
  • Errors: { "error": { "code": "…", "message": "…" } }. A 400 adds details: [{ path, message }].
  • Names: every key the hub defines is snake_case. Data passes through unchanged: skill names ("Attack"), equipment slots, item and account names, and an event's data object (the plugin's own camelCase).
  • Timestamps are ISO-8601 UTC. Ids are opaque strings.
  • Query parameters: lists are comma-separated (skills=attack,defence), dates are ISO-8601 with Z or an offset, booleans are true/false. Unknown parameters are ignored.
  • Evolution: v1 only changes additively. Ignore fields you don't know.
  • Not found vs not readable: anything the key can't read answers 404 not_found, exactly like an unknown id.
  • Omitted vs not shared: on /accounts/{id} and /snapshot, a section the key can't read is left out. A section the key may read but the plugin never sent is { "shared": false, "updated_at": null } on /accounts/{id}, or null on /snapshot.
  • Stale locations: a live location older than 2 minutes has stale: true.
  • Ranges: from and to select a period on the history endpoints. to defaults to now; from defaults to 30 days before to, and to 24 hours before it on the location trails.

Rate limits

LimitValueOn excess
Per key, all endpoints120 requests per sliding minute for a personal key; 600 (or what the admin set) for an integration key429 rate_limited with Retry-After
Per key, /snapshot1 request per second429 with Retry-After: 1
Failed authentications per client IP30 per minuteevery request from that IP gets 429 until the window passes

Every authenticated response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds until a request frees up, not a timestamp). Retry-After is always whole seconds, and a 304 counts too.

Caching

Cache-Control: no-store everywhere, except:

  • /snapshot: private, no-cache with a weak ETag. Send it back as If-None-Match to get 304.
  • /openapi.json: public, max-age=300.
  • /regions.json: public, max-age=86400. The names only change with a hub release.

Errors

StatuscodeWhen
400invalid_requesta malformed or out-of-range parameter (details names it)
401unauthorizedno valid key
404not_foundan unknown or unreadable account, or an unknown path (which /members/{discord_id} is for a personal key)
429rate_limitedover a limit; wait Retry-After seconds
503unavailablethe hub is busy or its database is unreachable; retry after Retry-After
500internal_errora bug; nothing about it is revealed
{"error":{"code":"invalid_request","message":"The request is invalid.","details":[{"path":"from","message":"must be an ISO-8601 date-time with Z or an offset"}]}}

Endpoints

EndpointCategoryWhat it returns
GET /meanythe key, its creator and how many accounts it sees
GET /accountsthe visible accounts, filterable by names, ids, online
GET /accounts/{id}per sectionone account's current state
GET /snapshotper fieldevery visible account's current state, for polling
GET /accounts/{id}/xp, GET /xpstatsXP series of one or several accounts
GET /accounts/{id}/gainsstatsXP gained per skill over a period
GET /eventseventsthe events cursor feed, or with from/to the events of a time range; item/npc search drops and NPCs
GET /accounts/{id}/sessionsactivityplay sessions
GET /accounts/{id}/equipment-historyequipmentevery change of the worn set
GET /accounts/{id}/wealthinventorywealth per day: bank, inventory and gear
GET /accounts/{id}/locations, GET /locationslocation_historylocation trails: every tile visited, how the player got to each, and the place's name
GET /accounts/{id}/dayper sectionone account's day, or up to 7, in one call: sessions, gains, events, places
GET /accounts/{id}/progressper sectionthe Progress page for a range: time online and active, where the time went, XP per skill, loot, boss kills gained, the change in wealth, goals
GET /accounts/{id}/hiscores, GET /hiscoreshiscoreswhat the hub last read from the official hiscores
GET /accounts/{id}/collection-logevents or hiscoresan account's collection log: the total and the slots the hub saw
GET /collection-logevents or hiscoresthe guild's collection log, and with item who has it
GET /leaderboards/gainsstatstop 10 gainers per skill
GET /leaderboards/looteventsthe most valuable drops of a period
GET /leaderboards/killshiscorestop 10 per boss by kills gained over 7 or 30 days
GET /members/{discord_id}none; integration keys onlywhether a Discord account is a member of the hub, and an admin
POST /mcpthe key'sthe hub as an MCP server for AI assistants; see AI assistant
GET /regions.jsonnonethe place names behind region
GET /openapi.jsonnonethe OpenAPI document

Pick an endpoint in the sidebar for its parameters, response schema and playground.

Events: feed or time range

GET /events reads in one of two ways.

  • The feed (no from or to) is for following events as they happen: start with cursor=now, then keep passing meta.next_cursor. Events come oldest first, and next_cursor is always a string. Build your own walks through it.
  • A time range (from, to or both) answers "what happened between A and B". You get the newest limit events whose occurred_at lies in the range, newest first. meta.next_cursor is the cursor of the next, older page, or null on the last one; pass it with the same from, to and filters.

The two kinds of cursor don't mix: a feed cursor (or cursor=now) together with from/to, and a range cursor without them, are a 400. The feed holds events back 10–15 seconds until their write has settled; a range doesn't, so an event can show up there a few seconds earlier.

Location trails

With HA Exporter 1.6 or newer, a trail has a point for every tile the player was on: one per game tick (0.6 s) on which the tile, plane or boat state changed. An older plugin, and a player standing still, give one point a minute. Trails are kept for 30 days and returned oldest first.

Each point's via says how the player got there from the point before. Only move is a line to draw.

viaWhat happened
moveWalked, ran or sailed. Stairs are a move to another plane.
entranceInto or out of the underground (a cave, a dungeon, a basement).
houseFrom one room of a player-owned house to the next; the coordinates jump although the player walked.
instanceFrom one room to the next inside the Gauntlet, the Corrupted Gauntlet or the Chambers of Xeric, where the coordinates jump as they do in a player-owned house.
teleportAnything else that wasn't walked.
gapMore than 5 minutes since the point before: nothing is known about the time in between.
nullThe first point, when the one before it lies before from.
  • New labels: more may be added. Treat one you don't know as not walked.
  • Limits: one trail carries at most 20,000 points, the newest ones. truncated: true means older points were left out; ask again with to set to the first point's at. GET /locations shares 100,000 points equally between its accounts, so with more than 5 accounts a trail is cut sooner.
  • Thinning: via belongs to a pair of points. When you thin a trail, keep both points of every step that isn't a move.
  • Following a trail: ask with from set to the last point's at, and expect overlap. A late message can add points up to 15 minutes back.

On this page