Skip to content
Web API

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).

EndpointDescription
GET /api/langDashboard strings in the configured language (public, rate limited)
GET /api/authWhose session the token opens, and what it may open and do
GET /api/modulesThe web modules the session may open, and the descriptors of their pages
GET /api/metricsServer 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/playersPlayer list, searchable and paged. Needs xcore.dashboard.players
GET /api/head/<name>.pngA 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>.pngAn 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/itemsEvery 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/currenciesThe currencies a price can be set in, and the default one (2.1)
GET/POST /api/<module>/config/rawRead 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.