Skip to main content
POST
Preview. This endpoint is available to organisations in the Wordsmith MCP pilot. Other organisations receive 403 mcp_not_enabled. See the preview overview.
Makes the edits your instructions describe, as tracked changes in a new DOCX. The original file is not changed. Use it for one-off edits, such as “make the governing law English law”. The input can be a DOCX, a DOC, a PDF, or a text, Markdown or HTML file. Anything but a DOCX is converted to DOCX first, so its layout may change. The action runs as an operation of type document_action: the response comes back straight away, and the work runs in the background. Wait for it with wait, a callback_url, or Get Operation. The new files land in your private space. The input files are not changed. Document actions use no credits.

Authentication

Send an API key, or an OAuth access token with both the files:write and files:read scopes. files:write lets the action create its output; files:read lets it read the inputs. A token without either gets 403 with "error": "insufficient_scope".

Path parameters

string (uuid)
required
The file to edit.

Headers

string
A unique key for this request, such as a UUID, up to 255 characters. A repeat with the same key within 30 days returns 200 with the same operation and does the work once. A repeat with a different body returns 409 idempotency_key_reused.

Body parameters

string
required
The edits to make, in plain language, up to 10,000 characters. Quote the text to change where you can.
string
The author shown on each tracked change in Word. Defaults to your redline author name, or your organisation’s name.
string
The party you act for, such as "Buyer" or a party’s name. Edits lean towards this party. When omitted, Wordsmith infers it from the document and your company profile.
integer
default:"0"
Seconds to wait for the action to finish before responding, from 0 to 20. Short documents with a few edits often finish inside 20.
string
A public HTTPS URL that receives a signed operation.succeeded, operation.failed or operation.cancelled event when the action finishes. API keys only: an OAuth caller waits or polls instead.

Response

Returns 202 with an operation of type document_action. Its resource is the input file. A repeat with the same Idempotency-Key returns 200 with the same operation. When status is succeeded, result is { "action": "redline", "file_ids", "summary" }. file_ids holds one id: the edited DOCX. summary is { "insertions", "deletions" }, counting the tracked changes in the output, or null if they could not be counted. When status is failed, error.code says why:
string (uuid)
The operation’s id.
string
document_action.
string
queued until a worker starts the action, then running, succeeded, failed or cancelled.
object | null
{ "stage", "completed", "total" }. null until the work starts.
object
{ "type": "file", "id" }: the input file.
object | null
Set when status is succeeded.
object | null
{ "code", "message", "retryable" }, set when status is failed.
integer | null
When to ask again. null once the operation has finished.
string
ISO 8601 UTC.
string
ISO 8601 UTC.
string | null
ISO 8601 UTC, once the operation has finished.

Errors