---
title: "Create an environment"
method: POST
path: "/api/v2/feature-flags/environments"
tags: ["Feature Flags"]
---

# Create an environment

`POST /api/v2/feature-flags/environments`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/feature-flags/environments`
- Auth: API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`

Creates a new environment for organizing feature flags.

## Request body

- CreateEnvironmentRequest: Request to create a new environment.
  - `data` CreateEnvironmentData, required: Data for creating a new environment.
    - `attributes` CreateEnvironmentAttributes, required: Attributes for creating a new environment.
      - `is_production` boolean: Indicates whether this is a production environment.
      - `name` string, required: The name of the environment.
      - `queries` string[], required: List of queries to define the environment scope.
      - `require_feature_flag_approval` boolean: Indicates whether feature flag changes require approval in this environment.
    - `type` 'environments', required: The resource type.

## Response `201`

Created

- EnvironmentResponse: Response containing an environment.
  - `data` Environment, required: A feature flag environment resource.
    - `attributes` EnvironmentAttributes, required: Attributes of an environment.
      - `created_at` string, date-time: The timestamp when the environment was created.
      - `description` string, nullable: The description of the environment.
      - `is_production` boolean: Indicates whether this is a production environment.
      - `key` string: The unique key of the environment.
      - `name` string, required: The name of the environment.
      - `queries` string[]: List of queries to define the environment scope.
      - `require_feature_flag_approval` boolean: Indicates whether feature flag changes require approval in this environment.
      - `updated_at` string, date-time: The timestamp when the environment was last updated.
    - `id` string, uuid, required: The unique identifier of the environment.
    - `type` 'environments', required: The resource type.

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `409`: Conflict
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
