Create Multiple Documents
This endpoint allows you to create multiple documents at once with a CSV input file.
- The maximum CSV input file size is 1GB.
- The values in the input must be UTF-8 encoded.
- CSVs must follow the standard RFC 4180 format, with some exceptions.
- The maximum batch size is 500.
Note that this API does not support adding multi-value relationship fields by name. To add multi-value fields, you must first retrieve the ID values and add them to the relationship field.
The API supports all security settings except document lifecycle role defaults. You must create documents through the UI if your documents require document lifecycle role defaults. Learn more about document lifecycle role defaults in Vault Help
/api/{version}/objects/documents/batchHeaders
Section link for Headers| Name | Description |
|---|---|
Content-Type | text/csv |
Accept | application/json (default) or text/csv |
X-VaultAPI-MigrationMode | When set to true, Vault relaxes field validation to support document migration. You must have the Document Migration permission to use this header. Learn more about Document Migration Mode. |
X-VaultAPI-NoTriggers | If set to true and Document Migration Mode |
About Document Migration Mode
Section link for About Document Migration ModeWith the X-VaultAPI-MigrationMode header, Vault relaxes field validation to support document migration.
When this header is set to true, Vault:
- Does not enforce requiredness validation on document fields.
- Does not enforce Dynamic Reference Constraint (DRC) validation.
- Bypasses entry criteria, entry actions, and event actions.
- Does not send notifications.
Additionally, developers can:
- Create documents in any lifecycle state, including inactive states, using the
status__vfield. - Assign an inactive document type, subtype, classification, or lifecycle.
- Manually set the name, document number, and version number.
- Set lookup field values directly. Vault recalculates a lookup field only when you update one of its source fields.
- Set
created_by__vanddocument_creation_date__v.
You must have the Vault Owner Actions: Document Migration permission to use this header. Learn more about Document Migration Mode
Body Parameters
Section link for Body ParametersPrepare a CSV input file. There are multiple ways to create documents in bulk. The following shows the required standard fields needed to create documents, but an Admin may set other standard or custom document fields as required in your Vault. To find which fields are required, retrieve document fields. You can also optionally include any editable document field.
Object reference fields support object reference notation, which lets you specify a related object record by a unique field value instead of by record ID.
Create Documents from Uploaded Files
Section link for Create Documents from Uploaded FilesYou must first upload the document source files to your Vault's file staging.
| Name | Description |
|---|---|
fileconditional | The filepath of the source document. The maximum allowed file size is 500GB. Only required when creating a document from an uploaded file. |
name__vrequired | The name of the new document. |
type__vrequired | The name or label of the document type to assign to the new document. |
subtype__voptional | The name or label of the document subtype (if one exists on the document type). |
classification__voptional | The name or label of the document classification (if one exists on the document subtype). |
lifecycle__vrequired | The name or label of the document lifecycle to assign to the new document. |
major_version_number__voptional | The major version number to assign to the new document |
minor_version_number__voptional | The minor version number to assign to the new document. |
suppressRenditionoptional | Set to true to suppress generation of viewable renditions. The default is false. |
product__voptional | Example: This is an example object reference field. To assign value for this field type, include either the document field name product__v or the document field name plus the name field on the object product__v.name__v. |
Create Documents from Templates
Section link for Create Documents from TemplatesWhen you create a new document from a template, Vault copies the template file in your Vault and uses that copy as the source file for the new document.
| Name | Description |
|---|---|
fromTemplateconditional | The template to apply to the document. Only required when creating a document from a template. |
name__vrequired | The name of the new document. |
type__vrequired | The name or label of the document type to assign to the new document. |
subtype__voptional | The name or label of the document subtype (if one exists on the document type). |
classification__voptional | The name or label of the document classification (if one exists on the document subtype). |
lifecycle__vrequired | The name or label of the document lifecycle to assign to the new document. |
major_version_number__voptional | The major version number to assign to the new document |
minor_version_number__voptional | The minor version number to assign to the new document. |
product__voptional | Example: This is an example object reference field. To assign value for this field type, include either the document field name product__v or the document field name plus the name field on the object product__v.name__v. |
Create Content Placeholder Documents
Section link for Create Content Placeholder DocumentsVault allows you to create content placeholders when the associated file is not yet available. You can add the source document at a later date.
| Name | Description |
|---|---|
filerequired | Include this column in your input, but leave the values blank. |
name__vrequired | The name of the new document. |
type__vrequired | The name or label of the document type to assign to the new document. |
subtype__voptional | The name or label of the document subtype (if one exists on the document type). |
classification__voptional | The name or label of the document classification (if one exists on the document subtype). |
lifecycle__vrequired | The name or label of the document lifecycle to assign to the new document. |
major_version_number__voptional | The major version number to assign to the new document |
minor_version_number__voptional | The minor version number to assign to the new document. |
Create Unclassified Documents
Section link for Create Unclassified DocumentsUnclassified documents are documents which have a source file, but no document type. The following fields are required, but you can include any editable document field.
| Name | Description |
|---|---|
filerequired | The filepath of the source document. The maximum allowed file size is 500GB. |
name__voptional | The name of the new document. |
type__vrequired | Set the document type to Unclassified or Undefined (undefined__v).* |
lifecycle__vrequired | Set the document lifecycle to Inbox or Unclassified (unclassified__v).* |
* Prior to 21R1.3 (API v21.2), the Unclassified (undefined__v) document type and Inbox (unclassified__v) lifecycle were known as the Undefined document type and Unclassified lifecycle. Relabeling the Undefined document type and Unclassified lifecycle may impact the functionality of custom integrations that use the old labels. Check your integrations before updating this label. We recommend that customers experiencing errors change the labels back to their original values until this issue is resolved.
Request
Section link for Requestcurl -X POST -H "Authorization: {AUTH_VALUE}" \
-H "Content-Type: text/csv" \
-H "Accept: text/csv" \
--data-binary @"filename" \
https://myvault.veevavault.com/api/v26.3/objects/documents/batchResponse
Section link for Response{
"responseStatus": "SUCCESS",
"data": [
{
"responseStatus": "SUCCESS",
"id": 771,
"external_id__v": "ALT-DOC-0771"
},
{
"responseStatus": "SUCCESS",
"id": 772,
"external_id__v": "CHO-DOC-0772"
},
{
"responseStatus": "SUCCESS",
"id": 773,
"external_id__v": "GLU-DOC-0773"
},
{
"responseStatus": "FAILURE",
"errors": [
{
"type": "INVALID_DATA",
"message": "Error message describing why this document was not created."
}
]
}
]
}Response Details
Section link for Response DetailsOn SUCCESS, the documents are created and assigned a system-managed document id field value. The generated document id may not be in sequential order.