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

# Create Environment Variable

> Create a new environment variable for the workspace



## OpenAPI

````yaml /api-reference/openapi.json post /v1/convai/environment-variables
openapi: 3.1.0
info:
  title: Threetone API Documentation
  description: >-
    This is the documentation for the Threetone API. You can use this API to use
    our service programmatically with API keys sent in the x-api-key header. You
    can create and manage API keys in the dashboard at
    https://threetone.in/app/developers/api-keys.
  version: '1.0'
servers:
  - url: https://api.threetone.in
    description: Production
security: []
paths:
  /v1/convai/environment-variables:
    post:
      tags:
        - Agents Platform
      summary: Create Environment Variable
      description: Create a new environment variable for the workspace
      operationId: create_environment_variable
      parameters:
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Your API key for programmatic access. Send it in the x-api-key
              header; you can create and manage keys from the Developers page.
            title: X-Api-Key
          description: >-
            Your API key for programmatic access. Send it in the x-api-key
            header; you can create and manage keys from the Developers page.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/CreateStringEnvironmentVariableRequest'
                - $ref: '#/components/schemas/CreateSecretEnvironmentVariableRequest'
                - $ref: >-
                    #/components/schemas/CreateAuthConnectionEnvironmentVariableRequest
              discriminator:
                propertyName: type
                mapping:
                  string:
                    $ref: >-
                      #/components/schemas/CreateStringEnvironmentVariableRequest
                  secret:
                    $ref: >-
                      #/components/schemas/CreateSecretEnvironmentVariableRequest
                  auth_connection:
                    $ref: >-
                      #/components/schemas/CreateAuthConnectionEnvironmentVariableRequest
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentVariableResponse'
        '400':
          description: Invalid parameters
        '409':
          description: Environment variable with this label already exists
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateStringEnvironmentVariableRequest:
      properties:
        type:
          type: string
          const: string
          title: Type
        label:
          type: string
          title: Label
          description: Unique label for the environment variable.
        values:
          additionalProperties:
            type: string
            minLength: 1
          type: object
          title: Values
          description: Environment-specific values. Must include 'production' key.
      type: object
      required:
        - type
        - label
        - values
      title: CreateStringEnvironmentVariableRequest
    CreateSecretEnvironmentVariableRequest:
      properties:
        type:
          type: string
          const: secret
          title: Type
        label:
          type: string
          title: Label
          description: Unique label for the environment variable.
        values:
          additionalProperties:
            $ref: '#/components/schemas/EnvironmentVariableSecretValueRequest'
          type: object
          title: Values
          description: >-
            Environment-specific secret references. Must include 'production'
            key.
      type: object
      required:
        - type
        - label
        - values
      title: CreateSecretEnvironmentVariableRequest
    CreateAuthConnectionEnvironmentVariableRequest:
      properties:
        type:
          type: string
          const: auth_connection
          title: Type
        label:
          type: string
          title: Label
          description: Unique label for the environment variable.
        values:
          additionalProperties:
            $ref: '#/components/schemas/EnvironmentVariableAuthConnectionValueRequest'
          type: object
          title: Values
          description: >-
            Environment-specific auth connection references. Must include
            'production' key.
      type: object
      required:
        - type
        - label
        - values
      title: CreateAuthConnectionEnvironmentVariableRequest
    EnvironmentVariableResponse:
      properties:
        label:
          type: string
          title: Label
        created_at_unix_secs:
          type: integer
          title: Created At Unix Secs
        updated_at_unix_secs:
          type: integer
          title: Updated At Unix Secs
        created_by_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By User Id
        type:
          type: string
          enum:
            - string
            - secret
            - auth_connection
          title: Type
        id:
          type: string
          title: Id
        workspace_id:
          type: string
          title: Workspace Id
        values:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - additionalProperties:
                $ref: '#/components/schemas/EnvironmentVariableSecretValue'
              type: object
            - additionalProperties:
                $ref: '#/components/schemas/EnvironmentVariableAuthConnectionValue'
              type: object
          title: Values
      type: object
      required:
        - label
        - created_at_unix_secs
        - updated_at_unix_secs
        - type
        - id
        - workspace_id
        - values
      title: EnvironmentVariableResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    EnvironmentVariableSecretValueRequest:
      properties:
        secret_id:
          type: string
          title: Secret Id
      type: object
      required:
        - secret_id
      title: EnvironmentVariableSecretValueRequest
    EnvironmentVariableAuthConnectionValueRequest:
      properties:
        auth_connection_id:
          type: string
          title: Auth Connection Id
      type: object
      required:
        - auth_connection_id
      title: EnvironmentVariableAuthConnectionValueRequest
    EnvironmentVariableSecretValue:
      properties:
        secret_id:
          type: string
          title: Secret Id
      type: object
      required:
        - secret_id
      title: EnvironmentVariableSecretValue
    EnvironmentVariableAuthConnectionValue:
      properties:
        auth_connection_id:
          type: string
          title: Auth Connection Id
      type: object
      required:
        - auth_connection_id
      title: EnvironmentVariableAuthConnectionValue
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````