Make changes to documents
const url = 'https://api.adversarial.com/api/v1/documents/cybergov/versions/2026.9.1/editor';const options = { method: 'PATCH', headers: {'Content-Type': 'application/json'}, body: '[{"node_type":"selected_option","value":"example","node_id":"example"}]'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.adversarial.com/api/v1/documents/cybergov/versions/2026.9.1/editor \ --header 'Content-Type: application/json' \ --data '[ { "node_type": "selected_option", "value": "example", "node_id": "example" } ]'Accepts selected_option changes for switches and selectors, toggle_state changes for
toggles, control_value changes for document-level controls, and table_rows snapshots for
editable tables. A switch bound to a control takes no selection of its own: write the
control with control_value and every switch and conditional block keyed on it follows.
A selected_option change targeting a bound or locked switch is rejected.
Changes target the version named in the path, validated against that version’s template.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The document slug
Example
cybergovThe document version
Example
2026.9.1Request Bodyrequired
Section titled “Request Bodyrequired”Defines some form of selection/edit that a user has made for a document item.
object
Contains the id of the selected option
object
Contains the id of the selected option
object
Whether a toggle’s content is enabled
object
Whether a toggle’s content is enabled
Contains the selected value id of a document-level control
object
Contains the selected value id of a document-level control
Complete logical rows of an editable table.
object
Complete logical rows of an editable table.
Organization-authored content attached to a template section.
object
Organization-authored content attached to a template section.
object
Markdown source supplied by the organization.
Whether the supplement has been deleted.
Whether compiled readers include the supplement.
Short editor-facing title.
Source of the supplement. Organization edits must use organization.
Template section attachment key.
The id of the document item that was changed. this is the PK of the doc_item_reference table.
Responses
Section titled “Responses”Documents updated
object
Examplegenerated
{ "created": { "by": "example", "date": "2026-04-15T12:00:00Z" }, "id": 1, "proposal": 1, "updated_date": "2026-04-15T12:00:00Z"}The version is archived or the changes are invalid
The organization cannot see this document version