> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flipt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Namespace

> Create a new namespace in an environment.

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url http://localhost:8080/api/v2/environments/{environmentKey}/namespaces \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --data '{
    "key": "<key>",
    "name": "<name>"
  }'
  ```
</RequestExample>


## OpenAPI

````yaml https://raw.githubusercontent.com/flipt-io/flipt/refs/heads/v2/rpc/v2/environments/openapi.yaml POST /api/v2/environments/{environmentKey}/namespaces
openapi: 3.0.3
info:
  title: Management API
  description: Flipt Management REST API
  version: 2.9.0
servers: []
security: []
tags:
  - name: EnvironmentsService
paths:
  /api/v2/environments/{environmentKey}/namespaces:
    post:
      tags:
        - EnvironmentsService
      description: Create a new namespace.
      operationId: createNamespace
      parameters:
        - name: environmentKey
          in: path
          description: The environment identifier, e.g. 'production'.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateNamespaceRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NamespaceResponse'
components:
  schemas:
    UpdateNamespaceRequest:
      type: object
      properties:
        environmentKey:
          type: string
          description: The environment identifier, e.g. 'production'.
        key:
          type: string
          description: The namespace key.
        name:
          type: string
          description: The namespace name.
        description:
          type: string
          description: The namespace description.
        protected:
          type: boolean
          description: The namespace protection status.
        revision:
          type: string
          description: The resource revision for optimistic concurrency.
      description: The request message for creating or updating a namespace.
    NamespaceResponse:
      type: object
      properties:
        namespace:
          allOf:
            - $ref: '#/components/schemas/Namespace'
          description: The list of namespaces.
        revision:
          type: string
          description: The resource revision for optimistic concurrency.
      description: The response message for getting a namespace.
    Namespace:
      type: object
      properties:
        key:
          type: string
          description: The namespace key.
        name:
          type: string
          description: The namespace name.
        description:
          type: string
          description: The namespace description.
        protected:
          type: boolean
          description: The namespace protection status.
      description: Namespace represents a grouping of related flags and segments.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.