API keys and the REST API
Create an API key, choose what it may do, and make the first request to /api/v1 with curl.
By the end of this page you will have an API key and the first answer from the site's REST API. A key is for a bot, a script or your own service that reads and changes site data. A game server does not use a key; it connects with a GameLink token, see connecting a server.
Only the site owner creates keys (the admin.boss permission).
Create a key
Open the keys page
Open AdminDeveloperAPI access and click "Create API key". The "Developer" section of the sidebar is collapsed by default.

Name the key and choose its access
In "Name", write who will use the key, for example "Discord bot". Key names are unique.
In "What the key may do", choose "Read only", "Full access" or "Custom". "Full access" lets the key change everything you can change. "Custom" opens a table of resources where each one gets "No access", "Read" or "Read + write". You cannot give a key more than you have yourself: such rows are not in the table.
Copy the key
Click "Create API key". A "Copy the API key now" card appears with the key and a copy button. The key is shown once; the site stores only its hash.
The key is lost
You cannot view it again. Click "Regenerate" on the key: you get a new one, and the old one stops working at once.
First request
The key goes in the Authorization header after the word Bearer. There is no other way to pass it. A request to the API root works with any active key and shows what that key can reach:
curl -H "Authorization: Bearer <KEY>" https://<YOUR_DOMAIN>/api/v1{"data":{"version":"v1","granted_scopes":["servers:read"],"config_namespaces":[],"resources":["servers"]},"meta":{},"errors":[]}The server list needs servers:read. curl reads the square brackets in filter[...] as a glob, so add the -g flag:
curl -g -H "Authorization: Bearer <KEY>" "https://<YOUR_DOMAIN>/api/v1/servers?per_page=10&sort=name&filter[enabled]=1"{"data":[{"id":1,"name":"Public #1","ip":"203.0.113.10","port":27015,"mod":"730","display_ip":null,"panel_connection_id":null,"panel_identifier":null,"ranks":"default","ranks_premier":false,"ranks_format":"webp","proxies":null,"enabled":true}],"meta":{"page":1,"per_page":10,"total":1},"errors":[]}The server's RCON password never appears in a response.
401 invalid_token
The key is unknown, disabled or regenerated. Check that you copied all of it and that the key shows "Key is active" in the admin panel.
403 insufficient_scope
The key lacks a scope, and the response names it: This key is missing the required scope 'servers:read'. Open the key in the admin panel and give it access to that resource.
Key scopes
A scope is written as <resource>:read or <resource>:write. Write includes read. The core resources:
| Resource | What it holds | Write |
|---|---|---|
users | users | yes |
roles | roles | yes |
servers | game servers | yes |
players | players | no |
currencies | currencies | yes |
payment-gateways | payment providers | yes |
promocodes | promo codes | yes |
pages | pages | yes |
navbar-items, footer-items | menu and footer | yes |
redirects | redirects | yes |
notification-templates | notification templates | yes |
modules | modules | no |
Writing to a core resource means a PATCH of an existing record only. The core does not let the API create or delete records.
Site settings are split into the groups config.app, config.assets, config.auth, config.lang, config.lk, config.mail, config.profile and config.search. Some fields are marked sensitive: to change them, a key also needs config.sensitive:write. In the key table it is called "Security settings (debug, CSRF, 2FA, payment checks)", and "Full access" does not include it.
Modules add their own resources, and their scopes show up in the key table by themselves.
Reference
| Method | Path | What it does |
|---|---|---|
GET | /api/v1 | what the key can reach |
GET | /api/v1/resources | resources with their fields, filters and sorts |
GET | /api/v1/{resource} | a list |
GET | /api/v1/{resource}/{id} | one record |
PATCH | /api/v1/{resource}/{id} | change a record |
GET | /api/v1/config | settings groups the key can read |
GET, PATCH | /api/v1/config/{group} | read or change a settings group |
POST | /api/v1/actions/{capability}/{method} | call an action, body {"args":{…}} |
GET | /api/v1/openapi.json | the OpenAPI spec, cut down to the key's scopes |
The API version lives only in the path. Secret settings values come back as "•••".
page is the page number, from 1. per_page is 1 to 100, 25 by default. sort=name sorts ascending, sort=-name descending. filter[field]=value matches exactly. /api/v1/resources shows which fields can be sorted and filtered. An unknown filter is dropped silently.
A list's meta holds page, per_page and total.
Every response looks like {"data": …, "meta": {…}, "errors": […]}. On an error, data is null and errors holds code, message and details:
{"data":null,"meta":{},"errors":[{"code":"invalid_token","message":"The supplied API key is unknown or revoked.","details":[]}]}| Status | code | When |
|---|---|---|
| 401 | unauthorized | no Authorization header |
| 401 | invalid_token | the key is unknown, disabled or regenerated |
| 403 | forbidden | the key's owner is blocked |
| 403 | insufficient_scope | the key lacks a scope |
| 404 | not_found | no such API endpoint |
| 409 | idempotency_conflict | an Idempotency-Key was reused with a different body |
| 429 | too_many_requests | the rate limit was hit |
| 500 | server_error | an error on the site |
Reads: 120 requests a minute per IP, writes: 60. Responses carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Over the limit, the site answers 429 with a Retry-After header that says how many seconds to wait.
Add an Idempotency-Key header with your own unique value to a POST, PATCH or DELETE. A retry with the same key and the same body returns the stored response with Idempotent-Replay: true and changes nothing a second time. The response is kept for a day.
curl -X PATCH -H "Authorization: Bearer <KEY>" -H "Content-Type: application/json" \
-H "Idempotency-Key: disable-server-1" \
-d '{"enabled":false}' https://<YOUR_DOMAIN>/api/v1/servers/1/api/v1/openapi.json returns the spec for a key, with only what that key can reach. The interactive docs page /api/v1/docs is closed by default and answers 401. To open it, set 'public' => true in the openapi block of config/api.php. The spec then becomes available without a key too.
A resource describes an entity, its fields and the admin permission needed to grant access to it. This is the core redirects resource:
final class RedirectResource extends AbstractEntityResource
{
public function entity(): string
{
return Redirect::class;
}
public function name(): string
{
return 'redirects';
}
public function title(): string
{
return 'Redirects';
}
public function ability(): ?string
{
return 'admin.redirects';
}
public function filters(): array
{
return ['fromUrl', 'toUrl'];
}
public function fields(): array
{
return [
FieldSpec::int('id'),
FieldSpec::string('fromUrl')->writable()->rules('required|string'),
FieldSpec::string('toUrl')->writable()->rules('required|string'),
];
}
}A module registers its resources in the provider's boot(), and the <name>:read and <name>:write scopes appear in the key table right away:
api()->resource(new LeaderboardResource());For an endpoint that is not a list or a record change, the controller extends ApiController, carries a #[Route] with the token middleware and checks the scope with requireScope():
#[Route(
uri: '/api/v1/leaderboard/top',
methods: ['GET'],
name: 'api.v1.leaderboard.top',
middleware: ['token', 'throttle:ip,120,60'],
)]
public function top(FluteRequest $request): JsonResponse
{
return $this->respond(function () use ($request) {
$this->requireScope($request, 'leaderboard', ScopeRegistry::READ);
return ApiResponse::ok($this->leaderboard->top());
});
}The rules for core and module developers are in app/Core/Api/AGENTS.md.
The status switch on a key disables it at once but keeps it with its scopes, so you can turn it back on. "Regenerate" issues a new key with the same scopes, cut down to yours, and the old one stops working. "Delete" removes the key for good. Keys have no expiry and no IP allowlist; rotate them by hand.
Each key shows when it was last used. That time updates at most once a minute.
The key form has a folded "Rights for old integrations" field. Only integrations written for the previous version of the API need it. These rights do not open /api/v1; there only the scopes from "What the key may do" count.
If another site needs sign-in with an account from your site, a key is the wrong tool. Use AdminDeveloperOAuth applications instead: OAuth 2 and OpenID Connect with the authorization code flow and PKCE (S256 only), refresh tokens and client credentials. The OAuth server settings are published at /.well-known/openid-configuration.