A secret is a named value, such as a model-hub token, that your organization stores once and uses in many servers. The value is write-only: after you save it, nobody can read it back in the console or the API. You see its name, the last four characters, and who changed it and when.
Add a secret
- Go to Settings, then Secrets.
- Select Add secret.
- Enter a name and the value. Names use capital letters, digits and underscores, start with a letter and have up to 64 characters, for example
HF_TOKEN. - Select Save.
Owners and admins add, rotate and delete secrets. Every member can see the names, so they can use them.
Use a secret
In the Environment variables of a template or of the deploy wizard, set the value to secret:NAME, for example secret:HF_TOKEN. Or select Secret next to the value field and pick a name from the list.
The value is filled in when the server starts. It is never stored in the template or in your server request, so the template can be shared inside your organization without exposing the token. A value that only contains the text, such as a URL with secret: inside it, is not replaced; the whole value must be the reference.
If a referenced secret does not exist when you request a server, the request is refused with the name of the missing secret.
Rotate a secret
Select Rotate, enter the new value and save. Running servers keep the value they started with. Servers started or rebuilt afterwards get the new one.
Delete a secret
You cannot delete a secret that a template or a pending or active server request still references. Remove or change those references first.
What is kept out of view
- The value is encrypted and bound to your organization.
- Secret values are removed from server logs and command output that you read in the console and the API.
- The audit log records secret names and who changed them, never values.
A secret is still plain text on the server that uses it, so anyone with a shell on that server can read the variable. Use tokens with limited rights, and revoke them when you no longer need them.
API
GET /api/v1/secrets lists names. PUT /api/v1/secrets with { "name": "HF_TOKEN", "value": "..." } creates or rotates a secret. DELETE /api/v1/secrets?name=HF_TOKEN deletes it. Writes need a full key created by an owner or an admin. See the API reference.
Variable sets
To attach several secret values at once, save them as a variable set. Its values are write-only too.
Ready to try it?
Create a free account and add credit when you want to start a server. The smallest top-up is $10.
Was this helpful?