Skip to content

Create Single Document Relationship

Create a new relationship on a document.

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/{document_id}/versions/{major_version_number__v}/{minor_version_number__v}/relationships
NameDescription
Content-Typeapplication/x-www-form-urlencoded
Acceptapplication/json (default) or application/xml
X-VaultAPI-MigrationModeWhen set to true, creates a document relationship in migration mode. This allows developers to assign an inactive relationship type. You must have the Document Migration permission to use this header. Learn more about Document Migration Mode.
NameDescription
{document_id}The document id field value.
{major_version_number__v}The document major_version_number__v field value.
{minor_version_number__v}The document minor_version_number__v field value.
Field NameDescription
target_doc_id__v
required
The document id of the target document.
relationship_type__v
required
The relationship type retrieved from the Document Relationships Metadata call above.
target_major_version__v
conditional
The major version number of the target document to which the source document will be bound. Required for target version-specific relationships.
target_minor_version__v
conditional
The minor version number of the target document to which the source document will be bound. Required for target version-specific relationships.
curl -X POST -H "Authorization: {AUTH_VALUE}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "target_doc_id__v=548" \
-d "relationship_type__v=supporting_documents__vs" \
-d "target_major_version__v=0" \
-d "target_minor_version__v=2" \
https://myvault.veevavault.com/api/v26.3/objects/documents/548/versions/0/1/relationships
{
    "responseStatus": "SUCCESS",
    "responseMessage": "Document relationship successfully created.",
    "id": 200
}

On SUCCESS, Vault returns the ID of the newly created document relationship.