> ## 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 Branch

> Create a new branch in an environment.

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


## OpenAPI

````yaml https://raw.githubusercontent.com/flipt-io/flipt/refs/heads/v2/rpc/v2/environments/openapi.yaml POST /api/v2/environments/{environmentKey}/branches
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}/branches:
    post:
      tags:
        - EnvironmentsService
      description: Create a branch environment.
      operationId: createBranchEnvironment
      parameters:
        - name: environmentKey
          in: path
          description: The environment identifier, e.g. 'production/branch'.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BranchEnvironmentRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Environment'
components:
  schemas:
    BranchEnvironmentRequest:
      type: object
      properties:
        environmentKey:
          type: string
          description: The environment identifier, e.g. 'production/branch'.
        key:
          type: string
          description: The branch key.
      description: The request message for creating a branch environment.
    Environment:
      type: object
      properties:
        key:
          type: string
          description: The environment key.
        name:
          type: string
          description: The environment name.
        default:
          type: boolean
          description: The default indicates if this is the default environment.
        configuration:
          allOf:
            - $ref: '#/components/schemas/EnvironmentConfiguration'
          description: The environment configuration.
      description: The Environment represents a environment.
    EnvironmentConfiguration:
      type: object
      properties:
        ref:
          type: string
          description: The git reference (branch or tag) for the environment.
        directory:
          type: string
          description: >-
            The directory within the repository where environment resources are
            located.
        remote:
          type: string
          description: The git remote URL for the environment.
        base:
          type: string
          description: The base branch or tag for the environment.
        scm:
          enum:
            - SCM_UNKNOWN
            - SCM_GITHUB
            - SCM_GITEA
            - SCM_GITLAB
            - SCM_AZURE
            - SCM_BITBUCKET
          type: string
          description: The source control management system for the environment.
          format: enum
      description: >-
        The EnvironmentConfiguration represents the configuration for an
        environment.

````

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