CertSafari
    DBT Architect· Lessons

    Domain 5 · Lesson 27/39

    Creating dbt service tokens for API access

    Creating service tokens for API access

    13 min read
    2.56% of exam
    7 sources
    Published 13 Oct 2026
    Docs as of 12 Oct 2026

    What you will be able to do

    • Choose between a service token and a personal access token for a given API workflow
    • Create a service token in Account settings and store it correctly
    • Scope a service token with the permission sets and projects an integration needs
    • Rotate a service token without downtime and diagnose a 403 caused by IP restrictions

    Key concept

    Service account token — An API credential that belongs to the dbt account rather than to any person. It carries only the permission sets you assign it, so an integration gets exactly the access it needs and keeps working when people leave.

    1.Service tokens versus personal access tokens

    Every request to the dbt APIs is authorised with a token, and dbt supports two kinds: personal access tokens (PATs) and service account tokens. The Administrative API, the Discovery API and the Semantic Layer APIs all accept them. Choosing the wrong kind doesn't cause an error on day one. It shows up later, when the integration breaks or turns out to have too much access.

    A PAT acts as the person who created it. PATs inherit the permissions of the user that created them, so a token made by a Project Admin gets Project Admin on the same projects. A service token belongs to the account and has no user behind it. It holds only the permission sets you assign to it, which makes it the right credential for system-level integrations that don't run on behalf of any one person.

    The rule of thumb is production versus development. Use a service token for any production workflow that needs a service account. Use a PAT for developmental work, and for clients that need a user context. The dbt platform CLI is the clearest example: it works within the context of a user, so it takes a PAT. Endpoints that create or update user credentials also require a PAT.

    Which token to use for common API workflows
    WorkflowTokenReason
    Partner integration (Hightouch, Datafold, Semantic Layer Google Sheets, a custom app)Service tokenGives visibility and can be scoped to least privilege
    Production TerraformService tokenActs as a service account, not a user account
    Testing a custom script, staging Terraform or PostmanPATDevelopmental workflow scoped to the user making changes
    dbt platform CLIPATWorks within the context of a user
    Endpoints that create and update user credentialsPATThe endpoint requires user context

    A script often starts on a PAT while someone tests it. When it moves to production, switch it to a service token. If a partner integration is running on someone's PAT today, the recommendation is to move it to a service token. A service token can be scoped to what the integration needs, and it doesn't stop working when its owner's access changes.

    Checkpoint 1 of 8· Check yourself

    A team has tested a Terraform configuration in staging with an engineer's personal access token. It is now being promoted to manage the production dbt account. What should it authenticate with?

    Checkpoint 2 of 8· Exam question

    A platform admin on an Enterprise dbt Cloud account needs a token so a nightly Airflow instance can trigger dbt Cloud jobs via the API without acting as any individual employee. How should the admin issue this credential?

    Sources1234

    2.Creating a service token in Account settings

    Creating a service token takes two things together: a Developer license and account admin permissions. A user who has one without the other can't create tokens. Inside the Semantic Layer setup, a user without token permissions sees a prompt to contact their admin instead of the token option.

    The token is created in a short sequence in the dbt UI:

    1. Click your account name in the left side menu and select Account settings. 2. On the left sidebar, click Service Tokens. 3. Click + Create service token and enter a name for the token. 4. Add the permissions the integration needs. 5. Copy the generated token and store it somewhere safe.

    The last step can't be skipped. dbt shows the token value only once, at creation. If nobody copies it before closing the screen, it can't be recovered, and you'll have to generate a new token. Paste it directly into the integration's secret store, not into a chat message or ticket.

    Creating tokens through the API has a restriction of its own. A PAT can't create a service token, and that request fails with a 400 error. To create tokens programmatically, authenticate with an existing service token. A bootstrap token made in the UI can then issue the narrower tokens for each integration.

    Checkpoint 3 of 8· Put it in order

    Put the steps for creating a service token in order

    1. 1.Add the necessary permissions
    2. 2.Save the generated token somewhere safe before leaving the screen
    3. 3.Click Service Tokens on the left sidebar
    4. 4.Click your account name in the left side menu and select Account settings
    5. 5.Click + Create service token and enter a name

    Checkpoint 4 of 8· Exam question

    An Enterprise account has IP restrictions enabled with an allowlist containing only the company VPN egress addresses and the git provider's published ranges. A CI runner hosted on a third-party build service calls the dbt Cloud API with a valid, correctly scoped service token, but every request returns 403 Forbidden. What is the most likely cause and fix?

    Sources32

    3.Scoping a token with permission sets and projects

    A service token's access comes entirely from the permission sets attached to it. Unlike a PAT, it inherits nothing. You can assign as many sets as a token needs, and for each one you choose whether it applies to all projects in the account or only to specific projects. A token for one team's Discovery API dashboard should be limited to that team's project, not the whole account. The sets themselves are covered under [permission sets](lesson:5.2). Here, the question is which of them a token may carry.

    Your plan decides which permission sets you can assign to a token. On Enterprise and Enterprise+, any available permission set can go on a service token. Developer and Starter plans can only assign Semantic Layer permissions. Legacy Team plans can assign Account Admin, Member, Job Admin, Read-Only, Metadata and Semantic Layer.

    Permission sets each plan can assign to a service token
    PlanAssignable to service tokens
    Enterprise and Enterprise+Any permission set available to service tokens
    Developer and StarterSemantic Layer permissions
    Legacy TeamAccount Admin, Member, Job Admin, Read-Only, Metadata, Semantic Layer

    "Any permission set" has at least one exception. v2 Migration Admin can be assigned only to user accounts and never to a service token. If an automated process has to perform dbt v2 upgrades while the upgrade restriction is on, give it Account Admin, which works on both users and tokens.

    Least privilege comes down to matching the set to the job:

    - A Discovery API integration needs Metadata Only, a read-only set covering models, runs, sources and tests. - A BI tool querying the Semantic Layer needs Semantic Layer Only plus Metadata Only. When you map a token during Semantic Layer setup, dbt selects these two for you. - Account Admin gives a token full read and write access to the account. Reserve it for automation that really administers the account, such as production Terraform.

    Checkpoint 5 of 8· Match them up

    Match each integration to the permission set its service token should carry

    Tap a term, then the definition that fits it.

    Sources356

    4.Rotating tokens and fixing 403 errors

    Rotating a token means replacing it without a gap in service. dbt changed how tokens are generated and validated on July 18, 2023, and only tokens created after that date benefit from the faster validation. Older tokens still work. If one is used for high-frequency API calls, though, rotating it reduces latency.

    The order matters because the old token has to keep working until its replacement is live:

    1. In Account settings → Service tokens, check that the token's Created date is on or before July 18, 2023. 2. Click + New Token and give it the same permissions as the old one. 3. Copy the new token and replace the old one in every system that uses it. 4. Delete the old token with the trash can icon, and only after step 3 is done.

    Checkpoint 6 of 8· Check yourself

    An integration polls the Administrative API every few seconds using a service token created in March 2023. Which rotation plan is correct?

    A service token with the right permissions can still be blocked at the network layer. All service token traffic goes through the account's IP restrictions. A request from an address that isn't on the allowlist gets a 403 with account_access_denied set to true, however powerful the token is. The fix is to add the integration's CIDRs to the allowlist (see [IP allowlisting](lesson:1.2)), not to add permission sets. The is_service_token field in the response confirms which kind of credential was rejected.

    The 403 response a service token receives when its IP is not on the allowlistpython
    {
                "status": {
                    "code": 403,
                    "is_success": False,
                    "user_message": ("Forbidden: Access denied"),
                    "developer_message": None,
                },
                "data": {
                    "account_id": <account_id>,
                    "user_id": <user_id>,
                    "is_service_token": <boolean describing if it's a service token request>,
                    "account_access_denied": True,
                },
            }

    Checkpoint 7 of 8· Check yourself

    Which change resolves a service token's 403 response that has account_access_denied set to True?

    Checkpoint 8 of 8· Exam question

    A security-conscious admin is issuing a service token for a CI pipeline that only needs to trigger dbt Cloud jobs and poll their run status, and must never edit warehouse connections, invite users, or touch billing. Select the choices that describe an appropriate way to scope this token.(Select 2)

    Sources37

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Any authenticated API caller, including a personal access token, can create new service tokens through the API.Why is that wrong?

      A request to create a service token that is authenticated with a PAT fails with a 400 error. New tokens must be created from an existing service token, or in the UI.

      Covered in Creating a service token in Account settings

    2. 2.An admin can come back to Account settings later to copy a service token's value.Why is that wrong?

      The value is shown only at creation. If it isn't saved then, the token has to be replaced with a new one.

      Covered in Creating a service token in Account settings

    3. 3.On Enterprise, every permission set, including v2 Migration Admin, can be assigned to a service token.Why is that wrong?

      v2 Migration Admin is for user accounts only. A token that needs to perform upgrades must use Account Admin.

      Covered in Scoping a token with permission sets and projects

    4. 4.Developer and Starter plans can give a service token the same permission sets as Enterprise.Why is that wrong?

      On Developer and Starter plans, only Semantic Layer permissions can be assigned to service tokens.

      Covered in Scoping a token with permission sets and projects

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Use a service token since this is a production workflow and is acting as a service account and not a user account.”
      ↩︎ Service tokens versus personal access tokens
      “Use PATs to authenticate to any API endpoint that requires user context”
      ↩︎ Service tokens versus personal access tokens
    2. 2.
      “PATs inherit the permissions of the user that created them.”
      ↩︎ Service tokens versus personal access tokens
      “use an existing service token to create new ones instead”
      ↩︎ Creating a service token in Account settings
      “Requests to create a service token authenticated with a PAT return a 400 error”
      ↩︎ Exam trap 1
    3. 3.
      “You can use service account tokens for system-level integrations that do not run on behalf of any one user.”
      ↩︎ Service tokens versus personal access tokens
      “You can generate service tokens if you have a Developer license and account admin permissions.”
      ↩︎ Creating a service token in Account settings
      “you will also be able to choose whether to grant those permissions to all projects in the account or to specific projects.”
      ↩︎ Scoping a token with permission sets and projects
      “Enterprise and Enterprise+ plans can apply any permission sets available to service tokens.”
      ↩︎ Scoping a token with permission sets and projects
      “Old tokens remain valid, but if they are used in high-frequency API invocations, we recommend you rotate them for reduced latency.”
      ↩︎ Rotating tokens and fixing 403 errors
      “While similar to personal access tokens, service account tokens belong to an account rather than a user.”
      ↩︎ Key concept
      “Once the token is generated, you won't be able to view this token again so make sure to save it somewhere safe.”
      ↩︎ Exam trap 2
      “Developer and Starter plans can apply Semantic Layer permissions set to service tokens.”
      ↩︎ Exam trap 4
      “Click the + Create service token button to generate a new token. Enter a name for your token. Add the necessary permissions.”
      ↩︎ Checkpoint
      “Only take this action after the new token is in place to avoid service disruptions.”
      ↩︎ Checkpoint
    4. 4.
      “dbt supports two types of API Tokens: personal access tokens and service account tokens.”
      ↩︎ Service tokens versus personal access tokens
    5. 5.
      “Metadata is intended to be a read-only Discovery API integration permission set.”
      ↩︎ Scoping a token with permission sets and projects
      “v2 Migration Admin — Assign to user accounts only. Cannot be assigned to service tokens.”
      ↩︎ Exam trap 3
    6. 6.
      “any service tokens mapped to that credential in the project will no longer work and will break for any end users.”
      ↩︎ Scoping a token with permission sets and projects
      “Name the token, set permissions to 'Semantic Layer Only' and 'Metadata Only', and click Save.”
      ↩︎ Checkpoint
    7. 7.
      “All service token traffic is subject to IP restrictions.”
      ↩︎ Rotating tokens and fixing 403 errors
      “To resolve this, you should add your third-party integration CIDRs (network addresses) to your allowlist.”
      ↩︎ Checkpoint

    Ready to test yourself?

    Practise the 9 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.