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

# Create a prompt version message

> Attaches a message to a prompt version. This is the supported way to write prompt content to an existing version: create the version with `POST /prompt-version` (optionally passing a single `message`), then manage its content here.



## OpenAPI

````yaml POST /prompt-version-message
openapi: 3.0.1
info:
  title: Tela API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tela.com
security: []
paths:
  /prompt-version-message:
    post:
      tags:
        - Prompt Version Message
      summary: Create a prompt version message
      description: >
        Attaches a message to a prompt version. This is the supported way to
        write prompt content to an existing

        version: create the version with `POST /prompt-version` (optionally
        passing a single `message`), then manage

        its content here.


        Relationship to `POST /prompt-version`: that endpoint accepts an inline
        `message` (preferred) or the

        deprecated `messages` field (a single object or a one-element array).
        Both are resolved to exactly one

        message whose `role` must be `system`; supplying more than one element
        is rejected with `400`. This endpoint

        accepts any `role` and any `index`, but the runtime reads a version's
        prompt from its first message by

        `index`, so a `system` message at `index: 0` is the expected shape.


        Messages can only be created on versions that are not published: if the
        version is `promoted` or is

        currently published to any environment the request fails (currently
        surfaced as `500`; the version must be

        edited through a new draft instead).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VersionMessageCreateRequest'
      responses:
        '201':
          description: The created message.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VersionMessageResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            Missing or invalid credentials, or no access to the version's
            project.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            The project exists in the workspace but the caller's team has no
            access to it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Version not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Body failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: >-
            The version is promoted or published to an environment and cannot be
            modified.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    VersionMessageCreateRequest:
      type: object
      properties:
        promptVersionId:
          type: string
          format: uuid
        role:
          type: string
          enum:
            - user
            - assistant
            - system
            - function
          description: >-
            Use `system` for the prompt content; other roles are accepted but
            are not read as the prompt.
        content:
          type: string
          nullable: true
        markdownContent:
          type: string
          nullable: true
        index:
          type: integer
          description: Defaults to 0.
        id:
          type: string
          format: uuid
          description: Optional client-supplied id.
      required:
        - promptVersionId
        - role
    VersionMessageResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        promptVersionId:
          type: string
          format: uuid
        role:
          type: string
          enum:
            - user
            - assistant
            - system
            - function
        content:
          type: string
          nullable: true
          description: Plain-text prompt content. May use `{{variable}}` placeholders.
        markdownContent:
          type: string
          nullable: true
        index:
          type: integer
          description: >-
            Position of the message inside the version. The prompt is read from
            index 0.
        createdBy:
          type: string
        updatedBy:
          type: string
        createdAt:
          type: string
          format: date-time
          nullable: true
        updatedAt:
          type: string
          format: date-time
          nullable: true
        deletedAt:
          type: string
          format: date-time
          nullable: true
      required:
        - id
        - promptVersionId
        - role
        - index
        - createdBy
        - updatedBy
      example:
        id: c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f
        promptVersionId: 9d2e4f6a-1b3c-4d5e-8f70-1a2b3c4d5e6f
        role: system
        content: Extract the invoice total from {{invoice}}.
        markdownContent: null
        index: 0
        createdBy: ana@example.com
        updatedBy: ana@example.com
        createdAt: '2026-08-19T09:41:00.000Z'
        updatedAt: '2026-08-19T09:41:00.000Z'
        deletedAt: null
    Error: {}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT or UUID

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.