API tokens and a first example
With the GoodFlare API you control your servers from your own scripts and bots: query their state, start and stop them, send commands, edit files, create backups and automations.
The full description of every endpoint, limit and error is in the API documentation. This is about the token and a first request.
Create a token
Open Account, API access and press Create token. If your sign-in is older than 10 minutes, briefly confirm that it is you.
Enter a Name, such as “Discord bot”.
Choose the Permissions: Read (servers, state, usage, addresses, invoices), Control servers (power and console), Files to view or edit, Backups (list and create) and Automations (read, create, change and delete).
Choose which servers it is For (all or selected) and how long it is Valid: 30 days, 90 days, 1 year or no expiry.
Press Generate token and copy the token right away: it is shown only this once.
A token can never do more than you can yourself. The list shows its last four characters, when and from where it was last used, and until when it is valid. Revoke it by holding; anything using it stops working at once.
A first request
Keep the token in an environment variable, so it is not in the script itself:
export GF_TOKEN="gf_…"This request lists your servers with name and state. Every request carries the token in the Authorization header:
curl https://api.goodflare.io/api/v1/servers \
-H "Authorization: Bearer $GF_TOKEN"Restart a server (the token needs Control servers for this):
curl -X POST https://api.goodflare.io/api/v1/servers/SERVER_ID/power \
-H "Authorization: Bearer $GF_TOKEN" \
-H "Content-Type: application/json" \
-d '{"signal":"restart"}'The same examples in JavaScript and Python are in the quick start of the API documentation.
Limits
- Up to 20 tokens per account.
- 120 requests per minute per token, 300 for all of an account's tokens together.
- Cancelling, reinstalling or deleting is not possible through the API.
- Every action is listed in the server's activity, with the token's name.
Related articles
- Two-factor sign-in and passkeysYou sign in with a link from an email. A passkey or a code from an authenticator app protects your account further should someone get into your mailbox.
- Console: commands, log and powerFollow your game server's log live, send commands, start and stop the server, and share a log with others.
- Create and restore backupsA backup saves all of your game server's files. How to create one, restore it in full or file by file, what is backed up automatically every night, what the safety copy before risky changes is, and where backups are kept.
Need help?
If this guide does not answer your question, write to us. Usually within 24 hours.