---
title: "Update dbt environment"
method: PUT
path: "/api/v1/connections/{connectionId}/dbt/environments/{environmentId}"
tags: ["Connections"]
---

# Update dbt environment

`PUT /api/v1/connections/{connectionId}/dbt/environments/{environmentId}`

Update an existing dbt environment for a connection.

## Path parameters

- `connectionId` string, uuid, required — Connection ID
- `environmentId` string, uuid, required — Environment ID

## Request body

- DbtEnvironmentUpdateBody
  - `isDeferralEnabled` boolean — Whether to enable dbt deferral for this environment. Ignored (forced to false) for the default (production) environment.
  - `name` string, required — Environment name
  - `ownerId` string, nullable — User ID of the environment owner. Used to mark development environments belonging to a specific user.
  - `targetDatabase` string, nullable — Target database override
  - `targetName` string, nullable — Target name override
  - `targetRole` string, nullable — Target role override
  - `targetSchema` string, required — Target schema for this environment
  - `variables` DbtEnvironmentVariableUpdateOrNew[] — Environment variables. Variables with an id update existing ones; variables without an id create new ones.
    - union
      - DbtEnvironmentVariableUpdate — Update an existing variable by ID. Variable names cannot be changed after creation.
        - `id` string, uuid, required — Existing variable ID
        - `isSecret` boolean, required — Whether the variable value is secret
        - `value` string, nullable — Updated variable value. Omit or set to null to keep the existing value for secret variables.
      - DbtEnvironmentVariable
        - `isSecret` boolean, required — Whether the variable value is secret
        - `name` string, required — Variable name
        - `value` string, required — Variable value

## Response `200`

dbt environment updated successfully

- object — Updated dbt environment
  - `id` string, uuid, required — Unique environment identifier
  - `isDefaultEnvironment` boolean, required — Whether this is the default environment
  - `isDeferralEnabled` boolean, required — Whether dbt deferral is enabled for this environment. Always false for the default (production) environment — the backend rejects enabling it there.
  - `name` string, required — Environment name
  - `ownerId` string, nullable, required — User ID of the environment owner, or null if not a personal environment
  - `targetDatabase` string, nullable, required — Target database override
  - `targetName` string, nullable, required — Target name override
  - `targetRole` string, nullable, required — Target role override
  - `targetSchema` string, required — Target schema
  - `variables` DbtEnvironmentResponseVariable[], required — Environment variables
    - `id` string, uuid, required — Variable ID
    - `isSecret` boolean, required — Whether the variable value is secret
    - `name` string, required — Variable name
    - `value` string, nullable, required — Variable value (null for secret variables)

## Other responses

- `400` — Invalid request body
- `401` — Authentication required
- `403` — Permission denied or connection does not support dbt
- `404` — Connection or environment not found

---

[API](https://skmtc.net/omniapp/apis/omni-api.md) · [All operations](https://skmtc.net/omniapp/apis/omni-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/omniapp/omni-api/versions/de7cac8b5983/schema)
