PATCH
/
prompt-version
/
{id}
curl --request PATCH \
  --url https://api.tela.com/prompt-version/{id} \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "<string>",
  "content": "<string>",
  "markdownContent": "<string>",
  "configuration": {
    "model": "<string>",
    "temperature": 123,
    "type": "chat",
    "structuredOutput": {
      "enabled": true,
      "schema": {}
    }
  },
  "variables": [
    {
      "name": "<string>",
      "type": "file",
      "required": true,
      "description": "<string>",
      "processingOptions": {
        "allowMultimodal": true
      }
    }
  ],
  "promoted": true,
  "draft": true,
  "messages": {
    "role": "user",
    "content": "<string>",
    "index": 123
  }
}'
{
  "id": "<string>",
  "promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "title": "<string>",
  "content": "<string>",
  "markdownContent": "<string>",
  "configuration": {
    "model": "<string>",
    "temperature": 123,
    "type": "chat",
    "structuredOutput": {
      "enabled": true,
      "schema": {}
    }
  },
  "variables": [
    {
      "name": "<string>",
      "type": "file",
      "required": true,
      "description": "<string>",
      "processingOptions": {
        "allowMultimodal": true
      }
    }
  ],
  "promoted": true,
  "draft": true,
  "messages": {
    "role": "user",
    "content": "<string>",
    "index": 123
  },
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}

Update a Prompt Version

This endpoint updates an existing prompt version with new configuration, variables, or content.

URL Parameters

ParameterTypeDescription
idstringThe ID of the prompt version to update

Request Body

The request body may include any of the following fields to update:

ParameterTypeDescription
titlestringThe title of the prompt version (max 256 characters)
contentstringPlain text content of the prompt
markdownContentstringMarkdown content of the prompt
configurationobjectConfiguration settings for the prompt version
variablesarrayAn array of variable objects used in the prompt
promotedbooleanWhether this version is promoted
draftbooleanWhether this version is a draft
messagesarray/objectMessages for chat-type prompts

Examples

const promptVersionId = 'version_uuid'
const updateData = {
  title: 'Document Analysis v2.1',
  configuration: {
    temperature: 0.5 // Updating just the temperature
  },
  promoted: true,
  draft: false
}

const response = await fetch(`https://api.tela.ai/prompt-version/${promptVersionId}`, {
  method: 'PATCH',
  headers: {
    'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(updateData)
})

const updatedVersion = await response.json()
console.log(updatedVersion)

Response

The response includes the updated prompt version object with the changes applied.

{
  "id": "version_uuid",
  "promptId": "prompt_uuid",
  "title": "Document Analysis v2.1",
  "content": "Analyze the following document and answer the question.",
  "markdownContent": "# Document Analysis\n\nAnalyze the following document and answer the question.",
  "configuration": {
    "model": "claude-3-opus-20240229",
    "temperature": 0.5, 
    "type": "chat"
  },
  "variables": [
    {
      "name": "document",
      "type": "file",
      "required": true,
      "description": "The document to analyze"
    },
    {
      "name": "query",
      "type": "text",
      "required": true,
      "description": "The specific question about the document"
    }
  ],
  "promoted": true,
  "draft": false,
  "messages": [
    {
      "role": "system",
      "content": "You are a document analysis assistant."
    },
    {
      "role": "user",
      "content": "Please analyze the document {{document}} and answer this question: {{query}}"
    }
  ],
  "createdAt": "2024-04-01T12:00:00.000Z",
  "updatedAt": "2024-04-15T14:30:00.000Z"
}

Update Variables Example

const promptVersionId = 'version_uuid'
const updateData = {
  variables: [
    {
      name: 'document',
      type: 'file',
      required: true,
      description: 'The document to analyze'
    },
    {
      name: 'query',
      type: 'text',
      required: true,
      description: 'The specific question about the document'
    },
    {
      name: 'format',
      type: 'text',
      required: false,
      description: 'Preferred format for the analysis (bullet points, paragraph, etc.)'
    }
  ]
}

const response = await fetch(`https://api.tela.ai/prompt-version/${promptVersionId}`, {
  method: 'PATCH',
  headers: {
    'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(updateData)
})

const updatedVersion = await response.json()
console.log(updatedVersion)

Path Parameters

id
string
required

Body

application/json
title
string

Title of the prompt version

Maximum length: 256
content
string | null

Plain text content of the prompt version

markdownContent
string | null

Markdown content of the prompt version

configuration
object

Configuration settings for the prompt version

variables
object[]

Array of variables used in the prompt

promoted
boolean

Whether this version is promoted

draft
boolean

Whether this version is a draft

messages

Messages for chat-type prompts

Response

200 - application/json
Prompt version updated successfully
id
string
required

Unique identifier for the prompt version

promptId
string
required

UUID of the prompt this version belongs to

title
string
required

Title of the prompt version

Maximum length: 256
configuration
object
required

Configuration settings for the prompt version

variables
object[]
required

Array of variables used in the prompt

content
string | null

Plain text content of the prompt version

markdownContent
string | null

Markdown content of the prompt version

promoted
boolean | null

Whether this version is promoted

draft
boolean | null

Whether this version is a draft

messages

Messages for chat-type prompts

createdAt
string

Creation timestamp

updatedAt
string

Last update timestamp