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

# Edit Document

> Edit a document using natural language instructions. Modify, redact, or transform document content programmatically.



## OpenAPI

````yaml api-reference/openapi.json post /edit
openapi: 3.1.0
info:
  title: Aifano Platform API
  version: 1.0.0
  description: >-
    Transform unstructured documents into structured data. Parse, extract,
    split, and edit documents at scale.
servers:
  - url: https://platform.aifano.com
    description: Production
security:
  - BearerAuth: []
paths:
  /edit:
    post:
      tags:
        - Document Processing
      summary: Edit Document
      description: >-
        Edit a document using natural language instructions. Modify, redact, or
        transform document content programmatically.
      operationId: edit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditRequest'
      responses:
        '200':
          description: Successful edit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EditResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    EditRequest:
      type: object
      required:
        - document_url
        - edit_instructions
      properties:
        document_url:
          type: string
          description: URL or aifano:// reference to the document to edit.
        edit_instructions:
          type: string
          description: Natural language instructions for editing the document.
    EditResponse:
      type: object
      properties:
        job_id:
          type: string
        duration:
          type: number
        usage:
          $ref: '#/components/schemas/Usage'
        result:
          type: object
    Usage:
      type: object
      properties:
        num_pages:
          type: integer
          description: Number of pages processed.
        credits:
          type: number
          nullable: true
          description: Credits consumed.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message.
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized - invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Use your Aifano API key (starts with `ak_live_`)
        as the Bearer token.

````