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

# Create dbt environment

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

Create a new dbt environment for a connection.

## Path parameters

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

## Request body

- DbtEnvironmentCreateBody
  - `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` DbtEnvironmentVariable[] — Environment variables
    - `isSecret` boolean, required — Whether the variable value is secret
    - `name` string, required — Variable name
    - `value` string, required — Variable value

## Response `201`

dbt environment created successfully

- object — Created 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 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)
