# Setup a Batch POST https://api.prolific.com/api/v1/data-collection/batches/{batch_id}/setup Content-Type: application/json The setup process creates all of the **tasks** within the batch according to your configuration. Each datapoint in the dataset is paired with all instructions to create a task. Tasks are then organized into task groups. The dataset must be in a **READY** status before the setup process can be initiated. The dataset can be attached either at batch creation time or via the `dataset_id` parameter in this request. Upon successful invocation, the setup process will begin asynchronously, and the batch will be set to a **PROCESSING** status. To retrieve the status of the setup, call the `GET /api/v1/data-collection/batches/{batch_id}/status` endpoint. The setup is complete once the batch status changes to **READY**. Reference: https://beta-docs.prolific.com/api-reference/ai-task-builder/setup-task-builder-batch ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Setup a Batch version: endpoint_aiTaskBuilder.SetupTaskBuilderBatch paths: /api/v1/data-collection/batches/{batch_id}/setup: post: operationId: setup-task-builder-batch summary: Setup a Batch description: >- The setup process creates all of the **tasks** within the batch according to your configuration. Each datapoint in the dataset is paired with all instructions to create a task. Tasks are then organized into task groups. The dataset must be in a **READY** status before the setup process can be initiated. The dataset can be attached either at batch creation time or via the `dataset_id` parameter in this request. Upon successful invocation, the setup process will begin asynchronously, and the batch will be set to a **PROCESSING** status. To retrieve the status of the setup, call the `GET /api/v1/data-collection/batches/{batch_id}/status` endpoint. The setup is complete once the batch status changes to **READY**. tags: - - subpackage_aiTaskBuilder parameters: - name: batch_id in: path description: The unique identifier of the AI Task Builder batch required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '202': description: Accepted content: application/json: schema: $ref: >- #/components/schemas/AI Task Builder_SetupTaskBuilderBatch_Response_202 '400': description: Error content: {} requestBody: content: application/json: schema: type: object properties: dataset_id: type: string format: uuid description: >- The ID of the dataset to use for task generation. Optional if a dataset was already attached at batch creation time. tasks_per_group: type: integer default: 1 description: >- The number of tasks to randomly assign to each task group. Participants complete one task group per submission. If your dataset includes a META_TASK_GROUP_ID column, those groupings take precedence over this parameter. components: schemas: AI Task Builder_SetupTaskBuilderBatch_Response_202: type: object properties: {} ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/data-collection/batches/batch_id/setup" payload = {} headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/data-collection/batches/batch_id/setup'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/data-collection/batches/batch_id/setup" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/data-collection/batches/batch_id/setup") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/data-collection/batches/batch_id/setup") .header("Authorization", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://api.prolific.com/api/v1/data-collection/batches/batch_id/setup', [ 'body' => '{}', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/data-collection/batches/batch_id/setup"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/data-collection/batches/batch_id/setup")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```