Assign task

post
https://api.box.com/2.0
/task_assignments

Assigns a task to a user.

Multiple assignments to different users are allowed per task.

Request

application/json

Request Body

objectin body

The user to assign the task to.

stringin bodyoptional
3242343

The ID of the user to assign to the task.

To specify a user by their email address use the login parameter.

stringin bodyoptional
john@example.com

The email address of the user to assign to the task. To specify a user by their user ID please use the id parameter.

objectin body

The task to assign to a user.

stringin bodyrequired
11446498

The ID of the task

stringin bodyrequired
task

Value is always "task"

Response

application/jsonTask Assignment

Returns a new task assignment object.

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

Request Example

cURL
curl -X POST https://api.box.com/2.0/task_assignments \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "task": {
         "id": "11446498",
         "type": "task"
       },
       "assign_to": {
         "id": "4823213"
       }
     }'
.NET
// Assign task 11111 to user 22222
var assignmentParams = new BoxTaskAssignmentRequest()
{
    Task = new BoxTaskRequest()
    {
        Id = "11111"
    },
    AssignTo = new BoxAssignmentRequest()
    {
        Id = "22222"
    }
};
BoxTaskAssignment assignment = await client.TasksManager.CreateTaskAssignmentAsync(assignmentParams);
Java
BoxUser user = new BoxUser(api, "user-id")
BoxTask task = new BoxTask(api, "id");
task.addAssignment(user);
Python
user = client.user(user_id='11111')
assignment = client.task(task_id='12345').assign(user)
print('Assignment ID is {0} and is assigned to user {1}'.format(assignment.id, assignment.assigned_to.name))
Node
// Assign task 11111 to user 22222
var taskID = '11111';
var userID = '22222';
client.tasks.assignByUserID(taskID, userID)
	.then(assignment => {
		/* assignment -> {
			type: 'task_assignment',
			id: '12345',
			item: 
			{ type: 'file',
				id: '33333',
				sequence_id: '0',
				etag: '0',
				sha1: '7840095ee096ee8297676a138d4e316eabb3ec96',
				name: 'script.js' },
			assigned_to: 
			{ type: 'user',
				id: '22222',
				name: 'Sample Assignee',
				login: 'assignee@exmaple.com' },
			message: null,
			completed_at: null,
			assigned_at: '2013-05-10T11:43:41-07:00',
			reminded_at: null,
			resolution_state: 'incomplete',
			assigned_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' } }
		*/
	});

Response Example

{
  "id": 11446498,
  "type": "task_assignment",
  "item": {
    "id": 12345,
    "etag": 1,
    "type": "file",
    "sequence_id": 3,
    "name": "Contract.pdf"
  },
  "assigned_to": {
    "id": 11446498,
    "type": "user",
    "name": "Aaron Levie",
    "login": "ceo@example.com"
  },
  "message": "Please review",
  "completed_at": "2012-12-12T10:53:43-08:00",
  "assigned_at": "2012-12-12T10:53:43-08:00",
  "reminded_at": "2012-12-12T10:53:43-08:00",
  "resolution_state": "incomplete",
  "assigned_by": {
    "id": 11446498,
    "type": "user",
    "name": "Aaron Levie",
    "login": "ceo@example.com"
  }
}