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

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://try.flipt.io/api/v1/namespaces/default/flags/{flagKey}/variants \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --data '{
    "key": "<key>",
    "name": "<name>",
    "description": "<description>",
    "attachment": "<attachment>"
  }'
  ```
</RequestExample>


## OpenAPI

````yaml POST /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants
openapi: 3.0.3
info:
  title: api
  version: 1.47.0
servers:
  - url: http://localhost:8080
security:
  - bearerAuth: []
tags:
  - name: AuthenticationMethodKubernetesService
  - name: AuthenticationMethodOIDCService
  - name: AuthenticationMethodTokenService
  - name: AuthenticationService
  - name: EvaluationService
  - name: Flipt
  - name: OFREPService
paths:
  /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/variants:
    post:
      tags:
        - Flipt
        - VariantsService
      operationId: createVariant
      parameters:
        - name: namespaceKey
          in: path
          required: true
          schema:
            type: string
        - name: flagKey
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVariantRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Variant'
components:
  schemas:
    CreateVariantRequest:
      required:
        - key
      type: object
      properties:
        flagKey:
          type: string
        key:
          type: string
        name:
          type: string
        description:
          type: string
        attachment:
          type: string
        namespaceKey:
          type: string
    Variant:
      type: object
      properties:
        id:
          type: string
        flagKey:
          type: string
        key:
          type: string
        name:
          type: string
        description:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        attachment:
          type: string
        namespaceKey:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````