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

# Create variable



## OpenAPI

````yaml /api-reference/openapi.json post /public/api/v1/agents/{agentPublicId}/prompt/variables
openapi: 3.1.0
info:
  contact:
    email: support@gennia.ai
    name: Gennia Support
    url: https://gennia.ai
  description: >-
    Workspace-scoped API authenticated via workspace API key (header `X-Api-Key:
    gsk_...` or `Authorization: Bearer gsk_...`).
  title: Gennia Public API
  version: v1
servers:
  - description: Production
    url: https://api.gennia.ai
security:
  - workspaceApiKey: []
tags:
  - description: Slash commands available inside the agent chat.
    name: Agent Commands
  - description: Link skills to an agent.
    name: Agent Skills
  - description: Read/rename/delete workspace knowledge sources.
    name: Knowledge Sources
  - description: Link knowledge sources to an agent.
    name: Agent Knowledge Sources
  - description: Workspace CRUD for HTTP/DB/Custom tools.
    name: HTTP Tools
  - description: Read/write the agent's model selection + capabilities.
    name: Agent Model
  - description: Discover trigger types available for Native MCP toolkits.
    name: Native MCP Triggers
  - description: Discover and toggle capability features.
    name: Agent Features
  - description: Hub access settings.
    name: Hub Access
  - description: Read conversation history and delete conversations.
    name: Conversations
  - description: Send messages to a published agent.
    name: Messages
  - description: Workspace CRUD for External MCP servers.
    name: External MCPs
  - description: Hub billing — plans, coupons, credit packages.
    name: Billing
  - description: External links shown in the hub menu.
    name: Hub External Links
  - description: Link Native MCP (Composio) instances to an agent.
    name: Agent Native MCPs
  - description: Manage AI agents in the workspace bound to the API key.
    name: Agents
  - description: Read published version snapshots and restore.
    name: Agent Versions
  - description: Read/rename/delete workspace skills.
    name: Skills
  - description: Manage hub end-customers (client workspaces).
    name: Clients
  - description: Hub domain (subdomain) management.
    name: Hub Domain
  - description: Read/write the agent's prompt context.
    name: Agent Prompt
  - description: Scheduled / trigger-based runs of an agent.
    name: Agent Automations
  - description: Link HTTP/DB/Custom tools to an agent.
    name: Agent HTTP Tools
  - description: Hub identity, branding, logos and overall configuration.
    name: Hub
  - description: Discover AI models available to this workspace.
    name: AI Models
  - description: Discover channel types and their config schemas.
    name: Channel Types
  - description: Connect agents to messaging surfaces.
    name: Agent Channels
  - description: Link workspace-registered External MCP servers to an agent.
    name: Agent External MCPs
  - description: Workspace-scoped public API (API key authentication)
    name: Public API
  - description: Dynamic-prompt variable definitions.
    name: Agent Variables
  - description: Link sub-agents as delegation targets.
    name: Agent Sub-agents
paths:
  /public/api/v1/agents/{agentPublicId}/prompt/variables:
    post:
      tags:
        - Agent Variables
      summary: Create variable
      operationId: createVariable
      parameters:
        - in: path
          name: agentPublicId
          required: true
          schema:
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePublicAgentVariableDTO'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicAgentVariableDTO'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicAgentVariableDTO'
          description: Validation failed
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicAgentVariableDTO'
          description: Missing or invalid API key
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicAgentVariableDTO'
          description: Agent not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicAgentVariableDTO'
          description: Variable name already taken
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicAgentVariableDTO'
          description: Options validation failed
      security:
        - workspaceApiKey: []
components:
  schemas:
    CreatePublicAgentVariableDTO:
      description: Body for creating a new dynamic prompt variable on an agent.
      properties:
        booleanTextWhenFalse:
          description: Text to inject when a boolean variable resolves to false.
          example: 'no'
          type: string
        booleanTextWhenTrue:
          description: Text to inject when a boolean variable resolves to true.
          example: 'yes'
          type: string
        defaultValue:
          $ref: '#/components/schemas/JsonNode'
          description: >-
            Default value. Polymorphic: shape depends on type (string, number,
            boolean, choice).
          example: Ada
        description:
          description: Optional help text shown next to the variable.
          example: Full name of the customer being assisted.
          maxLength: 500
          minLength: 0
          type: string
        label:
          description: Human-readable label shown in the prompt editor.
          example: Customer name
          maxLength: 200
          minLength: 0
          type: string
        multiChoiceSeparator:
          description: >-
            Separator used when concatenating multi_choice options into a single
            string.
          example: ', '
          maxLength: 10
          minLength: 0
          type: string
        name:
          description: >-
            Stable identifier of the variable. Lowercase ASCII; must start with
            a letter and may contain digits and underscores. Up to 50
            characters.
          example: customer_name
          minLength: 1
          pattern: ^[a-z][a-z0-9_]{0,49}$
          type: string
        options:
          description: >-
            Required (and validated 1..50) for single_choice / multi_choice
            variables.
          items:
            $ref: '#/components/schemas/OptionInput'
          type: array
        required:
          description: Whether the variable must be set before the agent can respond.
          example: true
          type: boolean
        sortOrder:
          description: Sort order of this variable in the prompt editor.
          example: 10
          format: int32
          type: integer
        type:
          description: Type of the variable, controlling shape and validation of values.
          enum:
            - text_short
            - text_long
            - number
            - date
            - time
            - datetime
            - single_choice
            - multi_choice
            - bool
          type: string
      required:
        - type
      type: object
    PublicAgentVariableDTO:
      description: Dynamic-prompt variable definition (per agent).
      properties:
        booleanTextWhenFalse:
          description: Prompt fragment when bool variable is false.
          type: string
        booleanTextWhenTrue:
          description: Prompt fragment when bool variable is true.
          type: string
        createdAt:
          format: date-time
          type: string
        defaultValue:
          $ref: '#/components/schemas/JsonNode'
          description: Default value (shape depends on `type`).
        description:
          type: string
        label:
          description: Display label shown in the Hub form.
          type: string
        multiChoiceSeparator:
          description: Joiner for multi_choice rendered values (default `, `).
          type: string
        name:
          description: Slug used in `{{name}}` references inside the systemPrompt.
          type: string
        options:
          description: Options for single_choice / multi_choice (null otherwise).
          items:
            $ref: '#/components/schemas/Option'
          type: array
        publicId:
          format: uuid
          type: string
        required:
          description: Whether the Hub form must submit this field.
          type: boolean
        sortOrder:
          format: int32
          type: integer
        type:
          enum:
            - text_short
            - text_long
            - number
            - date
            - time
            - datetime
            - single_choice
            - multi_choice
            - bool
          type: string
        updatedAt:
          format: date-time
          type: string
      type: object
    JsonNode:
      type: object
    OptionInput:
      description: Option entry for single_choice / multi_choice variables.
      properties:
        injectedText:
          description: >-
            Text that gets injected into the prompt when this option is
            selected.
          example: the customer is on the Pro plan
          minLength: 1
          type: string
        label:
          description: Human-readable label of the option.
          example: Pro plan
          maxLength: 100
          minLength: 0
          type: string
        sortOrder:
          description: Sort order of this option in the picker.
          example: 1
          format: int32
          type: integer
      type: object
    Option:
      properties:
        injectedText:
          type: string
        label:
          type: string
        publicId:
          format: uuid
          type: string
        sortOrder:
          format: int32
          type: integer
      type: object
  securitySchemes:
    workspaceApiKey:
      in: header
      name: X-Api-Key
      type: apiKey

````