Authorization header, and Fibre uses it to decide which account the request belongs to and what it is allowed
to do.
A key does not have to be all-powerful. You can create keys that can only do certain things, keys that only work
on one sandbox, and keys that stop working after a set time. This page shows how, and why you would want to.
Use your key
Create your first key in the dashboard, under API keys. It starts withfb_live_. Copy it as soon as it is
created: Fibre shows it only once and keeps only a fingerprint of it, so it cannot be shown again. If you lose
it, create a new one.
Send the key as a bearer token. The SDKs read it from the FIBRE_API_KEY environment variable, or you can
pass it in yourself:
A key for one job
1
Create it with scopes and an expiry
Two settings narrow a key down:
scopeslists what the key may do.sandboxes.read, for example, lets it look at sandboxes but not create or change them. All the scopes are listed further down.expires_in_secsets when the key stops working.
Response
Response
response
2
Use it
Now try the new key. Listing sandboxes is a read, so it works. Starting a sandbox is a write, so Fibre refuses it
and says which scope was missing:
Response
Response
response
A key can create other keys only if it has the
keys.write scope. Even then, it can never create a key that can do
more than itself, or one that lives longer than itself. So a limited key can never be used to make an unlimited
one.A key for one sandbox
When an agent runs inside a sandbox, it often needs to use Fibre itself: to read its own files, start a background command, or extend its own lifetime. Giving it your main key would let it reach every sandbox you own. Instead, bind a key to that one sandbox with theresource field. The bound key works on that sandbox and
nothing else, and it is revoked automatically when the sandbox is deleted. Here is the whole flow:
1
Start a sandbox
2
Create a key bound to it
Response
Response
response
3
Hand it to the program inside
Pass the key to the program inside the sandbox as an environment variable of the command that starts it. Only that
command, and the programs it starts, can see it:
4
It reaches its own sandbox, and nothing else
Response
Response
response
curl
Response
Response
response
404 sandbox_not_found, as if that sandbox did
not exist. The key cannot even learn which other sandboxes you have.List and revoke keys
You can list all the keys of your account at any time. The list shows each key’s name, its first few characters (prefix, so you can recognise it), its scopes and when it was last used. It never shows the key itself.
To revoke a key, delete it. A revoked key stops working immediately.
curl: revoke one
Response
Response
response
curl: delete the sandbox
Scopes
A scope combines an area of the API with what the key may do there:sandboxes.readlets the key look, for example list sandboxes or read their status. AnyGETrequest needs.read.sandboxes.writelets the key make changes, for example create, update or delete sandboxes, or run commands. Every other request needs.write.sandboxes.*allows both, and*on its own allows everything in every area.
Errors
If a request is refused because of its key, the answer tells you why:Keep keys safe
A few habits keep your account safe:- Keep keys out of your code. Read them from environment variables or a secret manager, and never commit them to a repository.
- Give each job its own key. A CI pipeline, a script and an agent should each have a separate key, with only the scopes and the lifetime they need. Then one leak affects one job.
- Inside a sandbox, use a bound key. It cannot reach anything beyond that sandbox.
- If a key leaks, revoke it. Nothing else needs to change: create a new key and carry on.