Keeping a game's key secret

The rules for storing and using a game's API key in Roblox, what never to do with it, and what to do when one leaks.

Building on the platform

A game's key lets anyone who holds it read the platform's market data and post feedback as that game, and spend the game's 120 requests a minute. Treat it like a password.

Where the key must live

Only in the experience's Roblox secrets, as BlockoutApiKey with the domain studio.blockoutgames.com, read on the server with HttpService:GetSecret. That returns a Secret object, which cannot be printed and can be used only in a header or a URL. The Template's platform service builds its header with the Secret's AddPrefix("Bearer "), so the key is never turned into a string. Setting it up: Getting a game's API key.

A server script
local HttpService = game:GetService("HttpService")-- Errors when the secret is not set; the Secret cannot be printed or turned into text.local ok, authorization = pcall(function()	return HttpService:GetSecret("BlockoutApiKey"):AddPrefix("Bearer ")end)-- Use it only as a header value: Headers = { Authorization = authorization }

How a game's key travels from Roblox to the platform

The key leaves the Roblox secret only as a header on an HTTPS request to the secret's domain. The panel forwards it to the API, which hashes it and compares hashes; the key itself is never stored or logged.

Where a game's key goes. The key sits in the experience's Roblox secret BlockoutApiKey. A server script reads it with GetSecret and adds the Bearer prefix, which keeps it a Secret object. It goes as the Authorization header of an HTTPS request to studio.blockoutgames.com. The panel forwards the header to the API, which hashes the key with SHA-256 and compares that hash with the stored hashes. Logs remove the header before anything is written.

What never to do with a game's key

  • Never in source. Not in a script, a ModuleScript, a config module, a StringValue, an attribute or a place file. A key in source reaches every copy of the repository and every place file.

  • Never on a client. LocalScripts, ModuleScripts in ReplicatedStorage and anything a client can see are readable by players. Call the API only from server code.

  • Never in a log or an error. Do not convert the Secret to text, print it, put it in an analytics event, send it on a remote or return it in a message.

  • Never anywhere but the platform. It goes only to studio.blockoutgames.com, the secret's domain. Do not put it in chat, Discord, an issue, a commit or a screenshot, and do not set the secret's domain to *.

  • Never trust what clients send. Feedback comes from players through a remote: check its types and lengths and limit how often each player may send, as the Template's feedback window does.

When a key leaks

  1. Rotate the key

    Open the game's Developer tab and choose Rotate key. The old key stops at once.

  2. Update the secret

    Put the new key in the experience secret BlockoutApiKey, in the Creator Dashboard and in any Studio local secrets.

  3. Cycle running servers

    Running servers keep the old key and are refused until they close; shut them down or let them cycle.

  4. Tell the crew

    Tell the game's crew what happened. The audit log shows when it was rotated, as game-key-rotated.

What a leaked key can and cannot do

A leaked key can read the market data any studio game can read, post feedback as the game, and use up the game's limit, so the game's own servers are refused with 429. It cannot read studio data, a game's feedback, revenue or anything in the panel, and it cannot create, rotate or revoke keys. A key's usage on the Developer tab (a climbing rate-limited count, or requests on routes the game never calls) is how a crew notices someone else using it.

What the platform does to protect keys

  • It keeps only a SHA-256 hash of the key and shows the key once, when it is made.

  • It answers the same 401 for a missing, malformed, wrong or revoked key, and never repeats the key in an answer.

  • It never writes a key to a log: the authorization header is removed by name, and Bearer … and bk_live_… by pattern.

  • A key pasted into feedback text is replaced with bk_live_[removed] before it is stored, so the crew and the assistant never read one.

  • The assistant never sees a key, and the key routes refuse it.

  • A revoked key, or the key of a game removed from the studio, stops on the next request, whatever is cached.

  • The panel forwards a developer request without any cookie, so a key request can never act as a signed-in member.

Updated