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

# Update message variant

> Edits one variant of a message in place, so the message keeps its ID and its owner. Send only the text, delay, or condition you want to change; `condition: null` removes the condition.



## OpenAPI

````yaml /specs-prettified/realtime/openapi.stable.json patch /v1/stable/message/{messageID}/variant/{variantID}
openapi: 3.0.0
info:
  title: Realtime
  description: Realtime gateway API service
  version: 1.0.0
  contact: {}
servers:
  - url: https://realtime-api.voiceflow.com
security: []
tags: []
paths:
  /v1/stable/message/{messageID}/variant/{variantID}:
    patch:
      tags:
        - Message
      summary: Update message variant
      description: "Edits one variant of a message in place, so the message keeps its
        ID and its owner. Send only the text, delay, or condition you want to
        change; `condition: null` removes the condition."
      operationId: StableMessageController_updateVariant
      parameters:
        - name: messageID
          required: true
          in: path
          schema:
            type: string
          x-vf-doc:
            description: The ID of the message to operate on.
          description: The ID of the message to operate on.
        - name: variantID
          required: true
          in: path
          schema:
            type: string
          x-vf-doc:
            description: The ID of the message variant to operate on.
          description: The ID of the message variant to operate on.
        - name: projectID
          required: true
          in: query
          schema:
            type: string
            description: The ID of the project to operate on.
        - name: environmentAlias
          required: true
          in: query
          schema:
            type: string
            description: The alias of the environment to operate on (e.g. `main`).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: "#/components/schemas/StableMessageVariantUpdateRequest"
      responses:
        "200":
          description: Confirms the variant was updated. The body is a message, with
            `unresolvedReferences` for any variable or reference in the new text
            that did not resolve.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StableTextUpdateResponse"
          x-vf-doc:
            description: Confirms the variant was updated. The body is a message, with
              `unresolvedReferences` for any variable or reference in the new
              text that did not resolve.
      security:
        - token: []
components:
  schemas:
    StableMessageVariantUpdateRequest:
      type: object
      properties:
        text:
          allOf:
            - $ref: "#/components/schemas/MarkdownLikeString"
        delay:
          description: Milliseconds to wait before this variant is sent. null removes the
            delay.
          nullable: true
          type: integer
          minimum: 0
          maximum: 2147483647
        condition:
          nullable: true
          allOf:
            - $ref: "#/components/schemas/StableMessageVariantCondition"
      additionalProperties: false
    MarkdownLikeString:
      type: string
      description: "Message text shown to the end user. Limited markdown: **bold**,
        _italic_, <u>underline</u>, ~~strikethrough~~, [label](url).
        {variable_name} inserts a variable or entity, {variable_name.path} a
        field of a variable. Escape a literal { or \\ with a backslash. A name
        matching neither is stored as literal text and reported in
        unresolvedReferences; secrets are not available here."
    StableMessageVariantCondition:
      oneOf:
        - $ref: "#/components/schemas/StableExpressionCondition"
        - $ref: "#/components/schemas/StableScriptCondition"
      description: When the runtime may use this variant. `value-variable` compares
        variables with values; `script` runs code in which {variable_name} reads
        a variable.
    StableExpressionCondition:
      type: object
      properties:
        type:
          type: string
          enum:
            - value-variable
          x-enumNames:
            - VALUE_VARIABLE
        matchAll:
          type: boolean
        assertions:
          type: array
          items:
            $ref: "#/components/schemas/StableConditionAssertion"
      required:
        - type
        - matchAll
        - assertions
    StableConditionAssertion:
      type: object
      properties:
        key:
          type: string
        lhs:
          $ref: "#/components/schemas/ConditionAssertionLhs"
        rhs:
          $ref: "#/components/schemas/VariableReferenceString"
        operation:
          default: is
          allOf:
            - $ref: "#/components/schemas/ConditionOperation"
      required:
        - key
        - lhs
        - rhs
    ConditionAssertionLhs:
      type: object
      properties:
        variableID:
          nullable: true
          type: string
        path:
          type: string
      required:
        - variableID
    VariableReferenceString:
      type: string
      description: Plain text; markdown is not interpreted. {variable_name} inserts a
        variable or entity, {variable_name.path} a field of a variable. Escape a
        literal { or \ with a backslash. A name matching neither is stored as
        literal text and reported in unresolvedReferences; secrets are not
        available here.
    ConditionOperation:
      type: string
      enum:
        - is
        - is_not
        - greater_than
        - greater_or_equal
        - less_than
        - less_or_equal
        - contains
        - not_contains
        - starts_with
        - ends_with
        - is_empty
        - is_not_empty
      x-enumNames:
        - IS
        - IS_NOT
        - GREATER_THAN
        - GREATER_OR_EQUAL
        - LESS_THAN
        - LESS_OR_EQUAL
        - CONTAINS
        - NOT_CONTAINS
        - STARTS_WITH
        - ENDS_WITH
        - IS_EMPTY
        - IS_NOT_EMPTY
    StableScriptCondition:
      type: object
      properties:
        type:
          type: string
          enum:
            - script
          x-enumNames:
            - SCRIPT
        code:
          $ref: "#/components/schemas/VariableReferenceString"
      required:
        - type
        - code
    StableTextUpdateResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable message confirming the update.
        unresolvedReferences:
          description: References this write kept as literal text instead of binding, each
            with the reason. The write still succeeded.
          type: array
          items:
            $ref: "#/components/schemas/StableUnresolvedReference"
      required:
        - message
    StableUnresolvedReference:
      type: object
      properties:
        path:
          type: string
          description: Dotted path of the field that carried it, e.g.
            `knowledgeBaseTool.filters[0].defaultValue`.
        token:
          type: string
          description: The reference as written, without braces.
        reason:
          type: string
          enum:
            - unknown
            - secret-not-allowed
            - path-on-non-variable
            - resource-id
            - invalid-name
            - dangling
          description: "`unknown`: no variable or entity of that name.
            `secret-not-allowed`: the name is a project secret and this field
            does not accept one. `path-on-non-variable`: only a variable has
            fields. `resource-id`: a bare resource id, not a name.
            `invalid-name`: outside the `^\\w{1,64}$` name grammar. `dangling`:
            the reference rendered as a bare id, because its row is gone or its
            name is outside the name grammar."
          x-enumNames:
            - UNKNOWN
            - SECRET_NOT_ALLOWED
            - PATH_ON_NON_VARIABLE
            - RESOURCE_ID
            - INVALID_NAME
            - DANGLING
      required:
        - path
        - token
        - reason
  securitySchemes:
    token:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Voiceflow bearer token
````
