How to create an API Authentication Token
Directus has a powerful API that allows you to connect your database with your projects. To start using the API, you will need an API token. This article will cover how to create an API token through Directus.
To create an API token, login to Directus and open the User Directory. Create a new user without a password and generate a token at the bottom.
The User Directory section contains all your Directus users. An API token is treated like any other user including the ability to assign a role with granular permissions.
Step 1 Create a User
Open the User Directory.
Click the Plus (+) icon to add a new user.
Use the First Name to give the user a descriptive name that appears in the internal activity logs. The Last Name can be used to group API accounts together using a common value such as SVC. The Email field is optional if you want to set up any notifications on the account's actions.
It is important to leave the password field blank so no one can log in using this account.
Step 2 Generate a Token
Scroll to the bottom of the page and you'll see the Token field. Click the Plus inside the field.
Next choose a Role for the API. Avoid using the Administrator role as this has its risks. Instead, create a new role that is specific to the function of this account. I created one called API, but you can create one using the Plus icon within the role field, then set the permissions to what you need. Give it a name the relevant to the purpose such as "Website API Read Only".
Save changes using the big tick at the top.
Conclusion
Now you know how to create new API tokens and how to assign them to a role. Be sure to read how you can customize the permissions and secure your token.