Update collaboration

put
https://api.box.com/2.0
/collaborations/:collaboration_id

Updates a collaboration.

Can be used to change the owner of an item, or to accept collaboration invites.

Request

application/json

Path Parameters

stringin pathrequired
1234

The ID of the collaboration

Query Parameters

string arrayin queryoptional
id,type,name

A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.

Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.

Request Body

string / date-timein bodyoptional
2019-08-29T23:59:00-07:00

Set the expiration date for the collaboration. At this date, the collaboration will be automatically removed from the item.

stringin bodyoptional
editor

The level of access granted.

Value is one of "editor", "viewer", "previewer", "uploader", "previewer uploader", "viewer uploader", "co-owner"

stringin bodyoptional
accepted

Set the status of a pending collaboration invitation, effectively accepting, or rejecting the invite.

Value is one of "pending", "accepted", "rejected"

Response

application/jsonCollaboration

Returns an updated collaboration object unless the owner has changed.

application/jsonCollaboration

If the role is changed to owner, the collaboration is deleted and a new collaboration is created. The previous owner of the old collaboration will be a co-owner on the new collaboration.

You can now try out some of our APIs live, right here in the documentation.
Log In

Request Example

cURL
curl -X PUT https://api.box.com/2.0/collaborations/1234 \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "role": "viewer"
     }'
.NET
BoxCollaborationRequest requestParams = new BoxCollaborationRequest()
{
    Id = "12345",
    Role = "viewer"
};
BoxCollaboration collab = await client.CollaborationsManager.EditCollaborationAsync(requestParams);
Java
// Accept all pending collaborations
Collection<BoxCollaboration.Info> pendingCollaborations = BoxCollaboration.getPendingCollaborations(api);
for (BoxCollaboration.Info collabInfo : pendingCollaborations) {
    collabInfo.setStatus(BoxCollaboration.Status.ACCEPTED);
    collabInfo.getResource().updateInfo(collabInfo);
}
Python
accepted_collab = client.collaboration(collab_id='12345').accept()

rejected_collab = client.collaboration(collab_id='98765').reject()
Node
var collaborationID = '22222';
client.collaborations.respondToPending(collaborationID, 'accepted')
	.then(collaboration => {
		/* collaboration -> {
			type: 'collaboration',
			id: '22222',
			created_by: {
				type: 'user',
				id: '11111',
				name: 'Example User',
				login: 'user@example.com'
			},
			created_at: '2012-12-12T10:54:37-08:00',
			modified_at: '2012-12-12T11:30:43-08:00',
			expires_at: null,
			status: 'accepted',
			accessible_by: {
				type: 'user',
				id: '33333',,
				name: 'Collaborator User',
				login: 'collaborator@example.com'
			},
			role: 'editor',
			acknowledged_at: '2012-12-12T11:30:43-08:00',
			item: {
				type: 'folder',
				id: '12345',
				sequence_id: '0',
				etag: '0',
				name: 'Shared Pictures'
			}
		}
		*/
	});

Response Example

{
  "id": 11446498,
  "type": "collaboration",
  "item": {
    "id": 11446498,
    "type": "file",
    "sequence_id": 3,
    "etag": 1,
    "name": "Pictures"
  },
  "accessible_by": {
    "id": 11446498,
    "type": "user",
    "name": "Aaron Levie",
    "login": "ceo@example.com"
  },
  "invite_email": "john@example.com",
  "role": "editor",
  "expires_at": "2012-12-12T10:53:43-08:00",
  "status": "accepted",
  "acknowledged_at": "2012-12-12T10:53:43-08:00",
  "created_by": {
    "id": 11446498,
    "type": "user",
    "name": "Aaron Levie",
    "login": "ceo@example.com"
  },
  "created_at": "2012-12-12T10:53:43-08:00",
  "modified_at": "2012-12-12T10:53:43-08:00",
  "acceptance_requirements_status": {
    "terms_of_service_requirement": {
      "is_accepted": true,
      "terms_of_service": {
        "id": 11446498,
        "type": "terms_of_service"
      }
    },
    "strong_password_requirement": {
      "enterprise_has_strong_password_required_for_external_users": true,
      "user_has_strong_password": true
    },
    "two_factor_authentication_requirement": {
      "enterprise_has_two_factor_auth_enabled": true,
      "user_has_two_factor_authentication_enabled": true
    }
  }
}