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

# Update Prompt

> Updates a prompt's metadata (text, type, volume, topic, geography, locations). Only the supplied fields change. Returns a before/after snapshot.

A prompt's **text** (`prompt`) can only be changed while the prompt has not streamed any responses yet. Once it has responses, sending a changed `prompt` returns `400` — delete the prompt and create a new one instead. All other fields (type, volume, topic, geography, locations) remain editable at any time, and re-sending the existing text unchanged is always allowed.



## OpenAPI

````yaml /api-reference/openapi.json patch /api/v1/prompts/{prompt_id}
openapi: 3.1.0
info:
  title: AthenaHQ API
  description: >-
    AthenaHQ API provides programmatic access to manage your websites and
    prompts for AI-powered content optimization.
  version: 1.0.0
  contact:
    email: support@athenahq.ai
servers:
  - url: https://api.athenahq.ai
    description: Production server
security:
  - apiKey: []
tags:
  - name: Basics
    description: Core API operations for managing websites and prompts
  - name: Metrics
    description: Metrics and analytics endpoints for tracking AI visibility
  - name: Billing
    description: Billing and credits endpoints for managing usage
  - name: Team Management
    description: Endpoints for managing team members and invitations
  - name: Groups
    description: Endpoints for managing groups of websites
  - name: Content
    description: >-
      Endpoints for accessing Content Hub data — tabs, tracked URLs, and per-URL
      prompt breakdowns.
  - name: Pitch Workspace
    description: >-
      Endpoints for accessing pitch workspace reports — org-scoped pitch runs
      with competitors, prompts, attributes, and aggregate metrics.
  - name: Knowledge Base
    description: >-
      Endpoints for reading the brand Knowledge Base — approved brand facts and
      the pillars that organize them.
paths:
  /api/v1/prompts/{prompt_id}:
    patch:
      tags:
        - Basics
      summary: Update Prompt
      description: >-
        Updates a prompt's metadata (text, type, volume, topic, geography,
        locations). Only the supplied fields change. Returns a before/after
        snapshot.


        A prompt's **text** (`prompt`) can only be changed while the prompt has
        not streamed any responses yet. Once it has responses, sending a changed
        `prompt` returns `400` — delete the prompt and create a new one instead.
        All other fields (type, volume, topic, geography, locations) remain
        editable at any time, and re-sending the existing text unchanged is
        always allowed.
      operationId: updatePrompt
      parameters:
        - name: prompt_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The prompt to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - website_id
              properties:
                website_id:
                  type: string
                  format: uuid
                  description: Website that owns the prompt.
                prompt:
                  type: string
                  description: >-
                    New prompt text. Trimmed; blank is rejected. Editable only
                    while the prompt has no responses yet — changing it after
                    responses have streamed returns `400`. Re-sending the
                    current text unchanged (e.g. in a full-object PATCH) is
                    always allowed, as are metadata-only edits.
                type:
                  type: string
                  enum:
                    - discovery
                    - high_intent
                  nullable: true
                volume:
                  type: string
                  nullable: true
                topic_id:
                  type: string
                  format: uuid
                  nullable: true
                countries:
                  type: array
                  maxItems: 1000
                  items:
                    type: string
                primary_country:
                  type: string
                  nullable: true
                  description: When `countries` is non-empty it must be one of them.
                location_ids:
                  type: array
                  maxItems: 1000
                  items:
                    type: string
                    format: uuid
      responses:
        '200':
          description: Prompt updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  text:
                    type: string
                  type:
                    type: string
                    nullable: true
                  volume:
                    type: string
                    nullable: true
                  topic_id:
                    type: string
                    nullable: true
                  locations:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                        name:
                          type: string
                  countries:
                    type: array
                    items:
                      type: string
                  before:
                    type: object
                    description: Pre-update snapshot.
                    properties:
                      text:
                        type: string
                      type:
                        type: string
                        nullable: true
                      volume:
                        type: string
                        nullable: true
                      topic_id:
                        type: string
                        nullable: true
                      countries:
                        type: array
                        items:
                          type: string
                      location_ids:
                        type: array
                        items:
                          type: string
        '400':
          description: Bad request - Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                text_edit_after_responses:
                  summary: Text change blocked — prompt already has responses
                  value:
                    error: >-
                      Prompt text cannot be edited once the prompt has
                      responses. Delete the prompt and create a new one with the
                      updated text.
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - You don't have access to this website
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                no_access:
                  value:
                    error: Unauthorized access to this website
        '404':
          description: Not found - Prompt not found, deleted, or on another website
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                not_found:
                  value:
                    error: Prompt not found
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiKey: []
components:
  schemas:
    Error:
      type: object
      description: Error response object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message describing what went wrong
          example: Unauthorized
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. You can create one
        [here](https://app.athenahq.ai/organization?tab=api).

````