Skip to content

Assign Users & Groups to Roles on a Single Document

Assign users and groups to roles on a single document.

POST/api/{version}/objects/documents/{doc_id}/roles
NameDescription
Content-Typeapplication/x-www-form-urlencoded
Acceptapplication/json (default) or application/xml
NameDescription
{doc_id}The document id field value.
NameDescription
{role__v}.users
optional
A string of comma-separated user id values for the new role. For example, reviewer__v.users = "3003, 4005".
{role__v}.groups
optional
A string of comma-separated group id values for the new group. For example, reviewer__v.groups = "20, 21".
curl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "consumer__v.users=35565,35571" \
-d "approver__v.users-45585,45594" \
https://myvault.veevavault.com/api/v25.3/objects/documents/245/roles
{
  "responseStatus": "SUCCESS",
  "responseMessage": "Document roles updated",
  "updatedRoles": {
    "consumer__v": {
      "users": [
        19376,18234,19456
      ]
    },
    "legal__c": {
      "groups": [
        19365,18923
      ]
    }
  }
}

The response includes IDs of the users and groups successfully assigned to each role on the document.