Create Edit

Edit a file. The result has two files: files.comparison, the redline, holds the edits as Word tracked changes attributed to the user (or to author, when the user names someone else); files.clean, the edited document, carries none: every tracked change in it is accepted. Read the file's listing first (GET /v1/files/{file_id}?format=md) and copy every locator from it. Give a one-line description of what the edits change.

To edit the result again, pass its files.clean.file_id as file_id: that file is the edited document. Never upload or name the original again for a further change, which would drop this edit. Your further edits for the same piece of work ("also change…") amend the version the first one made, the user's working draft, so one version holds all of their changes. Pass new_version: true when the user asks for a new version or a separate draft: "create a version", "up version", "save as", or a draft for someone else, such as a template filled in for a customer. Pass amend: true with an earlier version's file_id when the change belongs there too ("fix the template as well"); later versions get it too, even one whose redline is still being made. Pass version_name, the user's name for the file you save.

Every edit has a type and that type's fields; unknown fields are refused. The request is all or nothing: if any edit is refused, none is applied and every refusal is reported together, each naming its edit by its index, so fix them all and send the corrected request. A request that accepts or rejects revisions holds only accept_revision and reject_revision edits. Every locator and selector names the file as listed, whatever earlier edits in the request did. Repeating a request repeats its effect: sending an insertion twice inserts twice.

When the file is a version of one of your documents, the edit is kept as that document's next version: the result's version, and app_url opens its redline in the Version Story app. An edit of any other file is one-off; to keep its history, make a document of the file first (POST /v1/documents with its file_id). The call answers at once with status processing, the edit_id and both files' file_ids; GET /v1/edit/{edit_id} returns the files once the edit is applied. With wait: true, the call holds its answer as GET /v1/edit/{edit_id} does.

post/v1/edit

Request

  • Base URL
    https://api.versionstory.com (the document declares no server; this is the origin it was published from)
  • URL
    https://api.versionstory.com/v1/edit
  • Auth
    HTTP bearer

Headers

X-Customer-Idstring nullable

Id of one of your customers (created in the developer dashboard) to attribute this request's credit usage to. Billing and limits stay organization-wide.

Request body

file_idstring required

The file to edit: the file_id POST /v1/files returned, or a version's file_id.

schema_versioninteger required

The listing's schema_version; a mismatch is refused.

authorstring nullable

The name every tracked change and new comment carries, when the user wants one other than their own; at most 255 characters, one line. Omitted, it is the signed-in user's own name (Version Story AI for an API key, which acts as its organization's service account).

datestring nullable

ISO 8601 date and time on every tracked change; defaults to the time of the request.

waitboolean

Hold the response until the job finishes (up to 5 s).

inlineboolean

With wait: return the files' bytes in the body.

outputsstring[] nullable

With wait: the formats of both files, docx (the default), pdf, md, json or html.

descriptionstring nullable

What the edits change, in one plain line, such as "Extend the termination notice to 60 days". It is kept with the version the edit becomes and shown in the Version Story app.

new_versionboolean

True when the user asks for a new version or a separate draft: 'create a version', 'up version', 'save as', or a draft for someone else, such as a template filled in for a customer. Otherwise an edit of the draft your own edits made amends that version, so one version holds all of the user's changes for the same piece of work.

amendboolean

True to put the change in that version and every version after it.

style_template_file_idstring nullable

A Word file whose styles and numbering are imported before the first edit: the file_id of a .docx (or .doc) you uploaded, such as the template whose look the document should take. Styles of the same name are replaced by the template's, so paragraphs in them take its fonts, spacing and numbering; set_paragraph_style then gives other paragraphs its styles. Its text, page layout, headers and footers are not copied.

version_namestring nullable

The version's name: the user's name for its file.

Response

Successful Response

OR

Changes

No recorded changes to this operation across all 1 revision of this API.