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

# Update dbt environment

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

<Note>
  This endpoint requires **Connection Admin** permissions for the connection.
</Note>

Update an existing dbt environment on the specified connection. All fields are optional; only the provided fields will be updated.

## Path parameters

- `connectionId` string, uuid, required
- `environmentId` string, uuid, required

## Request body

- object
  - `name` string — The name of the dbt environment
  - `targetSchema` string — The target schema for the environment
  - `isDeferralEnabled` boolean — Whether deferral is enabled for this environment. Ignored (forced to `false`) for the default (production) environment.
  - `ownerId` string, uuid, nullable — **Only valid with Organization API keys.** The user ID of the owner for the dbt environment. Personal Access Tokens (PATs) automatically use the authenticated user as the owner.
  - `targetDatabase` string, nullable — Target database override
  - `targetName` string, nullable — Target name override
  - `targetRole` string, nullable — Target role override
  - `variables` object[] — Environment variables for the dbt environment. To update existing variables, include the variable `id` field. New variables should omit the `id` field.
    - `id` string, uuid — Variable identifier. Required for updating existing variables, otherwise omit.
    - `name` string, required — Variable name. Required for new variables, otherwise omit.
    - `value` string, required — Variable value. Required for new variables, otherwise omit or set to `null` to keep the existing value for secrets.
    - `isSecret` boolean, required — Whether the variable value is secret. Required for new and updating existing variables.

## Response `200`

dbt environment updated successfully

- DbtEnvironment
  - `id` string, uuid — Unique identifier of the dbt environment
  - `name` string — The name of the dbt environment
  - `isDefaultEnvironment` boolean — Whether this is the default environment
  - `isDeferralEnabled` boolean — Whether deferral is enabled for this environment. Ignored (forced to `false`) for the default (production) environment.
  - `ownerId` string, uuid, nullable — The user ID of the owner of the dbt environment, or null
  - `targetDatabase` string, nullable — Target database override
  - `targetName` string, nullable — Target name override
  - `targetRole` string, nullable — Target role override
  - `targetSchema` string — Target schema for the environment
  - `variables` object[] — Environment variables
    - `id` string, uuid — Variable identifier
    - `name` string — Variable name
    - `value` string, nullable — Variable value. If `isSecret: true`, this value will be `null` in responses to protect sensitive information.
    - `isSecret` boolean — Whether the variable value is secret.

## Other responses

- `400` — Bad Request Possible error messages: - Invalid request body - User specified in `ownerId` is not a member of the organization
- `401` — Missing or invalid authentication
- `403` — Forbidden Possible causes: - Insufficient permissions. **Connection Admin** permissions for the connection are required. - Non-admin user attempting to set `ownerId` for another user
- `404` — Connection or dbt environment not found
- `429` — Too Many Requests - Rate limit exceeded (60 requests/minute)

---

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