documents.content.edit
Edit an agreement template or contractor template in place with 1 to 50 operations applied together, all or nothing: replace_text, delete_text, insert_text (Markdown at the start or end, or before or after the block holding anchor text), place_signature_section (moves it if already placed), insert_page_break, replace_document, set_title, set_description, set_letterhead, set_field (label, required, default), remove_field, set_signers, and for agreements set_footer (up to two lines with merge fields and {{page}} / {{pages}}; null for the default footer), set_logo (a library image, or null for the company logo), insert_image (a library image with alt, width 10–100 percent and align), insert_saved_block (a saved block from documents.snippets.list) and insert_record_details (a record's details from documents.records.search as plain text: lines, values or table, optionally only some fields by key). Text is found by quoting it exactly, though spacing may differ; quote enough to be unique or pass occurrence. Pass expectedRevision to refuse if it changed since you read it; without it, quoted edits apply to the latest version. Anyone with it open in the agreement writer sees the change at once. Starter templates and uploaded files are read-only. Returns the new revision and a line per change.
/api/v1/accounting/documents.content.editPermissions
Who can call it
Retries
MCP
accounting_documents_content_editFields
documentTypeenumRequiredagreement_templatecontractor_templatedocumentIdstring (ID)RequiredThe ID of the related record.
expectedRevisionintegerThe record's current revision, from the last time you read it. If someone changed the record since, the request is refused with a conflict so you can reload and check before trying again.
at most 9007199254740991 · greater than 0
operationsarray of objectsRequired1–50 items
idempotencyKeystringRequiredAny unique text you generate once per intended change, so a retried request only happens once. Send it as the Idempotency-Key header instead if you prefer; if you send both they must match.
8–200 characters
Example
curl https://app.getoatmilk.com/api/v1/accounting/documents.content.edit \
-H "Authorization: Bearer $OATMILK_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"documentType": "agreement_template",
"documentId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"operations": [
{
"type": "replace_text",
"find": "example",
"replace": "example"
}
]
}'{
"data": { … }
}Try it
Try it
Checks your input with this action’s real schema and answers like the API, with synthetic data. No key needed, and nothing changes.
curl https://app.getoatmilk.com/api/v1/accounting/documents.content.edit \
-H "Authorization: Bearer $OATMILK_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"documentType": "agreement_template",
"documentId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"operations": [
{
"type": "replace_text",
"find": "example",
"replace": "example"
}
]
}'More in Documents and signing.