API Key
How to use the apikey
command in the Scale CLI.
The apikey
command is used to manage API keys in the Scale CLI.
API keys are used to programmatically authenticate with the Scale API, and are associated with a user’s account.
API Keys can be created, listed, and deleted, but not edited. API Keys also do not expire, and can be used indefinitely.
In the future we will be introducing a new authentication method called Service Keys which will allow you to create programmatic access keys (similar to API Keys) that can be scoped to specific resource, can be set to expire automatically, or used a maximum number of times.
If you are interested in this feature, please join the #scale
channel in our Discord and let us know!
This reference page assumes you have already installed the Scale CLI, and are authenticated with your Scale account.
Creating an API Key
To create an API Key, run the following command:
This will create a new API Key with the given name, and print the key to the console. The API Key will only be shown once, so make sure to copy it to a safe place.
The format of the returned API Key is <ID>.<Secret>
. This means that the ID
of an API Key is the string that appears
before the period (.
), and the Secret
of an API Key is the string that appears after the period (.
).
Listing API Keys
API Keys can be listed using the following command:
Remember that you can change the output format using the --format
flag.
Deleting an API Key
To delete an API Key, run the following command:
If you do not know the name of the API Key you want to delete, you can use its ID instead:
The format of the returned API Key is <ID>.<Secret>
. This means that the ID
of an API Key is the string that appears
before the period (.
), and the Secret
of an API Key is the string that appears after the period (.
).
Get API Key Information
To get information about an API Key, run the following command:
If you do not know the name of the API Key you want to get information about, you can use its ID instead:
Remember that you can change the output format using the --format
flag.
Authenticating with an API Key
To authenticate with an API Key, you can either specify the --api-key
flag when authentication with the Scale CLI,
or you can set the SCALE_API_KEY
environment variable to the API Key you want to use when running the same command.
Once you’ve authenticated with an API Key, you can use the Scale CLI to interact with your Scale account.