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

# Update PrePrompt

> Updates key/value pairs for an existing pre-prompt.

Modify any combination of `key`, `publicValue`, `maskedValue`, `description`, or
`tags` for an existing pre-prompt. Authenticate with `BACKEND_SECRET` headers.

## Request Body

All fields are optional. Only include the fields you want to update.

| Field         | Type      | Description                     |
| ------------- | --------- | ------------------------------- |
| `key`         | string    | Unique identifier (2-64 chars)  |
| `publicValue` | string    | User-facing label (1-512 chars) |
| `maskedValue` | string    | Hidden prompt (1-4000 chars)    |
| `description` | string    | Optional description            |
| `tags`        | string\[] | Optional tags array             |


## OpenAPI

````yaml PUT /api/v1/preprompts/{id}
openapi: 3.1.0
info:
  title: Handa Uncle API
  version: 1.0.0
  description: Public specification for the Handa Uncle web and mobile APIs.
  contact:
    name: Handa Uncle Engineering
    email: hello@handauncle.com
servers:
  - url: https://handauncle-backend-prod-205012263523.asia-south1.run.app
    description: Prod API base (Cloud Run)
  - url: https://api.handauncle.com
    description: Production
  - url: https://staging-api.handauncle.com
    description: Staging
  - url: http://localhost:8080
    description: Local development
security: []
tags:
  - name: Mobile App
    description: Endpoints used by the native Handa Uncle app.
  - name: Platform
    description: Cross-service operational endpoints.
  - name: Auth
    description: Authentication endpoints handled by the backend adapter.
  - name: AI
    description: LLM chat endpoints supporting streaming and device-auth guests.
  - name: OTP
    description: Phone OTP lifecycle powered by Exotel.
  - name: Webhooks
    description: Server-to-server hooks invoked by Auth0.
  - name: Conversations
    description: Authenticated user conversation management.
  - name: Chat Share
    description: Create, manage, and consume shared conversations.
  - name: Files
    description: Upload, list, and delete user files.
  - name: Prompt management
    description: Admin and public APIs for managing masked pre-prompts.
  - name: User Profile
    description: Profile card collection and user data for personalized AI responses.
  - name: Visual Embeds
    description: Manage visual embed images that attach to AI chat responses.
  - name: Second Opinion
    description: Admin and public APIs for Second Opinion suggestion cards.
  - name: Profile Cards
    description: >-
      APIs for managing profile card questions used in onboarding and
      personalization.
paths:
  /api/v1/preprompts/{id}:
    put:
      tags:
        - Prompt management
      summary: Update a pre-prompt
      description: Updates key/value pairs for an existing pre-prompt.
      operationId: updatePrePrompt
      parameters:
        - $ref: '#/components/parameters/PrePromptIdParam'
        - $ref: '#/components/parameters/BackendSecretHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrePromptUpdateRequest'
      responses:
        '200':
          description: PrePrompt updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrePromptResponseEnvelope'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    PrePromptIdParam:
      name: id
      in: path
      required: true
      description: PrePrompt identifier (UUID).
      schema:
        type: string
        minLength: 8
        maxLength: 64
    BackendSecretHeader:
      name: X-Backend-Secret
      in: header
      required: false
      description: >-
        Backend secret token required for admin-only endpoints. Provide either
        this header or `Authorization: Bearer <secret>`.
      schema:
        type: string
  schemas:
    PrePromptUpdateRequest:
      type: object
      properties:
        key:
          type: string
          minLength: 2
          maxLength: 64
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9_-]{1,63}$
        publicValue:
          type: string
          minLength: 1
          maxLength: 512
        maskedValue:
          type: string
          minLength: 1
          maxLength: 4000
        description:
          type: string
          maxLength: 500
          nullable: true
        tags:
          type: array
          items:
            type: string
            maxLength: 50
          maxItems: 16
          nullable: true
      minProperties: 1
      additionalProperties: false
    PrePromptResponseEnvelope:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/PrePrompt'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      required:
        - success
        - data
        - meta
    PrePrompt:
      type: object
      properties:
        id:
          type: string
          description: PrePrompt identifier (UUID).
        key:
          type: string
        publicValue:
          type: string
        maskedValue:
          type: string
        description:
          type: string
          nullable: true
        tags:
          type: array
          items:
            type: string
          nullable: true
        isDeleted:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - key
        - publicValue
        - maskedValue
        - isDeleted
        - createdAt
        - updatedAt
    ResponseMeta:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        requestId:
          type: string
          description: Server generated correlation identifier.
      required:
        - timestamp
        - requestId
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          $ref: '#/components/schemas/ErrorObject'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      required:
        - success
        - error
        - meta
    ErrorObject:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message describing the issue.
          example: Please enter a valid 10-digit phone number (e.g., 9876543210)
        code:
          type: string
          description: Error code for programmatic handling.
          example: VALIDATION_ERROR
        details:
          type: array
          description: >-
            Array of field-specific validation errors (for VALIDATION_ERROR
            responses).
          items:
            type: object
            properties:
              field:
                type: string
                description: Field name that failed validation.
                example: phone
              message:
                type: string
                description: Specific validation error message for this field.
                example: Please enter a valid 10-digit phone number (e.g., 9876543210)
            required:
              - field
              - message
      required:
        - message
  responses:
    ValidationError:
      description: The request payload or headers were invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnauthorizedError:
      description: Authentication failed or is missing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFoundError:
      description: Requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

````