Skip to main content
PUT
Update Prompt
Updates an existing prompt. A new version snapshot is automatically created on every update, preserving the full change history.

Authentication

Requires JWT Bearer token (Cognito) with admin role.

Path Parameters

string
required
Prompt UUID to updateFormat: UUIDExample: 550e8400-e29b-41d4-a716-446655440000

Request Body

All fields are optional — only provide the fields you want to update.
string
Updated prompt nameMax length: 200
string
Updated agent section assignmentValues: parser, gap_detector, risk_analysis, report_generation
string
Updated sub-sectionMax length: 100
string
Updated frontend route association
array
Updated list of applicable risk categories
array
Updated tags
string
Updated system prompt
string
Updated user prompt templateSupports variable substitution: {{category_1}}, {{category_2}}, {{categories}}
string
Updated tone instructionsMax length: 500
string
Updated output format instructionsMax length: 5000
array
Updated few-shot examplesEach example has:
  • input (string, required): Example user input
  • output (string, required): Expected model output
object
Updated context configurationProperties:
  • persona (string): System persona definition
  • sources (array): List of reference sources
  • constraints (string): Operational constraints
  • guardrails (string): Safety guardrails
boolean
Set to true to activate this promptMay deactivate other prompts in the same section to maintain the rule: only one active prompt per section.

Response

object
The updated prompt object with incremented version number

Example Request

Example Response

Error Responses

error
Validation error (invalid field values)
error
Missing or invalid Bearer token
error
Forbidden — admin role required
error
Prompt not found
error
Conflict — concurrent update detectedThis occurs when another user updated the prompt between your read and write operations.

Versioning

On every update:
  1. Current prompt state is snapshotted to prompt_versions table
  2. Prompt version is incremented
  3. Prompt record is updated with new values
  4. A change record is created in prompt_changes table with:
    • changeType: UPDATE
    • changes field containing field-level diffs (old vs new values)
    • authorId (user who made the change)
    • version (new version number)
This allows full audit trail and rollback capabilities.

Conflict Detection

The update endpoint implements optimistic locking:
  • If the prompt was modified by another user since you last read it, you’ll receive a 409 Conflict error
  • Re-fetch the latest version, review changes, and retry your update

Partial Updates

Only the fields you provide in the request body are updated:
This will update only the tags field, leaving all other fields unchanged.

Source Code

Implementation: packages/api/src/prompts/prompts.controller.ts:159