Skip to main content

Overview

Every API request carries a token in the Authorization header:
How you get that token depends on whose account the requests act on.

Personal access token

Your own scripts, backups and tools, working on your own account.

OAuth application

An application other Drime users connect to. They approve it on Drime, and you never see their password.
Never ask a user for their Drime password. If your application works on other people’s accounts, use OAuth.

Personal access tokens

Create a token

  1. Sign in to Drime.
  2. Open Settings and go to Developers, or use the direct link.
  3. Under API access tokens, click Create token.
  4. Give it a name you will recognize later, for example the machine or the script that uses it.
  5. Choose its Permissions (see below) and click Create.
  6. Copy the token and store it somewhere safe. It is shown once: after you close the dialog, nobody can display it again, not even Drime.

Permissions

The dialog offers three choices: The resources are Files, Folders, Sharing, Workspaces, Vault, Sign, Whiteboards, File requests, Send & Track, Contacts, Tags and Analytics (read only). They are the same scopes OAuth applications use, files.read, files.write and so on, and the scopes page lists the routes each one opens.
Give each token the narrowest permissions that work. A token that can only read your files cannot delete them if it leaks.
A token with Read Only or Restricted permissions never reaches the routes that manage the account itself, whatever you tick: API tokens, sessions, password and two-factor settings, billing and the admin area. Routes that belong to no resource are refused too, so a limited token cannot be used to create a more powerful one. Any token can read GET /users/me, whatever its permissions.
Vault files stay encrypted. With Vault access, a token lists and downloads encrypted data. Only the vault password, on your side, can decrypt it.

Lifetime and revocation

A personal access token does not expire. It works until you delete it. The API access tokens list shows when each token was last used. Delete a token from the same list as soon as you stop using it, or straight away if it may have leaked: it stops working immediately.

Using the token

Send it in the Authorization header of every request:
Response

Error Responses

401 Unauthorized

The token is missing, wrong, or was deleted:

403 Forbidden

The token is valid but its permissions do not cover this route. The message names the missing scope:
Routes a limited token can never reach answer:
And when the token is fine but your account itself may not do this, for example on a file someone shared with you read only:

Keeping tokens safe

Environment variables

Keep tokens out of your code and out of version control

One token per tool

Delete one without breaking the others, and see which one was used last

Narrow permissions

Read Only or Restricted whenever All is not needed

Never in a shipped app

Anything inside a browser page or an app you distribute can be extracted. Use OAuth there

Example: Setting Up Environment Variables

Then use it in your code: