Skip to content

API Keys

View as Markdown

Daytona API keys authenticate requests to the Daytona API. They are used by the Daytona SDKs and CLI to access and manage resources in your organization.

Create an API key

Daytona provides options to create API keys in Daytona Dashboard ↗ or programmatically using the API.

  1. Navigate to Daytona Dashboard ↗
  2. Click the Create Key button
  3. Enter the name of the API key, set the expiration date, and select permissions
  4. Click Create to create the API key
  5. Copy the API key to your clipboard

To use the API key in your application, set the DAYTONA_API_KEY environment variable. Daytona supports multiple options to configure your environment: in code, environment variables, .env file, and default values.

API keys support optional expiration and can be revoked at any time. After creation, you can only retrieve a masked key value when listing keys.

Terminal window
curl 'https://app.daytona.io/api/api-keys' \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"name": "My API Key",
"permissions": ["write:sandboxes", "delete:sandboxes"],
"expiresAt": "2030-01-01T00:00:00.000Z"
}'

For more information, see the API reference:

Create API key (API)

Permissions & Scopes

ResourceScopeDescription
Sandboxeswrite:sandboxesCreate/modify sandboxes
delete:sandboxesDelete sandboxes
Snapshotswrite:snapshotsCreate/modify snapshots
delete:snapshotsDelete snapshots
Registrieswrite:registriesCreate/modify registries
delete:registriesDelete registries
Volumesread:volumesView volumes
write:volumesCreate/modify volumes
delete:volumesDelete volumes
Auditread:audit_logsView audit logs
Regionswrite:regionsCreate/modify regions
delete:regionsDelete regions
Runnersread:runnersView runners
write:runnersCreate/modify runners
delete:runnersDelete runners

List API keys

Daytona provides methods to list all API keys for the current user or organization.

Terminal window
curl 'https://app.daytona.io/api/api-keys' \
--header 'Authorization: Bearer YOUR_API_KEY'

For more information, see the API reference:

list (API)

Get current API key

Daytona provides methods to get details of the API key used to authenticate the current request.

Terminal window
curl 'https://app.daytona.io/api/api-keys/current' \
--header 'Authorization: Bearer YOUR_API_KEY'

For more information, see the API reference:

get current (API)

Get API key

Daytona provides methods to get a single API key by name.

Terminal window
curl 'https://app.daytona.io/api/api-keys/my-api-key' \
--header 'Authorization: Bearer YOUR_API_KEY'

For more information, see the API reference:

get (API)

Delete API key

Daytona provides options to delete an API key in Daytona Dashboard ↗ or programmatically using the API. The key is revoked immediately and cannot be recovered.

  1. Navigate to Daytona Dashboard ↗
  2. Click Revoke next to the API key you want to delete
  3. Confirm the revocation
Terminal window
curl 'https://app.daytona.io/api/api-keys/my-api-key' \
--request DELETE \
--header 'Authorization: Bearer YOUR_API_KEY'

For more information, see the API reference:

delete (API)

Delete API key for user

Daytona provides options for organization admins to delete an API key for a specific user.

Terminal window
curl 'https://app.daytona.io/api/api-keys/{userId}/my-api-key' \
--request DELETE \
--header 'Authorization: Bearer YOUR_API_KEY'

For more information, see the API reference:

delete for user (API)