> ## 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.

# Edit Content Draft

> Apply exact find-and-replace edits to a content draft's article body. Deterministic, no AI model involved: your replacement text lands verbatim (use the revise endpoint when you want an AI rewrite from an instruction). Each edit's find text must match the current body exactly once; zero or multiple matches fail the whole call with 400 and nothing is saved, so extend the find text until it is unique. Edits apply in order, later ones see earlier results, and the batch is recorded as one new version, recoverable via the versions endpoints. Pass expected_version_number from the draft endpoint to fail with 409 when a new version was recorded after your read (a revision, edit, or restore). An app autosave changes the body without recording a version; that drift is caught by the anchors themselves, since a moved or vanished find text fails the call.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/content/{content_id}/edit
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/content/{content_id}/edit:
    post:
      tags:
        - Content
      summary: Edit Content Draft
      description: >-
        Apply exact find-and-replace edits to a content draft's article body.
        Deterministic, no AI model involved: your replacement text lands
        verbatim (use the revise endpoint when you want an AI rewrite from an
        instruction). Each edit's find text must match the current body exactly
        once; zero or multiple matches fail the whole call with 400 and nothing
        is saved, so extend the find text until it is unique. Edits apply in
        order, later ones see earlier results, and the batch is recorded as one
        new version, recoverable via the versions endpoints. Pass
        expected_version_number from the draft endpoint to fail with 409 when a
        new version was recorded after your read (a revision, edit, or restore).
        An app autosave changes the body without recording a version; that drift
        is caught by the anchors themselves, since a moved or vanished find text
        fails the call.
      operationId: content.edit
      parameters:
        - name: content_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                website_id:
                  type: string
                edits:
                  type: array
                  minItems: 1
                  maxItems: 20
                  items:
                    type: object
                    properties:
                      find:
                        type: string
                        minLength: 1
                        maxLength: 10000
                      replace:
                        type: string
                        maxLength: 10000
                    required:
                      - find
                      - replace
                expected_version_number:
                  type: integer
                  minimum: 1
              required:
                - website_id
                - edits
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  content_id:
                    type: string
                  body:
                    type: string
                  version_number:
                    type: integer
                  version_id:
                    type: string
                  body_word_count:
                    type: integer
                  previous_body_word_count:
                    type: integer
                required:
                  - content_id
                  - body
                  - version_number
                  - version_id
                  - body_word_count
                  - previous_body_word_count
        '400':
          description: Bad Request — validation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '429':
          description: Rate Limited
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '500':
          description: Internal Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
components:
  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).

````