Create Single Document Version
Add a new draft version of an existing document. You can choose to either use the existing source file or a new source file. These actions increase the target document’s minor version number. This is analogous to using the Create Draft action in the UI.
Not all documents are eligible for draft creation, however, this endpoint does support creating a new draft version of a checked-out document. See below for details. Learn more about creating new draft versions in Vault Help
/api/{version}/objects/documents/{doc_id}Headers
Section link for Headers| Name | Description |
|---|---|
Content-Type | multipart/form-data |
Accept | application/json (default) or application/xml |
URI Path Parameters
Section link for URI Path Parameters| Name | Description |
|---|---|
{doc_id} | The document id field value. |
Body Parameters
Section link for Body Parameters| Name | Description |
|---|---|
createDraftconditional | Choose one of the two available values:latestContent: Create a new draft version from the existing document in the Vault. This does not require uploading a file. This option is only available if both the source file and rendition are each 4 GB or less. This is analogous to the Copy file from current version option in the Create Draft UI.uploadedContent: Create a new draft version by uploading the document source file. This requires uploading a new source file with an additional file body parameter. The maximum allowed file size is 4GB. This is analogous to the Upload a new file option in the Create Draft UI.This parameter is only required to create a new draft version from an existing document or by uploading a source file. To create a new version for a placeholder document, you must omit this parameter. |
fileconditional | The filepath of the source document. This parameter is only required in the following scenarios:
|
description__voptional | Add a Version Description for the new draft version. Other users may view this description in the document’s Version History. Maximum 1,500 characters. |
Query Parameters
Section link for Query Parameters| Name | Description |
|---|---|
suppressRendition | Set to true to suppress automatic generation of the viewable rendition. If omitted, defaults to false. |
Upload New Version
Section link for Upload New VersionWhen Enable Upload New Version is enabled by an Admin, you can upload a new version of a checked out document if you already have an updated version of the document source file available. This is analogous to using the Upload New Version action in the UI. To achieve this, omit the createDraft parameter and include the file parameter when sending a request to this endpoint. If the document has not yet been checked out in the UI, you can send a request to Create Document Lock to check it out. Learn more about versioning documents in Vault Help
Request: Copy file from current version
Section link for Request: Copy file from current versioncurl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: multipart/form-data" \
-F "createDraft=latestContent" \
https://myvault.veevavault.com/api/v26.1/objects/documents/534Request: Upload a new file & Suppress rendition
Section link for Request: Upload a new file & Suppress renditioncurl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: multipart/form-data" \
-F "file=CholeCap-Presentation.pptx" \
-F "createDraft=uploadedContent" \
https://myvault.veevavault.com/api/v26.1/objects/documents/534?suppressRendition=trueResponse
Section link for Response{
"responseStatus": "SUCCESS",
"responseMessage": "New draft successfully created.",
"major_version_number__v": 0,
"minor_version_number__v": 2
}Request: Upload new version
Section link for Request: Upload new versioncurl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: multipart/form-data" \
-F "file=CholeCap-Presentation.pptx" \
https://myvault.veevavault.com/api/v26.1/objects/documents/534Response: Upload new version
Section link for Response: Upload new version{
"responseStatus": "SUCCESS",
"responseMessage": "Document successfully checked in.",
"major_version_number__v": 0,
"minor_version_number__v": 5
}Response Details
Section link for Response DetailsOn SUCCESS, Vault creates a new draft version and the response includes the document's major_version_number__v and minor_version_number__v. When you create a new draft version, Vault automatically increments the minor version number.
When uploading a new version of a checked out document, on SUCCESS, Vault checks in the document and creates a new draft version. The response includes the document’s major_version_number__v and minor_version_number__v.