Create Multiple Document Relationships
Create new relationships on multiple documents.
- 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 1000.
You cannot create or delete standard relationship types. Examples of standard relationship types include Based On and Original Source. Learn about document relationships in Vault Help
POST
/api/{version}/objects/documents/relationships/batchHeaders
Section link for Headers| Name | Description |
|---|---|
Content-Type | application/json or text/csv |
Accept | application/json (default) or text/csv |
Body Parameters
Section link for Body ParametersCreate a JSON or CSV input file. There are multiple ways to create document relationships. The following standard fields are required to create document relationships.
| Name | Description |
|---|---|
source_doc_id__v | Document id value of the document on which the relationship is being created. |
target_doc_id__v | Document id value of the document which is being associated with the source document as a related document. |
relationship_type__v | The type of relationship the target document will have with the source document. |
Create Source Version-Specific Relationships
Section link for Create Source Version-Specific RelationshipsThe following fields are required when creating a source version-specific relationship.
| Name | Description |
|---|---|
source_major_version__v | The major version number of the source document. |
source_minor_version__v | The minor version number of the source document. |
relationship_type__v | The type of relationship the target document will have with the source document. |
Create Target Version-Specific Relationships
Section link for Create Target Version-Specific RelationshipsThe following fields are required when creating a target version-specific relationship.
| Name | Description |
|---|---|
target_major_version__v | The major version number of the target document to which the source document will be bound. |
target_minor_version__v | The minor version number of the target document to which the source document will be bound. |
relationship_type__v | The type of relationship the target document will have with the source document. |
Query Parameters
Section link for Query Parameters| Name | Description |
|---|---|
idParam | To create relationships based on an external id field, set to external_id__v. You must set Content-Type to text/csv and include an external_id__v column. |
Request
Section link for Requestcurl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: text/csv" \
-H "Accept: text/csv" \
--data-binary @"C:\Vault\Document Relationships\document_relationships.csv" \
https://myvault.veevavault.com/api/v20.1/objects/documents/relationships/batchResponse
Section link for Response{
"responseStatus": "SUCCESS",
"data": [
{
"responseStatus": "SUCCESS",
"id": 10
},
{
"responseStatus": "SUCCESS",
"id": 11
},
]
}Response Details
Section link for Response DetailsOn SUCCESS, Vault returns the IDs of the newly created document relationships.