dbt Labs Service Tokens API

The Service Tokens API from dbt Labs, for service tokens.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 6

GET /api/v3/accounts/{account_id}/service-tokens/ List service tokens #
POST /api/v3/accounts/{account_id}/service-tokens/ Create service token #
GET /api/v3/accounts/{account_id}/service-tokens/{id}/ Retrieve service token #
PUT /api/v3/accounts/{account_id}/service-tokens/{id}/ Update service token #
DELETE /api/v3/accounts/{account_id}/service-tokens/{id}/ Destroy service token #
GET /api/v3/accounts/{account_id}/service-tokens/{service_token_id}/permissions/ Retrieve service tokens permission #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/dbtlabs:dbtlabs-service-tokens-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

dbtlabs-service-tokens-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: dbt Cloud API v3 Service Tokens API
  version: 3.0.0
  description: '# How to use this API


    The dbt Cloud API v3 contains endpoints for programmatic administration of your dbt Cloud account.

    With it, you can replicate resources across projects, accounts, and environments, or standardize project

    creation for business teams. For endpoints related to jobs and runs, refer to the

    Discovery API or dbt Cloud API v2.


    The API docs are generated from an openapi spec defined in the

    dbt-cloud-openapi-spec

    repository. If you find issues in these docs or have questions about using the dbt Cloud

    API, please open an issue in the dbt-cloud-openapi-spec repo or contact support@getdbt.com.


    ## Authentication


    To authenticate an application with the dbt Cloud API, navigate to the

    Account Settings page and go to Personal Tokens from the left sidebar. Create one if you don''t have one already.

    If you cannot access this page, confirm that your dbt Cloud account has access to the API,

    and that you are using the hosted version of dbt Cloud. If dbt Cloud is running inside of a VPC

    in an Enterprise account, contact your account manager for help finding your account-scoped Personal Access Token.


    Once you''ve found your Personal Access Token (PAT) for your account, use it in the Authorization header of requests to the dbt Cloud API.

    Be sure to include the `Token` prefix in the Authorization header, or the request will fail with a

    "401 Unauthorized" error.


    *Note: `Bearer` can be used in place of `Token` in the Authorization header. Both syntaxes are equivalent.*


    **Headers**

    ```

    Accept: application/json

    Authorization: Token

    ```


    ## Pagination


    All top-level API resources support bulk fetches using the "list" or `GET` API methods. These API methods accept `limit` and `offset` query parameters that you can use together to paginate results and return a subset of those results.


    * Offset: Specifies how many records to skip. Can be an integer 0 and higher.

    * Limit: Specifies the maximum records you want to retrieve in a single request. Can be an integer up to 100. This limit makes responses easier to handle for servers and people.


    Endpoints that support pagination include some useful extra information about the pagination state. For example:


    ```json

    {

    data: [...],

    extra: {

    // How the results were filtered

    filters: {...},

    // The order of the results

    order_by: "id",

    // The pagination state

    pagination: {

    // The number of records returned in this response

    count: 5,

    // The total number of available records

    total_count: 10,

    }


    }

    }

    ````


    ## Example request


    The following example uses the list projects endpoint to list the projects that your token is authorized to access.

    This request skips the first 10 projects and lists the next 10 projects.

    Be sure to replace `` in the Authorization header with your actual API token and `` with your actual account ID.


    ```bash

    curl --request GET \

    --url ''https://cloud.getdbt.com/api/v3/accounts//projects/?limit=10&offset=5'' \

    --header ''Content-Type: application/json'' \

    --header ''Authorization: Token ''

    ```'
  termsOfService: https://www.getdbt.com/terms-of-service
  contact:
    email: support@getdbt.com
servers:
- url: https://cloud.getdbt.com/
  description: Production (US)
- url: https://{account_prefix}.us1.dbt.com/
  description: Production (US)
  variables:
    account_prefix:
      default: ab123
      description: Your unique account prefix. Can be found on your account settings page.
- url: https://emea.dbt.com/
  description: Production (Europe)
- url: https://au.dbt.com/
  description: Production (AU)
tags:
- name: Service Tokens
paths:
  /api/v3/accounts/{account_id}/service-tokens/:
    get:
      operationId: ListServiceTokens
      description: 'Lists the tokens the caller can see. With `service_principal_id`, that principal''s tokens, or

        none if the caller can''t see it. Without it, a caller who can read service tokens gets the

        account''s tokens as before; anyone else gets the tokens of every principal they can see.'
      parameters:
      - in: path
        name: account_id
        schema:
          type: integer
          format: int64
        required: true
      - in: query
        name: include_related
        schema:
          type: string
        description: Comma-separated list of related objects to include in the response.
      - in: query
        name: limit
        schema:
          type: integer
        description: The maximum number of items to return.
      - in: query
        name: offset
        schema:
          type: integer
        description: The number of items to skip before starting to collect the result set.
      tags:
      - Service Tokens
      security:
      - BearerAuthentication: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListServiceTokenResponse'
          description: ''
      summary: List service tokens
      x-summary-source: derived
      x-operation-id-source: normalized
      x-operation-id-original: List Service Tokens
    post:
      operationId: CreateServiceToken
      description: This endpoint is used to generate a new service token for the account.
      parameters:
      - in: path
        name: account_id
        schema:
          type: integer
          format: int64
        required: true
      - in: query
        name: limit
        schema:
          type: integer
        description: The maximum number of items to return.
      - in: query
        name: offset
        schema:
          type: integer
        description: The number of items to skip before starting to collect the result set.
      tags:
      - Service Tokens
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateServiceTokenRequestRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreateServiceTokenRequestRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateServiceTokenRequestRequest'
        required: true
      security:
      - BearerAuthentication: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailCreateServiceTokenResponse'
          description: ''
      summary: Create service token
      x-summary-source: derived
      x-operation-id-source: normalized
      x-operation-id-original: Create Service Token
  /api/v3/accounts/{account_id}/service-tokens/{id}/:
    get:
      operationId: RetrieveServiceToken
      parameters:
      - in: path
        name: account_id
        schema:
          type: integer
          format: int64
        required: true
      - in: path
        name: id
        schema:
          type: integer
          format: int64
        required: true
      - in: query
        name: include_related
        schema:
          type: string
        description: Comma-separated list of related objects to include in the response.
      tags:
      - Service Tokens
      security:
      - BearerAuthentication: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailServiceTokenResponse'
          description: ''
      summary: Retrieve service token
      x-summary-source: derived
      x-operation-id-source: normalized
      x-operation-id-original: Retrieve Service Token
    put:
      operationId: UpdateServiceToken
      parameters:
      - in: path
        name: account_id
        schema:
          type: integer
          format: int64
        required: true
      - in: path
        name: id
        schema:
          type: integer
          format: int64
        required: true
      tags:
      - Service Tokens
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateServiceTokenRequestRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UpdateServiceTokenRequestRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UpdateServiceTokenRequestRequest'
        required: true
      security:
      - BearerAuthentication: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailServiceTokenResponse'
          description: ''
      summary: Update service token
      x-summary-source: derived
      x-operation-id-source: normalized
      x-operation-id-original: Update Service Token
    delete:
      operationId: DestroyServiceToken
      parameters:
      - in: path
        name: account_id
        schema:
          type: integer
          format: int64
        required: true
      - in: path
        name: id
        schema:
          type: integer
          format: int64
        required: true
      tags:
      - Service Tokens
      security:
      - BearerAuthentication: []
      responses:
        '204':
          description: No response body
      summary: Destroy service token
      x-summary-source: derived
      x-operation-id-source: normalized
      x-operation-id-original: Destroy Service Token
  /api/v3/accounts/{account_id}/service-tokens/{service_token_id}/permissions/:
    get:
      operationId: RetrieveServiceTokensPermission
      description: List permissions of a given ServiceToken for an account.
      parameters:
      - in: path
        name: account_id
        schema:
          type: integer
          format: int64
        required: true
      - in: query
        name: include_related
        schema:
          type: string
        description: Comma-separated list of related objects to include in the response.
      - in: path
        name: service_token_id
        schema:
          type: integer
          format: int64
        required: true
      tags:
      - Service Tokens
      security:
      - BearerAuthentication: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceTokenPermissionListEnveloped'
          description: ''
      summary: Retrieve service tokens permission
      x-summary-source: derived
      x-operation-id-source: normalized
      x-operation-id-original: Retrieve Service Tokens Permission
components:
  schemas:
    V3ResponseExtraData:
      title: V3ResponseExtraData
      type: object
      properties:
        filters:
          $ref: '#/components/schemas/V3RequestParams'
        order_by:
          title: Order By
          anyOf:
          - type: string
          - type: array
            items:
              type: string
        pagination:
          $ref: '#/components/schemas/V3ResponsePagination'
      required:
      - pagination
    ServiceTokenPermissionGrant:
      title: ServiceTokenPermissionGrant
      type: object
      properties:
        permission_set:
          $ref: '#/components/schemas/PredefinedPermissionSet'
        project_id:
          title: Project Id
          description: The project to which the permissions are scoped. If none, then the permissions apply to all projects.
          format: int64
          type: integer
        writable_environment_categories:
          title: Writable Environment Categories
          description: 'Environment types the permission set can write to. Allowed values: development, other, staging, production, all. `other` is shown as General in the dbt UI.'
          type: array
          items:
            type: string
      required:
      - permission_set
    CreateServiceTokenRequestRequest:
      title: CreateServiceTokenRequest
      description: 'Base class for all request payloads.

        It is expected that each endpoint extends this class to define its own payload format'
      type: object
      properties:
        name:
          title: Name
          description: The name of the service token
          type: string
        permission_grants:
          title: Permission Grants
          description: Permissions to assign to the service token
          type: array
          items:
            $ref: '#/components/schemas/ServiceTokenPermissionGrant'
        expires_at:
          title: Expires At
          description: When the token stops authenticating. Omit for no expiry. Must be in the future, no more than 365 days out, with a timezone offset.
          type: string
          format: date-time
        service_principal_id:
          title: Service Principal Id
          description: Issues the token on this service principal, which holds its permissions. Takes no permission grants.
          format: int64
          type: integer
        metadata_only:
          title: Metadata Only
          description: Deprecated. Use the metadata_only permission set instead.
          default: false
          type: boolean
        webhooks_only:
          title: Webhooks Only
          default: false
          type: boolean
      required:
      - name
    V3ResponsePagination:
      title: V3ResponsePagination
      type: object
      properties:
        count:
          title: Count
          type: integer
        total_count:
          title: Total Count
          type: integer
      required:
      - count
      - total_count
    ListServiceTokenResponse:
      title: ListServiceTokenResponse
      type: object
      properties:
        status:
          $ref: '#/components/schemas/Status'
        data:
          title: Data
          type: array
          items:
            $ref: '#/components/schemas/ServiceToken'
        extra:
          $ref: '#/components/schemas/V3ResponseExtraData'
        error_code:
          title: Error Code
          type: integer
      required:
      - data
      - extra
    ServiceToken:
      title: ServiceToken
      type: object
      properties:
        id:
          title: Id
          format: int64
          type: integer
        created_at:
          title: Created At
          type: string
          format: date-time
        updated_at:
          title: Updated At
          type: string
          format: date-time
        account_id:
          title: Account Id
          description: The account the service token is associated with
          format: int64
          type: integer
        uid:
          title: Uid
          description: The unique identifier for the service token
          type: string
        name:
          title: Name
          description: The name of the service token
          type: string
        state:
          title: State
          description: The liveness state of the service token. A value of 1 means this entity is active and a value of 2 means this entity is deleted
          type: integer
        permission_grants:
          title: Permission Grants
          description: The permissions to be assigned to the service token
          type: array
          items:
            $ref: '#/components/schemas/ServiceTokenPermissionGrant'
        last_used:
          title: Last Used
          description: The time the service token was last used
          type: string
          format: date-time
        expires_at:
          title: Expires At
          description: When the token stops authenticating. Null means it never expires.
          type: string
          format: date-time
        semantic_layer_credentials:
          title: Semantic Layer Credentials
          description: The semantic layer credentials associated with the service token
          type: array
          items:
            type: object
        metadata_only:
          title: Metadata Only
          description: Deprecated. Use the metadata_only permission set instead.
          default: false
          type: boolean
        webhooks_only:
          title: Webhooks Only
          default: false
          type: boolean
        service_principal_id:
          title: Service Principal Id
          description: The service principal the token acts as, if any.
          format: int64
          type: integer
        is_expired:
          title: Is Expired
          default: false
          type: boolean
      required:
      - id
      - created_at
      - updated_at
      - account_id
      - uid
      - name
      - state
    Status:
      title: Status
      type: object
      properties:
        code:
          title: Code
          type: integer
        is_success:
          title: Is Success
          type: boolean
        user_message:
          title: User Message
          type: string
        developer_message:
          title: Developer Message
          default: ''
          type: string
    DetailCreateServiceTokenResponse:
      title: DetailCreateServiceTokenResponse
      type: object
      properties:
        status:
          $ref: '#/components/schemas/Status'
        data:
          $ref: '#/components/schemas/CreateServiceToken'
        extra:
          title: Extra
          type: object
        error_code:
          title: Error Code
          type: integer
      required:
      - data
    V3RequestParams:
      title: V3RequestParams
      description: 'Base class for all URL request parameters.

        It is expected that each endpoint extends this class to define its own parameters format'
      type: object
      properties: {}
    PredefinedPermissionSet:
      title: PredefinedPermissionSet
      description: An enumeration.
      enum:
      - account_admin
      - account_viewer
      - admin
      - analyst
      - analyst_read
      - billing_admin
      - cost_insights_admin
      - cost_insights_viewer
      - cost_management_admin
      - cost_management_viewer
      - database_admin
      - developer
      - fusion_admin
      - git_admin
      - job_admin
      - job_creator
      - job_runner
      - job_viewer
      - manage_marketplace_apps
      - member
      - metadata_only
      - notification_manager
      - owner
      - project_creator
      - readonly
      - scim_only
      - security_admin
      - semantic_layer_only
      - stakeholder
      - team_admin
      - webhooks_only
      type: string
    CreateServiceToken:
      title: CreateServiceToken
      type: object
      properties:
        id:
          title: Id
          format: int64
          type: integer
        created_at:
          title: Created At
          type: string
          format: date-time
        updated_at:
          title: Updated At
          type: string
          format: date-time
        account_id:
          title: Account Id
          description: The account the service token is associated with
          format: int64
          type: integer
        uid:
          title: Uid
          description: The unique identifier for the service token
          type: string
        name:
          title: Name
          description: The name of the service token
          type: string
        state:
          title: State
          description: The liveness state of the service token. A value of 1 means this entity is active and a value of 2 means this entity is deleted
          type: integer
        permission_grants:
          title: Permission Grants
          description: The permissions to be assigned to the service token
          type: array
          items:
            $ref: '#/components/schemas/ServiceTokenPermissionGrant'
        last_used:
          title: Last Used
          description: The time the service token was last used
          type: string
          format: date-time
        expires_at:
          title: Expires At
          description: When the token stops authenticating. Null means it never expires.
          type: string
          format: date-time
        semantic_layer_credentials:
          title: Semantic Layer Credentials
          type: array
          items:
            type: object
        metadata_only:
          title: Metadata Only
          description: Deprecated. Use the metadata_only permission set instead.
          default: false
          type: boolean
        webhooks_only:
          title: Webhooks Only
          default: false
          type: boolean
        service_principal_id:
          title: Service Principal Id
          description: The service principal the token acts as, if any.
          format: int64
          type: integer
        is_expired:
          title: Is Expired
          default: false
          type: boolean
        token:
          title: Token
          description: The hashed token secret
          type: string
        token_string:
          title: Token String
          description: The full token string used to authenticate clients
          type: string
        last_identify:
          title: Last Identify
          type: string
          format: date-time
        user_id:
          title: User Id
          format: int64
          type: integer
        user:
          title: User
          type: object
        type:
          $ref: '#/components/schemas/ServiceTokenType'
        service_token_permissions:
          title: Service Token Permissions
          type: array
          items:
            type: object
      required:
      - id
      - created_at
      - updated_at
      - account_id
      - uid
      - name
      - state
      - token_string
    UpdateServiceTokenRequestRequest:
      title: UpdateServiceTokenRequest
      description: Request body for updating a service token name.
      type: object
      properties:
        name:
          title: Name
          description: The name of the service token
          type: string
      required:
      - name
    CustomPagination:
      type: object
      properties:
        count:
          type: integer
          description: Number of items in the current page
        total_count:
          type: integer
          description: Total number of items
      required:
      - count
      - total_count
    ServiceTokenPermissionResponse:
      type: object
      properties:
        id:
          type: integer
          format: int64
          readOnly: true
        account_id:
          type: integer
          format: int64
        service_token_id:
          type: integer
          format: int64
        project_id:
          type: integer
          format: int64
        all_projects:
          type: boolean
        permission_set:
          $ref: '#/components/schemas/PermissionSetEnum'
        state:
          example: 1
          type: integer
          default: 1
          description: A value of 1 means this entity is active and a value of 2 means this entity is deleted
        writable_environment_categories:
          type: array
          items:
            type: string
          default: []
          description: 'Environment types the permission set can write to. Allowed values: development, other, staging, production, all. `other` is shown as General in the dbt UI.'
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
      required:
      - created_at
      - id
      - updated_at
    PermissionSetEnum:
      enum:
      - account_admin
      - account_viewer
      - admin
      - analyst
      - analyst_read
      - billing_admin
      - cost_insights_admin
      - cost_insights_viewer
      - cost_management_admin
      - cost_management_viewer
      - database_admin
      - developer
      - fusion_admin
      - git_admin
      - job_admin
      - job_creator
      - job_runner
      - job_viewer
      - manage_marketplace_apps
      - member
      - metadata_only
      - notification_manager
      - owner
      - project_creator
      - readonly
      - scim_only
      - security_admin
      - semantic_layer_only
      - stakeholder
      - team_admin
      - webhooks_only
      type: string
      description: '* `account_admin` - ACCOUNT_ADMIN

        * `account_viewer` - ACCOUNT_VIEWER

        * `admin` - ADMIN

        * `analyst` - ANALYST

        * `analyst_read` - ANALYST_READ

        * `billing_admin` - BILLING_ADMIN

        * `cost_insights_admin` - COST_INSIGHTS_ADMIN

        * `cost_insights_viewer` - COST_INSIGHTS_VIEWER

        * `cost_management_admin` - COST_MANAGEMENT_ADMIN

        * `cost_management_viewer` - COST_MANAGEMENT_VIEWER

        * `database_admin` - DATABASE_ADMIN

        * `developer` - DEVELOPER

        * `fusion_admin` - V2_MIGRATION_ADMIN

        * `git_admin` - GIT_ADMIN

        * `job_admin` - JOB_ADMIN

        * `job_creator` - JOB_CREATOR

        * `job_runner` - JOB_RUNNER

        * `job_viewer` - JOB_VIEWER

        * `manage_marketplace_apps` - MANAGE_MARKETPLACE_APPS

        * `member` - MEMBER

        * `metadata_only` - METADATA_ONLY

        * `notification_manager` - NOTIFICATION_MANAGER

        * `owner` - OWNER

        * `project_creator` - PROJECT_CREATOR

        * `readonly` - READONLY

        * `scim_only` - SCIM_ONLY

        * `security_admin` - SECURITY_ADMIN

        * `semantic_layer_only` - SEMANTIC_LAYER_ONLY

        * `stakeholder` - STAKEHOLDER

        * `team_admin` - TEAM_ADMIN

        * `webhooks_only` - WEBHOOKS_ONLY'
    Extra:
      type: object
      properties:
        filters:
          type: object
          additionalProperties: {}
          description: Filters applied to the request
        order_by:
          type: string
          description: Ordering applied to the request
        pagination:
          $ref: '#/components/schemas/CustomPagination'
      required:
      - filters
      - order_by
      - pagination
    ServiceTokenPermissionListEnveloped:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ServiceTokenPermissionResponse'
        extra:
          $ref: '#/components/schemas/Extra'
        status:
          $ref: '#/components/schemas/ResponseStatus'
      required:
      - data
      - extra
      - status
    ResponseStatus:
      type: object
      properties:
        code:
          type: integer
          default: 200
          description: HTTP status code
        is_success:
          type: boolean
          description: Whether the request was successful or not
        user_message:
          type: string
          description: End-user friendly success or error message
        developer_message:
          type: string
          description: Developer friendly success or error message
      required:
      - developer_message
      - is_success
      - user_message
    ServiceTokenType:
      title: ServiceTokenType
      description: An enumeration.
      enum:
      - 1
      - 2
      - 3
      - 4
      type: integer
    DetailServiceTokenResponse:
      title: DetailServiceTokenResponse
      type: object
      properties:
        status:
          $ref: '#/components/schemas/Status'
        data:
          $ref: '#/components/schemas/ServiceToken'
        extra:
          title: Extra
          type: object
        error_code:
          title: Error Code
          type: integer
      required:
      - data
  securitySchemes:
    BearerAuthentication:
      type: http
      scheme: bearer
      bearerFormat: Bearer