---
title: "Adds a collection of Tasks to the specified Job."
method: POST
path: "/jobs/{jobId}/addtaskcollection"
tags: ["Tasks"]
---

# Adds a collection of Tasks to the specified Job.

`POST /jobs/{jobId}/addtaskcollection`

Note that each Task must have a unique ID. The Batch service may not return the
results for each Task in the same order the Tasks were submitted in this
request. If the server times out or the connection is closed during the
request, the request may have been partially or fully processed, or not at all.
In such cases, the user should re-issue the request. Note that it is up to the
user to correctly handle failures when re-issuing a request. For example, you
should use the same Task IDs during a retry so that if the prior operation
succeeded, the retry will not create extra Tasks unexpectedly. If the response
contains any Tasks which failed to add, a client can retry the request. In a
retry, it is most efficient to resubmit only Tasks that failed to add, and to
omit Tasks that were successfully added on the first attempt. The maximum
lifetime of a Task from addition to completion is 180 days. If a Task has not
completed within 180 days of being added it will be terminated by the Batch
service and left in whatever state it was in at that time.

## Path parameters

- `jobId` string, required

## Query parameters

- `api-version` string, required
- `timeOut` integer

## Headers

- `client-request-id` string
- `return-client-request-id` boolean
- `ocp-date` string, date-time-rfc7231

## Response `200`

The request has succeeded.

- BatchCreateTaskCollectionResult — The result of creating a collection of Tasks to a Job.
  - `value` BatchTaskCreateResult[] — The results of the create Task collection operation.
    - `status` 'success' | 'clienterror' | 'servererror', required — BatchTaskAddStatus enums
    - `taskId` string, required — The ID of the Task for which this is the result.
    - `eTag` string — The ETag (or entity tag) HTTP response header is an identifier for a specific version of a resource. It lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content was not changed. It is a string of ASCII characters placed between double quotes, like "675af34563dc-tr34".
    - `lastModified` string, date-time — The last modified time of the Task.
    - `location` string — The URL of the Task, if the Task was successfully added.
    - `error` BatchError — An error response received from the Azure Batch service.
      - `code` string — An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
      - `message` BatchErrorMessage — An error message received in an Azure Batch error response.
        - `lang` string — The language code of the error message.
        - `value` string — The text of the message.
      - `values` BatchErrorDetail[] — A collection of key-value pairs containing additional details about the error.
        - `key` string — An identifier specifying the meaning of the Value property.
        - `value` string — The additional information included with the error response.

## Other responses

- `default` — An unexpected error response.

---

[API](https://skmtc.net/azure/apis/batch-batch.md) · [All operations](https://skmtc.net/azure/apis/batch-batch/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/azure/batch-batch/revisions/8427acd8fd77/schema)
