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

# Create variants

> Creates one or more variants in the workspace. A variant is a named alternative that text items and library components can each have their own text for — most often a locale to translate into, but also a tone or brand variation. Creating a variant adds no text on its own; use the text item endpoints to set a text item's text for that variant. Each variant can optionally specify a developerId (must be unique within the workspace), a description, and a localeCode. At most one variant in a workspace can hold a given locale code. When no developerId is given, one is generated from the name, so read the developer IDs off the response rather than assuming them.



## OpenAPI

````yaml openapi.json post /variants
openapi: 3.0.0
info:
  version: 1.0.0
  title: Ditto API
  description: Programmatically read and write data in your Ditto workspace.
servers:
  - url: https://api.dittowords.com/v2
security: []
paths:
  /variants:
    post:
      tags:
        - Variants
      summary: Create variants
      description: >-
        Creates one or more variants in the workspace. A variant is a named
        alternative that text items and library components can each have their
        own text for — most often a locale to translate into, but also a tone or
        brand variation. Creating a variant adds no text on its own; use the
        text item endpoints to set a text item's text for that variant. Each
        variant can optionally specify a developerId (must be unique within the
        workspace), a description, and a localeCode. At most one variant in a
        workspace can hold a given locale code. When no developerId is given,
        one is generated from the name, so read the developer IDs off the
        response rather than assuming them.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                variants:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        minLength: 1
                        description: >-
                          The variant's name. Must be unique within the
                          workspace; 'base' is reserved.
                      developerId:
                        type: string
                        minLength: 1
                        description: >-
                          Optional preconfigured developer ID for the variant.
                          Must be unique within the workspace, and 'base' and
                          'all' are reserved. Accepted in any casing and stored
                          lowercase. Characters outside letters, numbers,
                          hyphens, and underscores are stripped. If omitted, one
                          is generated from the name.
                      description:
                        type: string
                        description: Optional description of what the variant is for.
                      localeCode:
                        type: string
                        enum:
                          - af
                          - ar
                          - ar-ae
                          - ar-bh
                          - ar-dz
                          - ar-eg
                          - ar-iq
                          - ar-jo
                          - ar-kw
                          - ar-lb
                          - ar-ly
                          - ar-ma
                          - ar-om
                          - ar-qa
                          - ar-sa
                          - ar-sy
                          - ar-tn
                          - ar-ye
                          - az
                          - be
                          - bg
                          - bs
                          - ca
                          - cs
                          - cy
                          - da
                          - de
                          - de-at
                          - de-ch
                          - de-li
                          - de-lu
                          - el
                          - en
                          - en-au
                          - en-bz
                          - en-ca
                          - en-gb
                          - en-ie
                          - en-jm
                          - en-nz
                          - en-sg
                          - en-tt
                          - en-us
                          - en-za
                          - es
                          - es-ar
                          - es-bo
                          - es-cl
                          - es-co
                          - es-cr
                          - es-do
                          - es-ec
                          - es-gt
                          - es-hn
                          - es-mx
                          - es-ni
                          - es-pa
                          - es-pe
                          - es-pr
                          - es-py
                          - es-sv
                          - es-uy
                          - es-ve
                          - et
                          - eu
                          - fa
                          - fi
                          - fo
                          - fr
                          - fr-be
                          - fr-ca
                          - fr-ch
                          - fr-lu
                          - ga
                          - gd
                          - he
                          - hi
                          - hr
                          - hu
                          - hy
                          - id
                          - is
                          - it
                          - it-ch
                          - ja
                          - ka
                          - kk
                          - ko
                          - ku
                          - lt
                          - lv
                          - mk
                          - ml
                          - ms
                          - mt
                          - nb
                          - nl
                          - nl-be
                          - nn
                          - 'no'
                          - pa
                          - pl
                          - pt
                          - pt-br
                          - rm
                          - ro
                          - ro-md
                          - ru
                          - ru-md
                          - sk
                          - sl
                          - sq
                          - sr
                          - sv
                          - sv-fi
                          - th
                          - tn
                          - tr
                          - ts
                          - uk
                          - ur
                          - ve
                          - vi
                          - wen
                          - xh
                          - yi
                          - zh-cn
                          - zh-hk
                          - zh-sg
                          - zh-tw
                          - zu
                        description: >-
                          Locale code for the variant, from the set Ditto
                          supports. Casing does not matter on the way in —
                          'fr-CA' and 'fr-ca' are both accepted — and the code
                          is stored lowercase, which is the form reads return.
                          Not every language-region pairing exists in the set,
                          so pick one of the listed values rather than composing
                          your own. At most one variant per workspace can hold a
                          given locale code. Set this whenever the variant
                          represents a language: translation tools treat it as
                          the authoritative target locale.
                    required:
                      - name
                  minItems: 1
                  description: Array of new variants to create
              required:
                - variants
              example:
                variants:
                  - name: Spanish
                    localeCode: es
                  - name: Canadian French
                    developerId: fr-ca
                    description: French translations for Canada
      responses:
        '200':
          description: Returns the developer IDs of the created variants, in request order
          content:
            application/json:
              schema:
                type: object
                properties:
                  developerIds:
                    type: array
                    items:
                      type: string
                    description: >-
                      Array of developer IDs for the created variants, in
                      request order
                required:
                  - developerIds
                example:
                  developerIds:
                    - spanish
                    - fr-ca
        '400':
          description: >-
            Returned when the request body fails validation. Common causes
            include: the same name, developer ID, or locale code appearing twice
            in one request; a reserved developer ID.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message describing the validation failure
                required:
                  - message
              example:
                message: 'Duplicate locale codes in request: es'
        '409':
          description: >-
            Returned when a name, developer ID, or locale code is already in use
            by another variant in the workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message describing the conflict
                required:
                  - message
              example:
                message: >-
                  Locale code already attached to another variant: es. A locale
                  code can belong to at most one variant.
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````