> ## 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.

# List Prompt Versions

> Returns a list of prompt versions for a specific prompt

## Retrieve Prompt Versions

This endpoint retrieves all prompt versions associated with a specific prompt ID.

### Required Parameters

| Parameter  | Type          | Description                                   |
| ---------- | ------------- | --------------------------------------------- |
| `promptId` | string (UUID) | The ID of the prompt to retrieve versions for |

### Examples

<CodeGroup>
  ```typescript typescript theme={null}
  const promptId = 'prompt_uuid'

  // Build URL with query parameters
  const url = new URL('https://api.tela.ai/prompt-version')
  url.searchParams.append('promptId', promptId)

  const response = await fetch(url, {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
      'Content-Type': 'application/json'
    }
  })

  const promptVersions = await response.json()
  console.log(promptVersions)
  ```

  ```javascript javascript theme={null}
  const promptId = 'prompt_uuid'

  // Build URL with query parameters
  const url = new URL('https://api.tela.ai/prompt-version')
  url.searchParams.append('promptId', promptId)

  const response = await fetch(url, {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
      'Content-Type': 'application/json'
    }
  })

  const promptVersions = await response.json()
  console.log(promptVersions)
  ```

  ```python python theme={null}
  import requests
  import os

  api_key = os.getenv("TELA_API_KEY")
  prompt_id = "prompt_uuid"

  url = "https://api.tela.ai/prompt-version"
  params = {
      "promptId": prompt_id
  }

  headers = {
      "Authorization": f"Bearer {api_key}",
      "Content-Type": "application/json"
  }

  response = requests.get(url, params=params, headers=headers)
  prompt_versions = response.json()
  print(prompt_versions)
  ```
</CodeGroup>

### Response

The response includes an array of prompt version objects associated with the specified prompt ID.

```json theme={null}
[
  {
    "id": "version_uuid",
    "promptId": "prompt_uuid",
    "title": "My Prompt Version",
    "content": "Prompt content...",
    "markdownContent": "# Markdown content...",
    "configuration": {
      "model": "claude-3-opus-20240229",
      "temperature": 0.7,
      "type": "chat"
    },
    "variables": [
      {
        "name": "document",
        "type": "file",
        "required": true,
        "description": "The document to analyze"
      }
    ],
    "promoted": true,
    "draft": false,
    "createdAt": "2024-04-01T12:00:00.000Z",
    "updatedAt": "2024-04-01T12:30:00.000Z"
  }
]
```


## OpenAPI

````yaml GET /prompt-version
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:
    get:
      description: List prompt versions for a specific prompt
      operationId: getPromptVersions
      parameters:
        - name: promptId
          in: query
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: List of prompt versions
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PromptVersionResponse'
components:
  schemas:
    PromptVersionResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the prompt version
        promptId:
          type: string
          format: uuid
          description: UUID of the prompt this version belongs to
        title:
          type: string
          maxLength: 256
          description: Title of the prompt version
        content:
          type: string
          nullable: true
          description: Plain text content of the prompt version
        markdownContent:
          type: string
          nullable: true
          description: Markdown content of the prompt version
        configuration:
          type: object
          description: Configuration settings for the prompt version
          properties:
            model:
              type: string
              description: The model to use for this prompt version
            temperature:
              type: number
              description: Temperature setting for model generation
            type:
              type: string
              enum:
                - chat
                - completion
              description: Type of prompt (chat or completion)
            structuredOutput:
              type: object
              description: Settings for structured output
              properties:
                enabled:
                  type: boolean
                  description: Whether structured output is enabled
                schema:
                  type: object
                  description: JSON schema for structured output
          required:
            - model
            - type
        variables:
          type: array
          description: Array of variables used in the prompt
          items:
            type: object
            properties:
              name:
                type: string
                description: Name of the variable
              type:
                type: string
                enum:
                  - file
                  - text
                description: Type of the variable
              required:
                type: boolean
                description: Whether this variable is required
              description:
                type: string
                description: Description of the variable
              processingOptions:
                type: object
                description: Processing options for the variable
                properties:
                  allowMultimodal:
                    type: boolean
                    description: Whether multimodal processing is allowed
            required:
              - name
              - type
              - required
        promoted:
          type: boolean
          nullable: true
          description: Whether this version is promoted
        draft:
          type: boolean
          nullable: true
          description: Whether this version is a draft
        messages:
          description: Messages for chat-type prompts
          oneOf:
            - type: object
              properties:
                role:
                  type: string
                  enum:
                    - user
                    - assistant
                    - system
                    - function
                content:
                  type: string
                  nullable: true
                index:
                  type: integer
              required:
                - role
            - type: array
              items:
                type: object
                properties:
                  role:
                    type: string
                    enum:
                      - user
                      - assistant
                      - system
                      - function
                  content:
                    type: string
                    nullable: true
                  index:
                    type: integer
                required:
                  - role
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
      required:
        - id
        - promptId
        - title
        - configuration
        - variables

````