Skip to navigation

Authentication

Use app credentials to manage users, user credentials to manage agents, and agent tokens to access files.
View as Markdown
Credential security

Keep app and user credentials in your trusted backend. Give each agent runtime only its own short-lived agent token.

Credential layers

CredentialPurposeStore in
App key and secretAdminister managed usersBackend secret store
App access tokenManaged-user administrationBackend cache
User access tokenManage files, agents, and workspacesTrusted backend
Agent tokenAccess files within an agent workspaceAgent runtime
Agent token lifetime

Agent tokens expire after four hours by default and cannot be refreshed. Use expires_in to mint replacements before expiry; the agent identity stays the same.

Existing user flow

Connect the user through OAuth, requesting the file and Agent Filesystem scopes your integration needs.

In your trusted backend shell, set the resulting user access token:

export USER_ACCESS_TOKEN='your-user-access-token'
1

Create an agent

Call from your backend with the user token. The folder must exist; replace id:existing-folder-id below.

curl https://api.dropboxapi.com/2/agent_filesystem/agents/create \
--header "Authorization: Bearer $USER_ACCESS_TOKEN" \
--header 'Content-Type: application/json' \
--data '{"entries":[{"workspace":[{"path":"id:existing-folder-id","role":{".tag":"read_write"}}]}]}'

Save the returned agent_id.

2

Mint an agent token

Replace dbaid:agent with that ID.

curl https://api.dropboxapi.com/2/agent_filesystem/agents/access_token/mint \
--header "Authorization: Bearer $USER_ACCESS_TOKEN" \
--header 'Content-Type: application/json' \
--data '{"agent":{".tag":"agent_id","agent_id":"dbaid:agent"},"scope":"files.metadata.read files.content.read files.content.write"}'

Give the returned token to the runtime. It cannot edit its workspace or mint tokens. An optional session_external_id associates a token with a run; recovery still spans all tokens for the agent.

Choose token scopes

Scope syntax differs by interface:

InterfaceFormatExample
API: agents/access_token/mintscope: space-separated string"files.metadata.read files.content.read"
API: users/access_token/mintscopes: JSON array["files.metadata.read", "files.content.read"]
CLI: --scopeComma-separated values or repeated flags--scope files.metadata.read,files.content.read

For agent tokens, supported values are files.metadata.read, files.metadata.write, files.content.read, files.content.write, and account_info.read.

  • Include account_info.read for account-root discovery.
  • In the agent-token API, omit scope to request the four file scopes.
  • Every requested scope must be granted to both the app and the user token.

Managed user flow

1

Sign in as your app

Create an Agent Filesystem app, then sign in. The CLI reads the secret from DBX_APP_SECRET or a hidden prompt for each app command; it does not save it.

dbx login --app --app-key 'your-app-key' --profile provider
2

Create a managed user

Create once; inspect existing users before retrying an uncertain request. Email is contact metadata, not a sign-in or recovery address.

dbx user create app-user --name 'App user' --profile provider
3

Save the user profile

dbx login --user app-user --app-profile provider --profile standalone-user

Continue at Quickstart step 4.

Token lifecycle

Managed-user token lifetime

Managed-user tokens cannot be refreshed. Repeat dbx login --user before expiry to replace one while keeping agent aliases. For backend calls, dbx user token app-user --profile provider --output=json returns expiry and scopes. Request only needed scopes; CLI user login also needs account_info.read.

To import a token issued by your backend, pass the complete JSON output privately:

dbx login --token --profile standalone-user < user-token.json

Imports clear local agent aliases. Keep agent IDs so you can continue managing the same agents. See Mount for mount renewal behavior.

Managed-user routes accept either app authentication method:

  • HTTP Basic: use the app key as the username and app secret as the password. The CLI uses this method when you sign in with dbx login --app --app-key.
  • Bearer: send Authorization: Bearer <app_access_token>. Obtain an app access token with grant_type=client_credentials; use this token in the API reference playground.

Create one user per users/create request, omit tenant, and save the returned user_public_id. Use it with users/access_token/mint; scopes must be a nonempty array without duplicates. Use expires_in to schedule replacement tokens.

See the managed-user API reference for request schemas. For users/list, continue while next_cursor is present, even after an empty page.

Token storage

  • Bind the Dropbox account ID or app-bound user_public_id to your authenticated customer.
  • Keep secrets and existing-user OAuth refresh tokens in your backend secret store; cache access tokens by expiry.
  • Verify customer ownership of client-supplied user identifiers.
  • Deliver only the agent token and task input to the runtime.

Stop access

ActionEffect
POST auth/token/revoke with the runtime token and no bodyRevoke that token; independently minted tokens remain active.
Delete an agentRevoke its tokens and prevent new ones.
Edit its workspaceChange accessible files and folders.
Delete a managed userDisable the user and schedule irreversible, asynchronous data deletion.
Disable the appStop issuing new tokens for the integration.

Short-lived tokens also expire automatically. Confirm revocation timing during onboarding.