Instead of creating each task with a separate API call, you can submit multiple tasks in a single request (a "batch"). The body of the request should contain an array of objects with the data for each task. For more details on the format of that task data, see the task creation endpoint.
Once accepted, tasks will be created asynchronously in the background. If your project is set up with a task creation callback, the result of each task creation (whether successful or failed) will be sent to that callback.
Optionally, the body can also contain a notification_email field to be notified when task creation finishes (whether successfully or not)
You can use the batch task creation status endpoint to track the status of each task as it is created and the task status endpoint to track the status of each task as it is being worked on.
If you would like to view newly created tasks, find their task IDs using one of the methods described above and navigate to the read-only workspace at the following URL, replacing the relevant values for project_id
and task_id
: https://app.sama.com/projects/{project_id}/tasks/{task_id}
.
There is a limit of 1,000 tasks that can be created in a single batch, please use multiple consecutive batches if you want to create more tasks.
Optional priority
parameter where tasks with lower priority values will be worked on first, and the default is 0. Range of value is between -2147483648 and 2147483647.
Optional reserve_for
parameter reserves the task to the specified agent id.
Optional submit
parameter if set to true
, the task will be submitted after creation using the default answers provided. Please see submit a task for more information.
Optional duration
parameter is used in conjunction with the submit
parameter. Please see submit a task for more information.
Optional tasks_file_name
parameter sets the file name of the upload instead of using the default, which is 'from_api' for API batch task creation.
If you do not pass a tasks
parameter with the tasks you want to create then the batch is created in a waiting state. The reponse will have a tasks_put_url
presigned S3 URL that you should send a PUT
request with the array of tasks to create within 4 hours. After uploading the tasks file, use the create a batch of tasks from an uploaded file endpoint to proceed with task creation.