Web API
API Endpoints
All endpoints require Authorization: Bearer <session token> unless noted otherwise. Each request is held to the permissions of the player the session belongs to (see Dashboard Roles).
| Endpoint | Description |
|---|---|
GET /api/lang | Dashboard strings in the configured language (public, rate limited) |
GET /api/auth | Whose session the token opens, and what it may open and do |
GET /api/modules | The web modules the session may open, and the descriptors of their pages |
GET /api/metrics | Server name, uptime, players and TPS. Public if metrics-public: true; versions, memory, storage and cache figures are added only for an authenticated caller. |
GET /api/players | Player list, searchable and paged. Needs xcore.dashboard.players |
GET /api/head/<name>.png | A player's face, fetched once by the server and cached, so the browser never calls a third party (public, limited per address; a face being fetched never holds up the rest of the dashboard) |
GET /api/sprite/<material>.png | An item's icon, drawn once by the server from the item's model, as the inventory shows it, and kept on disk (public, limited per address). Without the icon (still being drawn, or the mirror out of reach) the answer is a 404 with Cache-Control: no-store: the dashboard shows a stand-in and asks again on the next view |
GET /api/items | Every item of the server, with the key of its name in the game's language files, for a form that picks one (2.1) |
GET /api/currencies | The currencies a price can be set in, and the default one (2.1) |
GET/POST /api/<module>/config/raw | Read or replace a module's config.yml. The YAML is parsed before anything is written, and the plugin is reloaded after. Reading needs xcore.dashboard.config, and secrets come as <hidden>; saving also needs xcore.dashboard.config.save and the module's save permission, and is logged with its author. |
Each plugin registers its own routes under /api/<name>/. For example, XBans provides /api/xbans/... and XLogin provides /api/xlogin/....
A request that lacks a permission is answered 403, with the permission named:
{"error":"Missing permission: xbans.ban","permission":"xbans.ban","anyOf":["xbans.ban"]}
Inside those handlers, sessionOwner(exchange) on the web panel gives the name of the player whose session the request carries, so an action taken from the dashboard is recorded under the admin who took it.
Authentication
Run /xcore dashboard in game (it needs xcore.dashboard) and take the token out of the link it gives you:
curl -H "Authorization: Bearer YOUR_SESSION_TOKEN" http://localhost:8085/api/modules
The token acts with the permissions of the player who asked for it. Revoke it with /xcore dashboard revoke when the script is retired. Tokens expire after session-ttl-hours (a week at most), and sooner once their owner has been away from the server for offline-trust-hours.
Never expose the dashboard port publicly without a reverse proxy (nginx, Caddy) and HTTPS.