Use this endpoint to modify prompt templates after creation. Updates create a new version of the template, maintaining a complete version history for auditing and rollback.
prompt_id string required
The unique identifier of the prompt template to update.
organizationId string required
The unique identifier of the organization that owns the prompt template.
name string optional
Update the human-readable name of the prompt template.
description string optional
Update the detailed description of the template's purpose and usage.
content string optional
Update the prompt template content. Changes to the content will be reflected in all future uses of this template.
variables object optional
Update the variable definitions for the template. Adding new variables, modifying types/descriptions, or changing required status.
tags array optional
Update the tags assigned to the template. Tags are used for categorization and filtering.
isPublic boolean optional
Update the public status of the template. Changing from private to public makes it discoverable in the template gallery.
metadata object optional
Update or add custom metadata to the template.
versionNotes string optional
A brief description of the changes made in this version. Used for version history tracking.
Returns the updated prompt template object with the new version information:
id string
The unique identifier of the prompt template (unchanged).
object string
Always set to "prompt".
name string
The updated name (or unchanged if not modified).
description string
The updated description (or unchanged if not modified).
content string
The updated prompt content (or unchanged if not modified).
variables object
The updated variable definitions (or unchanged if not modified).
tags array
The updated tags (or unchanged if not modified).
isPublic boolean
The updated public status (or unchanged if not modified).
metadata object
The updated metadata (or unchanged if not modified).
createdAt integer
Original creation timestamp (unchanged).
updatedAt integer
New timestamp reflecting the update time.
version string
New version identifier (auto-generated, typically increments from previous version).
previousVersion string
The version identifier of the previous version (for rollback reference).
versionNotes string
The notes provided for this version update.
usage object optional
Current usage statistics reflecting all versions of the template.
A PromptResponse object containing the API response data.
- Bash
- Python
- JavaScript
curl -X PATCH "https://api.freddy.aitronos.com/v1/prompts/prompt_abc123?organizationId=org_abc123" \
-H "Authorization: Bearer $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "You are an expert code reviewer with a focus on {{focus_areas}}. Analyze this {{language}} code:\n\n{{code}}\n\nProvide feedback structured as:\n1. Strengths\n2. Areas for improvement\n3. Security considerations",
"versionNotes": "Enhanced feedback structure and added security review"
}'{
"id": "prompt_abc123",
"object": "prompt",
"name": "Code Review Assistant",
"description": "Reviews code pull requests and provides improvement suggestions",
"content": "You are an expert code reviewer with a focus on {{focus_areas}}. Analyze this {{language}} code:\n\n{{code}}\n\nProvide feedback structured as:\n1. Strengths\n2. Areas for improvement\n3. Security considerations",
"variables": {
"focus_areas": {
"type": "string",
"description": "Areas to focus the review on (e.g., security, performance, readability)",
"required": false,
"default": "best practices"
},
"code": {
"type": "string",
"description": "The code to review",
"required": true
},
"language": {
"type": "string",
"description": "Programming language of the code",
"required": true,
"enum": ["javascript", "python", "java", "go", "rust", "typescript"]
}
},
"tags": ["code-review", "development", "quality"],
"isPublic": false,
"metadata": {
"team": "engineering",
"category": "code-quality"
},
"createdAt": 1735689600,
"updatedAt": 1736208000,
"version": "1.1.0",
"previousVersion": "1.0.0",
"versionNotes": "Enhanced feedback structure and added security review",
"usage": {
"totalCalls": 45,
"lastUsedAt": 1736208000,
"averageResponseTime": 2.3
}
}404 Not Found
{
"error": {
"message": "Prompt template not found",
"type": "not_found_error",
"code": "prompt_not_found",
"param": "prompt_id"
}
}403 Forbidden
{
"error": {
"message": "Insufficient permissions to update this prompt template",
"type": "permission_error",
"code": "insufficient_permissions",
"param": "prompt_id"
}
}422 Validation Error
{
"error": {
"message": "Invalid variable type specified",
"type": "invalid_request_error",
"code": "invalid_variable_type",
"param": "variables.code.type",
"details": "Type must be one of: string, number, boolean, array, object, image, file"
}
}- Create Prompt
- List Prompts
- Retrieve Prompt
- Delete Prompt
- Version History (planned)
- Using Prompt Templates
Note: Updating a prompt template creates a new version but does not affect ongoing conversations or cached prompt results. All existing references to the template ID will use the latest version unless a specific version is requested.