---
title: "Create dbt environment"
method: POST
path: "/v1/connections/{connectionId}/dbt/environments"
tags: ["dbt"]
---

# Create dbt environment

`POST /v1/connections/{connectionId}/dbt/environments`

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

Create a new dbt environment on the specified connection, enabling programmatic environment management.

A dbt environment allows you to connect Omni to a specific dbt project and manage dbt-related functionality within the connection context.

## Path parameters

- `connectionId` 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. Defaults to `false`. 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. **Note**: While `variables` is not required, at least one variable object must be defined if `variables` is included in the request body.
    - `name` string, required — Variable name
    - `value` string, required — Variable value
    - `isSecret` boolean, required — Whether the variable value is secret

## Response `201`

dbt environment created 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 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)
