Skip to content

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/batch
NameDescription
Content-Typeapplication/json or text/csv
Acceptapplication/json (default) or text/csv or application/xml

Prepare a CSV or JSON input file.

NameDescription
document_id__vThe document ID to add this attachment.
filename__vThe 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.
fileThe 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.
Download Input File
curl -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/v21.1/objects/documents/attachments/batch
{ "responseStatus": "SUCCESS", "data": [ { "responseStatus": "SUCCESS", "id": 39, "version": 1 } ] }

On SUCCESS, returns the ID and version of new attachments. Attachments created unsuccessfully are reported with an error message.