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

# Create an environment

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

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.net/datadog/apis/api-v2.md) · [All operations](https://skmtc.net/datadog/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datadog/api-v2/revisions/da68bf029e4c/schema)
