Create Multiple Document Attachments
Create multiple document attachments in bulk with a JSON or CSV input file. You must first load the attachments to the file staging server. This works for version-specific attachments and attachments at the document level. If the attachment already exists, Vault uploads the attachment as a new version of the existing attachment. Learn more about attachment versioning in Vault Help
- The maximum 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.
POST
/api/{version}/objects/documents/attachments/batchHeaders
Section link for Headers| Name | Description |
|---|---|
Content-Type | application/json or text/csv |
Accept | application/json (default) or text/csv or application/xml |
Body Parameters
Section link for Body ParametersPrepare a CSV or JSON input file.
| Name | Description |
|---|---|
document_id__vrequired | The document ID to add this attachment. |
filename__vrequired | The name for the new attachment. This name must include the file extension, for example, MyAttachment.pdf. If an attachment with this name already exists, this attachment is added as a new version. |
filerequired | The filepath of the attachment on the file staging server. |
description__voptional | Description of the attachment. Maximum 1000 characters. |
major_version_number__voptional | The major version of the source document. |
minor_version_number__voptional | The minor version of the source document. |
external_id__voptional | Set an external ID value on the attachment. |
Request
Section link for Requestcurl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: text/csv" \
-H "Accept: text/csv" \
--data-binary @"C:\Vault\Documents\create_attachments.csv" \
https://myvault.veevavault.com/api/v24.1/objects/documents/attachments/batchResponse
Section link for Response{
"responseStatus": "SUCCESS",
"data": [
{
"responseStatus": "SUCCESS",
"id": 39,
"version": 1
}
]
}Response Details
Section link for Response DetailsOn SUCCESS, returns the ID and version of new attachments. Attachments created unsuccessfully are reported with an error message.