API keys and permissions
An API key connects an application, script or service to all drives in one workspace. Choose the permission the application needs.
| Permission | API value | Lets the application |
|---|---|---|
| Read | search | List, find, read and download files and folders. |
| Read / Write | read_write | Do all of the above, and upload, change, move and delete files and folders. |
A key never reaches another workspace. To give a cloud sandbox or batch job access to just one drive or one folder for a limited time, use a sandbox token instead of a workspace key. To give an AI agent access, set up an agent connection.
Create a key
- As a workspace admin, open Settings in the sidebar, then the API keys tab.
- Enter a descriptive Key name and choose the Permission your application needs.
- Set an expiry date and time if the key should stop working then, and select Create key.
- Copy the key when it is shown and store it in your secret manager.
flashdrive keys create "nightly-report" --permission read_write
--permission is search (read, the default) or read_write. Add --expires-at with a date and time to set an expiry. flashdrive keys list lists the workspace's keys and flashdrive keys revoke KEY_ID revokes one.
The full key is shown only once. If you lose it, create a replacement and update your application.
Use the key
Set it in the application's environment as FLASHDRIVE_API_KEY. The Python SDK and the CLI read it from there:
export FLASHDRIVE_API_KEY="..."
To save a key for the CLI instead, run flashdrive login --api-key and paste the key at the hidden prompt.
For the REST API, send the key over HTTPS as Authorization: Bearer YOUR_KEY. See authentication for the other required headers.
Keep keys on servers and in secret managers. Never put a key in client-side code, a prompt, a file in a drive, or a URL.
Rotate a key
- Create a replacement key with the same permission.
- Update the application and confirm it can read a file.
- Revoke the old key.
Revoke a key at once if it may have leaked. Keys that expire stop working at their expiry time.
Continue with SDK installation or authentication.