---
title: "Create Version"
method: POST
path: "/v1/documents/{document_id}/versions"
tags: ["documents"]
---

# Create Version

`POST /v1/documents/{document_id}/versions`

## 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/documents/{document_id}/versions`
- Auth: HTTP bearer

Record a file as a new version of a document, following its latest version or the version named by
parent, with a redline of what changed.

Send the file's bytes as multipart/form-data in the file field, or name a file you uploaded (or an edit's
files.clean) by file_id, which the version takes as it is; parent, when given, as a form field holding its JSON. A
JSON body names the file the same way: {"file_id", "parent"?, "author_name"?, "description"?}. Each upload is a new
version; a file named by file_id becomes a version once, and naming it again is 409 CONFLICT. An edit's files.clean
can be named while the edit is still being applied: the version's redline is made once the edit is.

## Path parameters

- `document_id` string, required: The Document's document_id, a UUID.

## Headers

- `X-Customer-Id` string, 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

- VersionFromFileRequest: POST /v1/documents/{document_id}/versions's JSON body: a version that is a file you hold.
  - `file_id` string, required: A file you uploaded (POST /v1/files) or an edit's files.clean: the version is that file as it is, not a copy, so the paragraph ids read from it carry over.
  - `parent` VersionLocator: A version: {"version_id": version_id}, or a version reference as a response gave it.
    - `version_id` string, required: The version's id, or "latest" for the newest.
    - `document_id` string, nullable: A reference's; must be the request's Document.
    - `index` integer, nullable: Ignored.
    - `label` string, nullable: Ignored.
  - `author_name` string, nullable: Who the redline attributes this version's changes to. Defaults to the acting identity, which for an API key is its organization's service account.
  - `description` string, nullable: What changed in this version, shown with it in the app and returned as description.

## Response `202`

Successful Response

- Version: A version of a Document: the document as of that version (files.clean) and its redline against the version before it (files.comparison), with what the Document records about it.
  - `document_id` string, required: The Document the version belongs to.
  - `version_id` string, required: The version's id.
  - `index` integer, required: The version's position among its Document's versions in the order they were made, counted from 0: the first version, v1, is index 0. It shows the order and names nothing: deleting a version moves the ones after it down, so a request names a version by its version_id.
  - `label` string, required: The app's label for the version, such as v2, or v2(a) for one of competing drafts, which the user names it by. It comes from the version graph, so a sibling added later can relabel it.
  - `name` string, required: The version's name, which the app shows: its own once renamed, else its file's.
  - `files` Files, required: A document's files, as an edit and a version carry them: its clean document and its redline.
    - `clean` FileResource, required: A file: GET /v1/files/{file_id} answers with it, and every response that carries a document embeds it. It never carries version fields: a version holds its file.
      - `file_id` string, required
      - `file_name` string, required
      - `status` 'processing' | 'ready' | 'failed', required: The state of the formats this request asked for: processing while one is still being produced (poll again after Retry-After), ready when every one is in downloads, failed when the document cannot be used (error) or a requested format will never be produced.
      - `downloads` FormatDownload[], nullable: One per requested format that is ready.
        - `format` string, required
        - `url` string, required: Signed; it expires at expires_at.
        - `file_name` string, required
        - `expires_at` string, required: ISO 8601 in UTC, to the second: 2026-10-21T18:22:31Z.
        - `metadata_report` MetadataReport: What a clean found in one download and did to each kind of hidden data.
          - `format` string, required: docx, xlsx, pptx, pdf or zip.
          - `preset` string, required: standard or strict.
          - `items` MetadataReportItem[], required
            - `type` string, required: The kind of hidden data, such as author, tracked_changes or hidden_text.
            - `category` string, required: properties, review, hidden, automation, package or visible.
            - `count` integer, required: How many were found.
            - `action` string, required: What was done: remove, reset, accept, reject, anonymize, convert, unlink, apply, flatten or clean; keep or report when it was left in place.
            - `examples` string[]: A few of the values found, when they are names.
          - `warnings` MetadataReportWarning[], required
            - `type` string, required: The kind of hidden data the warning is about.
            - `message` string, required: What the reader should know before sending the document.
          - `files` integer, nullable: For a zip, how many documents inside it were cleaned.
        - `content_base64` string, nullable: Only in an edit's or a creation's files, with inline=true: the file's bytes, base64-encoded.
      - `pending_formats` string[], nullable: Requested formats still being produced.
      - `failed_formats` string[], nullable: Requested formats that will never be produced.
      - `error` ComparisonErrorDescriptor
        - `code` string, required
        - `upstream_code` string, nullable
    - `comparison` FileResource: A file: GET /v1/files/{file_id} answers with it, and every response that carries a document embeds it. It never carries version fields: a version holds its file.
      - `file_id` string, required
      - `file_name` string, required
      - `status` 'processing' | 'ready' | 'failed', required: The state of the formats this request asked for: processing while one is still being produced (poll again after Retry-After), ready when every one is in downloads, failed when the document cannot be used (error) or a requested format will never be produced.
      - `downloads` FormatDownload[], nullable: One per requested format that is ready.
        - `format` string, required
        - `url` string, required: Signed; it expires at expires_at.
        - `file_name` string, required
        - `expires_at` string, required: ISO 8601 in UTC, to the second: 2026-10-21T18:22:31Z.
        - `metadata_report` MetadataReport: What a clean found in one download and did to each kind of hidden data.
          - `format` string, required: docx, xlsx, pptx, pdf or zip.
          - `preset` string, required: standard or strict.
          - `items` MetadataReportItem[], required
            - `type` string, required: The kind of hidden data, such as author, tracked_changes or hidden_text.
            - `category` string, required: properties, review, hidden, automation, package or visible.
            - `count` integer, required: How many were found.
            - `action` string, required: What was done: remove, reset, accept, reject, anonymize, convert, unlink, apply, flatten or clean; keep or report when it was left in place.
            - `examples` string[]: A few of the values found, when they are names.
          - `warnings` MetadataReportWarning[], required
            - `type` string, required: The kind of hidden data the warning is about.
            - `message` string, required: What the reader should know before sending the document.
          - `files` integer, nullable: For a zip, how many documents inside it were cleaned.
        - `content_base64` string, nullable: Only in an edit's or a creation's files, with inline=true: the file's bytes, base64-encoded.
      - `pending_formats` string[], nullable: Requested formats still being produced.
      - `failed_formats` string[], nullable: Requested formats that will never be produced.
      - `error` ComparisonErrorDescriptor
        - `code` string, required
        - `upstream_code` string, nullable
  - `parents` VersionReference[]: The versions it was made from: one, or each version a merge combined, primary first.
    - `document_id` string, required: The Document the version belongs to.
    - `version_id` string, required: The version's id.
    - `index` integer, required: The version's position among its Document's versions in the order they were made, counted from 0: the first version, v1, is index 0. It shows the order and names nothing: deleting a version moves the ones after it down, so a request names a version by its version_id.
    - `label` string, required: The app's label for the version, such as v2, or v2(a) for one of competing drafts, which the user names it by. It comes from the version graph, so a sibling added later can relabel it.
  - `author` string, nullable: Who its changes are attributed to: an edit's author, an upload's author_name.
  - `description` string, nullable: What changed: an edit's description, an upload's description.
  - `created_at` string, required: When the version was made: ISO 8601 in UTC, to the second: 2026-10-21T18:22:31Z.
  - `metadata` object: Your own string values by key, stored and returned as they were sent.

## Other responses

- `400`: The request is invalid: INVALID_REQUEST when a parameter or the body fails validation, otherwise the code of the operation's own refusal.

---

[API](https://skmtc.dev/versionstory/apis/version-story-public-api.md) - [All operations](https://skmtc.dev/versionstory/apis/version-story-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/versionstory/apis/version-story-public-api/revisions/994ce15faf32?raw)
