Save Document Data
Save sidebar field values and complex table rows on a document without completing it. The document keeps its status, and no export, webhook or completion side effect runs. Use it to store edits made outside the Staple UI, for example from a review tool of your own.
HOW TO ADDRESS DATA
- Sidebar fields are addressed by
fieldUuid. Get the ids fromPOST /v2/search/documents/model/fields(field_id) or from the document JSON returned byGET /v1/documents/:docId(field_idon each field). - Tables are addressed by
tableTypeIdortableName, plus a 0-basedpageNumber. Get the table type and header ids fromPOST /v2/search/documents/model/tables.tableNameis the model’s table name returned there (for exampleTax Table); the name a document shows for its own table is accepted too. - Rows are addressed by
lineItemIdor 0-basedrowIndexon that page. Cells are keyed by header id or header name: the model’sheaderName(for exampleTax Code), or the column name the document shows. - A name that matches more than one table type or header is rejected with 400. Use the id instead.
HOW ROWS ARE APPLIED
- On an existing row only the cells you send change. Cells you leave out keep their value.
- Only the rows you send change. Rows you do not mention are kept as they are.
- Rows without
lineItemIdorrowIndexare added at the end of the page. A new row needs at least one cell. - To clear a value, send it as an empty string.
removeRowsdeletes rows on that page, each bylineItemIdorrowIndex(the position before this save). A row cannot be patched and removed in the same request.- Rows on other pages are untouched.
removeColumns(header id or name) removes those columns from every page of the table type, the same as removing a column in the editor.
VALIDATION AND VERSIONING
- Every changed value is validated against the data type of its field or header. If any value is invalid the whole request is refused with 422 and
errors.invalidValues, and nothing is saved. - Send
expectedDataVersionwith thedataVersionyou received fromGET /v1/documents/:docId. If someone changed the document since then the request is refused with 409 anderrors.currentDataVersion. Reload the document, or resend with the current version to overwrite. - Locked fields and exported documents cannot be changed (403).
- Limited to 6 calls per 30 seconds per user.
REQUEST HEADERS
REQUEST PAYLOAD
At least one of fields or tables is required. Each table entry needs at least one of rows, removeRows, removeColumns.
RESPONSE BODY
ERRORS
Authentication
x-api-keystring
API key issued by Staple.
AuthorizationBearer
JWT obtained from the login endpoint.
Request
This endpoint expects an object.
documentId
qid
expectedDataVersion
fields
tables
Response
OK