Skip to main content

Create an API key

Create a personal Sandscale API key, what the rules are, and how to rotate or revoke it.

S
Written by Sanjay Senthilkumar

A personal API key acts as you, with the permissions you choose for it. Use one for scripts, CI jobs and your own tools.

Create a key

  1. Sign in to the console at cloud.sandscale.dev.

  2. Open your account settings and create a personal API key.

  3. Copy the key straight away. It starts with nia_ and is shown once.

  4. Store it in your secret manager or an environment variable:

    export SANDSCALE_API_KEY=nia_...

Rules the server enforces

  • Scopes. A key can only hold permissions you hold yourself. Asking for more is refused with 403 scope_exceeds_creator.

  • Expiry. Every key must expire, at most 90 days ahead.

  • Number of keys. You can hold up to 10 live keys. One more is refused with 409 personal_key_limit.

  • Only you. Keys are created, rotated and revoked from your own signed-in session. An API key cannot create or rotate a key (403 person_required).

Use the key

Send the key as a bearer token in the Authorization header of each API request to https://api.sandscale.dev. The SDKs and the CLI do this for you when SANDSCALE_API_KEY is set. API examples are in the API guide.

Rotate and revoke

Rotation issues a new key with the same name and scopes, and can keep the old key working for a while so you can roll it out. It asks you to confirm it is you, so do it from the console. Revoking a key takes effect at once. The list of your keys shows each key's state (active, expired or revoked) and never returns a secret.

Lost a key? It cannot be shown again. Create a new one and revoke the old one.

Full reference: Authentication.

Did this answer your question?