dbt Labs Environments API
The Environments API from dbt Labs, for environments.
Operations 6
DELETE
/api/v3/accounts/{account_id}/environments/{environment_id}/sao-cache/
Delete environment SAO cache
#
The Environments API from dbt Labs, for environments.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
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.curl "https://apis.io/api/v1/apis/dbtlabs:dbtlabs-environments-api"
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.
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: 3.2.0
info:
title: dbt Cloud API v3 Environments 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: Environments
paths:
/api/v3/accounts/{account_id}/environments/{environment_id}/sao-cache/:
delete:
operationId: DeleteEnvironmentSAOCache
description: Clear the environment SAO (State Aware Orchestration) cache in Redis for the given environment
parameters:
- in: path
name: account_id
schema:
type: integer
format: int64
required: true
- in: path
name: environment_id
schema:
type: integer
format: int64
required: true
tags:
- Environments
security:
- BearerAuthentication: []
responses:
'204':
description: No response body
summary: Delete environment SAO cache
x-summary-source: derived
x-operation-id-source: normalized
x-operation-id-original: Delete Environment SAO Cache
/api/v3/accounts/{account_id}/projects/{project_id}/environments/:
get:
operationId: ListEnvironments
description: List Environments
parameters:
- in: path
name: account_id
schema:
type: integer
format: int64
required: true
- in: query
name: credentials_id
schema:
type: integer
format: int64
- in: query
name: dbt_version
schema:
type: string
- in: query
name: dbt_version__in
schema:
type: array
items:
type: string
- in: query
name: deployment_type
schema:
type: string
enum:
- production
- staging
- in: query
name: deployment_type__in
schema:
type: array
items:
type: string
enum:
- production
- staging
- in: query
name: id__gt
schema:
type: integer
format: int64
- in: query
name: include_related
schema:
type: string
description: 'Comma-separated list of related objects to include in the response. Available: project, connection, credentials, repository.'
- in: query
name: limit
schema:
type: integer
default: 100
- in: query
name: name
schema:
type: string
- in: query
name: name__icontains
schema:
type: string
- in: query
name: offset
schema:
type: integer
default: 0
- in: query
name: order_by
schema:
type: string
default: id
description: Field to order results by. Prefix with '-' for descending order.
- in: query
name: pk
schema:
type: integer
format: int64
- in: query
name: pk__in
schema:
type: array
items:
type: integer
format: int64
- in: path
name: project_id
schema:
type: integer
format: int64
required: true
- in: query
name: project_id__in
schema:
type: array
items:
type: integer
format: int64
- in: query
name: state
schema:
oneOf:
- type: integer
- type: string
enum:
- active
- deleted
- all
default: active
description: "Filters by soft deletion state.\n <ul>\n <li>\n <strong>\"active\"</strong> / <strong>1</strong>: Only active resources\n </li>\n <li>\n <strong>\"deleted\"</strong> / <strong>2</strong>: Only deleted resources\n </li>\n <li>\n <strong>\"all\"</strong>: All resources\n </li>\n </ul>\n "
- in: query
name: type
schema:
type: string
tags:
- Environments
security:
- BearerAuthentication: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EnvironmentV3ListEnveloped'
description: ''
summary: List environments
x-summary-source: derived
x-operation-id-source: normalized
x-operation-id-original: List Environments
post:
operationId: CreateEnvironment
description: Create a new Environment
parameters:
- in: path
name: account_id
schema:
type: integer
format: int64
required: true
- in: path
name: project_id
schema:
type: integer
format: int64
required: true
tags:
- Environments
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EnvironmentV3Request'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/EnvironmentV3Request'
multipart/form-data:
schema:
$ref: '#/components/schemas/EnvironmentV3Request'
required: true
security:
- BearerAuthentication: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EnvironmentV3Enveloped'
description: ''
summary: Create environment
x-summary-source: derived
x-operation-id-source: normalized
x-operation-id-original: Create Environment
/api/v3/accounts/{account_id}/projects/{project_id}/environments/{id}/:
get:
operationId: RetrieveEnvironment
description: Retrieve an Environment
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. Available: project, connection, credentials, repository.'
- in: path
name: project_id
schema:
type: integer
format: int64
required: true
tags:
- Environments
security:
- BearerAuthentication: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EnvironmentV3Enveloped'
description: ''
summary: Retrieve environment
x-summary-source: derived
x-operation-id-source: normalized
x-operation-id-original: Retrieve Environment
post:
operationId: UpdateEnvironment
description: Replace an Environment. This is a full replace operation — all fields must be provided. Any omitted fields will be reset to their default values (typically null). To avoid unintentionally clearing fields such as credentials_id or connection_id, first retrieve the environment with a GET request and include all current values in the update payload.
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: path
name: project_id
schema:
type: integer
format: int64
required: true
tags:
- Environments
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EnvironmentV3Request'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/EnvironmentV3Request'
multipart/form-data:
schema:
$ref: '#/components/schemas/EnvironmentV3Request'
required: true
security:
- BearerAuthentication: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EnvironmentV3Enveloped'
description: ''
summary: Update environment
x-summary-source: derived
x-operation-id-source: normalized
x-operation-id-original: Update Environment
delete:
operationId: DestroyEnvironment
description: Delete an Environment
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: path
name: project_id
schema:
type: integer
format: int64
required: true
tags:
- Environments
security:
- BearerAuthentication: []
responses:
'204':
description: No response body
summary: Destroy environment
x-summary-source: derived
x-operation-id-source: normalized
x-operation-id-original: Destroy Environment
components:
schemas:
EnvironmentV3Enveloped:
type: object
properties:
data:
$ref: '#/components/schemas/EnvironmentV3Response'
status:
$ref: '#/components/schemas/ResponseStatus'
required:
- data
- status
AdapterVersionEnum:
enum:
- apache_spark_v0
- databricks_spark_v0
- databricks_v0
- trino_v0
- snowflake_v0
- bigquery_v0
- bigquery_v1
- postgres_v0
- redshift_v0
- salesforce_v0
- synapse_v0
- fabric_v0
- athena_v0
- teradata_v0
- clickhouse_v0
type: string
description: '* `apache_spark_v0` - apache_spark_v0
* `databricks_spark_v0` - databricks_spark_v0
* `databricks_v0` - databricks_v0
* `trino_v0` - trino_v0
* `snowflake_v0` - snowflake_v0
* `bigquery_v0` - bigquery_v0
* `bigquery_v1` - bigquery_v1
* `postgres_v0` - postgres_v0
* `redshift_v0` - redshift_v0
* `salesforce_v0` - salesforce_v0
* `synapse_v0` - synapse_v0
* `fabric_v0` - fabric_v0
* `athena_v0` - athena_v0
* `teradata_v0` - teradata_v0
* `clickhouse_v0` - clickhouse_v0'
ConnectionTypeEnum:
enum:
- postgres
- redshift
- snowflake
- bigquery
- adapter
type: string
description: '* `postgres` - postgres
* `redshift` - redshift
* `snowflake` - snowflake
* `bigquery` - bigquery
* `adapter` - adapter'
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
Type76eEnum:
enum:
- development
- deployment
type: string
description: '* `development` - DEVELOPMENT
* `deployment` - DEPLOYMENT'
EnvironmentV3Response:
type: object
properties:
id:
type: integer
format: int64
readOnly: true
account_id:
type: integer
format: int64
description: The account the environment is associated with
project_id:
type: integer
format: int64
description: The project the environment is associated with
credentials_id:
type: integer
format: int64
description: The id of the associated credentials. Null for development environments. Must be included when updating a deployment environment or the value will be reset to null.
connection_id:
type: integer
format: int64
description: The id of the associated connection. Must be included when updating an environment or the value will be reset to null.
extended_attributes_id:
type: integer
format: int64
name:
type: string
default: New Environment
description: The name of the environment
dbt_version:
type: string
default: latest
description: The default dbt Version to use for this environment
raw_dbt_version:
type: string
readOnly: true
type:
allOf:
- $ref: '#/components/schemas/Type76eEnum'
default: deployment
use_custom_branch:
type: boolean
default: false
custom_branch:
type: string
supports_docs:
type: boolean
default: false
deployment_type:
$ref: '#/components/schemas/DeploymentTypeEnum'
is_deferrable:
type: boolean
readOnly: true
enable_model_query_history:
type: boolean
default: false
enable_dbt_state:
type: boolean
default: false
enable_dbt_state_model_lock:
type: boolean
default: true
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
created_at:
type: string
format: date-time
readOnly: true
updated_at:
type: string
format: date-time
readOnly: true
project:
allOf:
- $ref: '#/components/schemas/Project'
readOnly: true
primary_profile_id:
type: integer
format: int64
description: The id of the primary profile for this environment
credentials:
allOf:
- $ref: '#/components/schemas/PostgresCredentials'
readOnly: true
fusion_readiness:
readOnly: true
required:
- created_at
- credentials
- fusion_readiness
- id
- is_deferrable
- project
- raw_dbt_version
- updated_at
Project:
type: object
properties:
name:
type: string
description: The name of the project
account_id:
type: integer
format: int64
description: The account the project is associated with
description:
type: string
description: The description of the project
connection_id:
type: integer
format: int64
description: The active connection
repository_id:
type: integer
format: int64
description: The active repository
semantic_layer_config_id:
type: integer
format: int64
description: The active semantic layer configuration
state:
example: 1
type: integer
description: A value of 1 means this entity is active and a value of 2 means this entity is deleted
dbt_project_subdirectory:
type: string
description: The path in the associated repository where a dbt project can be found
docs_job_id:
type: integer
format: int64
description: The job used for docs generation
freshness_job_id:
type: integer
format: int64
description: The job used for source freshness generation
type:
allOf:
- $ref: '#/components/schemas/Type24eEnum'
description: 'The type of the project
* `0` - DEFAULT
* `1` - HYBRID'
required:
- account_id
- name
- state
- type
Type24eEnum:
enum:
- 0
- 1
type: integer
description: '* `0` - DEFAULT
* `1` - HYBRID'
PostgresCredentials:
type: object
properties:
account_id:
type: integer
format: int64
project_id:
type: integer
format: int64
type:
$ref: '#/components/schemas/ConnectionTypeEnum'
state:
example: 1
type: integer
description: A value of 1 means this entity is active and a value of 2 means this entity is deleted
threads:
type: integer
username:
type: string
default_schema:
type: string
target_name:
type: string
adapter_version:
allOf:
- $ref: '#/components/schemas/AdapterVersionEnum'
description: 'The version of the adapter used to create this connection. Can use instead of adapter_id.
* `apache_spark_v0` - apache_spark_v0
* `databricks_spark_v0` - databricks_spark_v0
* `databricks_v0` - databricks_v0
* `trino_v0` - trino_v0
* `snowflake_v0` - snowflake_v0
* `bigquery_v0` - bigquery_v0
* `bigquery_v1` - bigquery_v1
* `postgres_v0` - postgres_v0
* `redshift_v0` - redshift_v0
* `salesforce_v0` - salesforce_v0
* `synapse_v0` - synapse_v0
* `fabric_v0` - fabric_v0
* `athena_v0` - athena_v0
* `teradata_v0` - teradata_v0
* `clickhouse_v0` - clickhouse_v0'
required:
- account_id
- default_schema
- state
- target_name
- threads
- type
- username
EnvironmentV3Request:
type: object
properties:
account_id:
type: integer
format: int64
description: The account the environment is associated with
project_id:
type: integer
format: int64
description: The project the environment is associated with
credentials_id:
type: integer
format: int64
description: The id of the associated credentials. Null for development environments. Must be included when updating a deployment environment or the value will be reset to null.
connection_id:
type: integer
format: int64
description: The id of the associated connection. Must be included when updating an environment or the value will be reset to null.
extended_attributes_id:
type: integer
format: int64
name:
type: string
minLength: 1
description: The name of the environment
dbt_version:
type: string
minLength: 1
description: The default dbt Version to use for this environment
type:
$ref: '#/components/schemas/Type76eEnum'
use_custom_branch:
type: boolean
custom_branch:
type: string
minLength: 1
supports_docs:
type: boolean
deployment_type:
$ref: '#/components/schemas/DeploymentTypeEnum'
enable_model_query_history:
type: boolean
default: false
enable_dbt_state:
type: boolean
default: false
enable_dbt_state_model_lock:
type: boolean
state:
example: 1
type: integer
description: A value of 1 means this entity is active and a value of 2 means this entity is deleted
primary_profile_id:
type: integer
format: int64
description: The id of the primary profile for this environment
required:
- account_id
- dbt_version
- enable_dbt_state_model_lock
- name
- project_id
- state
- supports_docs
- type
- use_custom_branch
DeploymentTypeEnum:
enum:
- production
- staging
type: string
description: '* `production` - production
* `staging` - staging'
EnvironmentV3ListEnveloped:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/EnvironmentV3Response'
extra:
$ref: '#/components/schemas/Extra'
status:
$ref: '#/components/schemas/ResponseStatus'
required:
- data
- extra
- status
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
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
securitySchemes:
BearerAuthentication:
type: http
scheme: bearer
bearerFormat: Bearer