---
title: "POST /api/v3/accounts/{account_id}/projects/{project_id}/environment-variables/"
method: POST
path: "/api/v3/accounts/{account_id}/projects/{project_id}/environment-variables/"
tags: ["Environment Variables"]
---

# POST /api/v3/accounts/{account_id}/projects/{project_id}/environment-variables/

`POST /api/v3/accounts/{account_id}/projects/{project_id}/environment-variables/`

## Request

- Base URL: `https://cloud.getdbt.com`
- URL: `https://cloud.getdbt.com/api/v3/accounts/{account_id}/projects/{project_id}/environment-variables/`
- Auth: HTTP bearer

## Path parameters

- `account_id` integer, required
- `project_id` integer, required

## Request body

- CustomEnvironmentVariableRequest
  - `account_id` integer, required
  - `project_id` integer, required
  - `name` string, required
  - `type` 'project' | 'environment' | 'job' | 'user', required: * `project` - project * `environment` - environment * `job` - job * `user` - user
  - `user_id` integer
  - `environment_id` integer
  - `job_definition_id` integer
  - `raw_value` string
  - `display_value` string
  - `state` integer: A value of 1 means this entity is active and a value of 2 means this entity is deleted

## Response `200`

- CustomEnvironmentVariableEnveloped
  - `data` CustomEnvironmentVariableResponse, required
    - `id` integer, required
    - `account_id` integer
    - `project_id` integer
    - `name` string
    - `type` 'project' | 'environment' | 'job' | 'user': * `project` - project * `environment` - environment * `job` - job * `user` - user
    - `user_id` integer
    - `environment_id` integer
    - `job_definition_id` integer
    - `display_value` string
    - `state` integer: A value of 1 means this entity is active and a value of 2 means this entity is deleted
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `environment` EnvironmentV3, required
      - `account_id` integer, required: The account the environment is associated with
      - `project_id` integer, required: The project the environment is associated with
      - `credentials_id` integer: The id of the associated credentials. Null for development environments. Must be included when updating a deployment environment or the value will be reset to null.
      - `connection_id` integer: The id of the associated connection. Must be included when updating an environment or the value will be reset to null.
      - `extended_attributes_id` integer
      - `name` string, required: The name of the environment
      - `dbt_version` string, required: The default dbt Version to use for this environment
      - `type` 'development' | 'deployment', required: * `development` - DEVELOPMENT * `deployment` - DEPLOYMENT
      - `use_custom_branch` boolean, required
      - `custom_branch` string
      - `supports_docs` boolean, required
      - `deployment_type` 'production' | 'staging': * `production` - production * `staging` - staging
      - `enable_model_query_history` boolean
      - `enable_dbt_state` boolean
      - `enable_dbt_state_model_lock` boolean, required
      - `state` integer, required: A value of 1 means this entity is active and a value of 2 means this entity is deleted
      - `primary_profile_id` integer: The id of the primary profile for this environment
  - `status` ResponseStatus, required
    - `code` integer: HTTP status code
    - `is_success` boolean, required: Whether the request was successful or not
    - `user_message` string, required: End-user friendly success or error message
    - `developer_message` string, required: Developer friendly success or error message

## Changes

- **2026-10-28** (v3) `e32fbfcdc9ec`: 1 info
  - added the required property `data/environment/allOf[#/components/schemas/EnvironmentV3]/enable_dbt_state_model_lock` to the response with the `200` status
- **2026-10-06** (v3) `7d5c1b4c8d8a`: 2 breaking
  - for the `path` request parameter `account_id`, the format changed from no format to `int64`
  - for the `path` request parameter `project_id`, the format changed from no format to `int64`
- **2026-06-12** (v3) `35ed07b14344`: 1 info
  - added the optional property `data/environment/allOf[#/components/schemas/EnvironmentV3]/enable_dbt_state` to the response with the `200` status
- **2026-04-22** (v3) `ed46da9332ad`: 15 breaking
  - the `account_id` request property format changed from no format to `int64` (media type: application/json)
  - the `account_id` request property format changed from no format to `int64` (media type: application/x-www-form-urlencoded)
  - the `account_id` request property format changed from no format to `int64` (media type: multipart/form-data)
  - the `environment_id` request property format changed from no format to `int64` (media type: application/json)
  - …11 more
- **2026-02-10** (v3) `45ba55712f57`: 1 info
  - added the optional property `data/environment/allOf[#/components/schemas/EnvironmentV3]/primary_profile_id` to the response with the `200` status

[Operation history](https://skmtc.dev/getdbt/apis/dbt-cloud-api-v2/changes/api/v3/accounts/:account_id/projects/:project_id/environment-variables/post.md)

---

[API](https://skmtc.dev/getdbt/apis/dbt-cloud-api-v2.md) - [All operations](https://skmtc.dev/getdbt/apis/dbt-cloud-api-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/getdbt/apis/dbt-cloud-api-v2/revisions/2448b375ac2f?raw)
