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

# Update Prompt

> Update a prompt by creating a new version with updated content

## Overview

Update an existing prompt by creating a new version. The version number is automatically incremented. Previous versions are preserved and can be retrieved using the [Get Prompt Versions](/api-reference/public/prompt-versions) endpoint.

## Authentication

<ParamField header="X-API-Key" type="string" required>
  Your eigi.ai API key. Must be prefixed with `vk_`.
</ParamField>

## Path Parameters

<ParamField path="prompt_name" type="string" required>
  The unique name of the prompt to update.
</ParamField>

## Request Body

<ParamField body="prompt_content" type="string" required>
  The new prompt text content for the new version.
</ParamField>

<ParamField body="prompt_metadata" type="object">
  Updated metadata for the prompt.

  <Expandable title="properties">
    <ParamField body="prompt_type" type="string">
      Type of prompt: `main` or `analysis`.
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="prompt_name" type="string">
  The prompt name.
</ResponseField>

<ResponseField name="prompt_version" type="integer">
  The new version number (auto-incremented).
</ResponseField>

<ResponseField name="prompt_content" type="string">
  The updated prompt content.
</ResponseField>

<ResponseField name="prompt_metadata" type="object">
  Prompt metadata.
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 creation timestamp.
</ResponseField>

<ResponseField name="updated_at" type="string">
  ISO 8601 last update timestamp.
</ResponseField>


## OpenAPI

````yaml PATCH /v1/public/prompts/{prompt_name}
openapi: 3.0.0
info:
  title: eigi.ai API
  description: REST API for managing AI voice agents and conversations
  version: 1.0.0
  contact:
    email: buddy@eigi.ai
    url: https://eigi.ai
servers:
  - url: https://api.eigi.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v1/public/prompts/{prompt_name}:
    patch:
      tags:
        - Prompts
      summary: Update Prompt
      description: >-
        Update a prompt by creating a new version. The version number is
        automatically incremented.
      operationId: updatePrompt
      parameters:
        - name: prompt_name
          in: path
          required: true
          description: The unique prompt name
          schema:
            type: string
          example: customer_support_v1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptUpdate'
            examples:
              update:
                summary: Update prompt content
                value:
                  prompt_content: >-
                    You are an expert customer support agent with 10 years of
                    experience. Always be empathetic and solution-oriented.
      responses:
        '200':
          description: Prompt updated (new version created)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromptResponse'
        '400':
          description: Bad request - Missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PromptUpdate:
      type: object
      required:
        - prompt_content
      properties:
        prompt_content:
          type: string
          minLength: 1
          description: New prompt text content
          example: >-
            You are an expert customer support agent for TechCorp with 10 years
            of experience.
        prompt_metadata:
          type: object
          description: Updated metadata for the prompt
          properties:
            prompt_type:
              type: string
              enum:
                - main
                - analysis
              description: 'Type of prompt: ''main'' or ''analysis'''
    PromptResponse:
      type: object
      properties:
        prompt_name:
          type: string
          description: Unique prompt name
        prompt_version:
          type: integer
          description: Version number of the prompt
        prompt_content:
          type: string
          description: The prompt text content
        prompt_metadata:
          type: object
          description: Additional metadata
        created_at:
          type: string
          format: date-time
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Last update timestamp
    Error:
      type: object
      properties:
        detail:
          type: string
          description: Error message
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get your API key from the eigi.ai Dashboard
        under Settings â†’ API Keys.

````