Skip to main content
POST
Edit Document

Edit a Document

Apply AI-powered edits to your document using natural language instructions. The API uses advanced language models to understand your intent and make precise edits to the document.

Path Parameters

string
required
The unique identifier of the document to edit (UUID from upload response)

Request Body

string
required
Client-provided UUID for idempotency and tracking. Generate a new UUID for each edit request.
string
required
Natural language instructions describing the edit to apply (e.g., “Change the title to ‘Q4 Report’ and update all dates to 2024”)
string
Optional text excerpt to help locate the section to edit in longer documents. Use this to pinpoint the exact location for the edit.
boolean
Use a larger, more capable model for complex edits. Default is false.

Response

string
required
The UUID of the edit operation (same as request)
boolean
required
Whether the edit was successfully applied
number
required
Time taken to process the edit in seconds
string
required
Name of the edited document
string
required
UUID of the edited document

Code Examples

Example Response

Edit Instructions Best Practices

Be specific and clear: The more specific your instructions, the better the results. - ✅ Good: “Change the company name from ‘Acme Corp’ to ‘Global Industries Inc.’ in the header” - ❌ Vague: “Update the company info”

Examples of Edit Instructions

Replace all occurrences of “2023” with “2024”
Add a new section titled “Risk Analysis” after the Executive Summary with placeholder text
Make all section headings bold and increase font size to 16pt
In the financial table, update Q4 revenue to $2.5M and recalculate the total. Also add a footnote explaining the increase.

Using lookupText for Long Documents

For documents longer than a few pages, use lookupText to help the AI locate the correct section:

Sequential Edits

All edits to the same document are queued and processed sequentially. Each edit waits for the previous one to complete:

Error Responses

The document’s TTL (time to live) is automatically refreshed after each successful edit.