By default the dbt platform CLI defers to the staging environment if the project has one, otherwise to production. To defer to another environment, for example a QA environment, you give its ID as defer-env-id. The ID is a number, and dbt shows it in three places.

Copy and paste

From the URL. Open the environment in dbt platform. The last number in the address is its ID:

https://ab123.us1.dbt.com/deploy/98765/projects/123456/environments/111213
                                  account   project            environment

From the CLI:

dbt environment show
Cloud Configuration:
  Account ID                     98765
  Project ID                     123456
  Project name                   Shop
  Environment ID                 243762
  Environment name               Development
  Defer environment ID           [N/A]

Environment ID here is your development environment. Defer environment ID shows the override, [N/A] when none is set.

From the API, all environments of a project with their IDs and names:

curl -H "Authorization: Token $DBT_CLOUD_TOKEN" \
  "https://$DBT_CLOUD_HOST/api/v3/accounts/$DBT_CLOUD_ACCOUNT_ID/projects/$DBT_CLOUD_PROJECT_ID/environments/"

Set it in dbt_cloud.yml, for the CLI only:

context:
  active-host: "ab123.us1.dbt.com"
  active-project: "123456"
  defer-env-id: "111213"

or in dbt_project.yml, for the CLI and the Studio IDE:

dbt-cloud:
  project-id: "123456"
  defer-env-id: "111213"

Which environment to choose

The other IDs

Write the IDs as quoted strings in YAML, as in the examples. Run dbt environment show after changing them: the values it prints are the ones the CLI uses.

Based on the dbt platform documentation (October 2026); the API path comes from the dbt Cloud provider for Airflow. Not run against a live dbt account.

References