---
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}`

## Request

- Base URL: `https://blobsrus.omniapp.co/api`
- URL: `https://blobsrus.omniapp.co/api/v1/connections/{connectionId}/dbt/environments/{environmentId}`
- Auth: HTTP bearer

<Note>
  The permissions required depend on who owns the environment:

  - **Your own personal environment** - **Restricted Querier** permissions or higher on the connection
  - **A shared environment** - **Connection Admin** or **Organization Admin** permissions
  - **Another user's personal environment** - **Organization Admin** permissions
</Note>

Update an existing dbt environment on the specified connection. This request replaces the environment: `name` and `targetSchema` are required, and any omitted optional field is reset to its default. In particular, omitting `ownerId` sets it to `null`, which converts the environment to a shared one and requires **Connection Admin** permissions - send your own membership ID when updating your own environment.

## Path parameters

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

## Request body

- object
  - `name` string, required: The name of the dbt environment
  - `targetSchema` string, required: 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: Defines the owner of the environment, which also determines whether the environment is personal or shared. Defaults to `null` when omitted, so always send the current owner's ID unless you intend to change it. - **Personal environment** - Use the organization membership ID of the user that owns the environment, not their user ID. **Organization Admin** permissions are required to set the ID of a user other than the authenticating user. Get your own membership ID from the [Who Am I API](/api/who-am-i/get-current-identity-and-permissions), or another user's from the [Get model roles API](/api/user-model-roles/retrieve-user-model-roles). - **Shared environment** - Set to `null`. Requires **Connection Admin** or **Organization Admin** permissions.
  - `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 when creating a variable. It can be an empty string unless `isSecret` is `true`. When updating an existing variable, omit this field or send `null` to keep the current value. An empty string clears a non-secret variable's value but keeps a secret variable's current value.
    - `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 organization membership 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
- `401`: Missing or invalid authentication
- `403`: Forbidden Possible causes: - Insufficient permissions. Only the environment's owner, a **Connection Admin** (shared environments), or an **Organization Admin** can update it. - Non-admin user attempting to set `ownerId` to `null` or to another user
- `404`: Connection, environment, or owner not found
- `429`: Too Many Requests - Rate limit exceeded (60 requests/minute)

## Changes

- **2026-11-03** `43290040f88f`: 2 breaking
  - the request property `name` became required
  - the request property `targetSchema` became required

[Operation history](https://skmtc.dev/omni/apis/omni-api/changes/v1/connections/:connectionId/dbt/environments/:environmentId/put.md)

---

[API](https://skmtc.dev/omni/apis/omni-api.md) - [All operations](https://skmtc.dev/omni/apis/omni-api/llms.txt) - [OpenAPI document](https://skmtc.dev/omni/apis/omni-api/revisions/43290040f88f?raw)
