Skip to main content

How can I rotate my user API token?

For security reasons and best practices, you should aim to rotate API keys every so often.

  1. Rotate your User API token by replacing YOUR_USER_ID, YOUR_CURRENT_TOKEN, and YOUR_ACCESS_URL with your information in the following request.
curl --location --request POST 'https://YOUR_ACCESS_URL/api/v2/users/YOUR_USER_ID/apikey/' \
--header 'Authorization: Token YOUR_CURRENT_TOKEN'
  • Find your YOUR_USER_ID by reading How to find your user ID.
  • Find your YOUR_CURRENT_TOKEN by going to Profile Settings -> API Access and copying the API key.
  • Find YOUR_ACCESS_URL for your region and plan.
Example

If YOUR_USER_ID = 123, YOUR_CURRENT_TOKEN = abcf9g, and your ACCESS_URL = cloud.getdbt.com, then your curl request will be:

curl --location --request POST 'https://cloud.getdbt.com/api/v2/users/123/apikey/' \
--header 'Authorization: Token abcf9g'
  1. Find the new key in the API response or in dbt Cloud.

  2. To find the new key in dbt Cloud, go to Profile Settings -> API Access.

dbt Cloud deployments

If your dbt Cloud deployment uses a different access URL, replace cloud.getdbt.com with the URL of your instance.

For example, if your deployment is Virtual Private dbt:

http://cloud.customizedurl.getdbt.com/
http://cloud.getdbt.com/

0