For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.prolific.com/api-reference/ai-task-builder/llms.txt. For full documentation content, see https://docs.prolific.com/api-reference/ai-task-builder/llms-full.txt.

# Request a Batch Export

POST https://api.prolific.com/api/v1/data-collection/batches/{batch_id}/export

Initiates an asynchronous export of all participant responses and uploaded files for a batch as a ZIP archive.

The export is generated out-of-band to handle large batches without hitting API timeout limits. The endpoint returns immediately with one of two outcomes:

- **202 Accepted** — a new export job has been enqueued. Use the returned `export_id` to poll `GET /batches/{batch_id}/export/{export_id}` for status.
- **200 OK** — a recent export already exists and is ready to download immediately.

Subsequent POST requests for the same batch are idempotent while an export is generating or complete; they return the existing job ID or download URL rather than re-triggering generation.

Only researchers with workspace access to the batch can request an export.

Reference: https://docs.prolific.com/api-reference/ai-task-builder/request-batch-export

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Prolific API for Data Collectors
  version: 1.0.0
paths:
  /api/v1/data-collection/batches/{batch_id}/export:
    post:
      operationId: request-batch-export
      summary: Request a Batch Export
      description: >-
        Initiates an asynchronous export of all participant responses and
        uploaded files for a batch as a ZIP archive.


        The export is generated out-of-band to handle large batches without
        hitting API timeout limits. The endpoint returns immediately with one of
        two outcomes:


        - **202 Accepted** — a new export job has been enqueued. Use the
        returned `export_id` to poll `GET
        /batches/{batch_id}/export/{export_id}` for status.

        - **200 OK** — a recent export already exists and is ready to download
        immediately.


        Subsequent POST requests for the same batch are idempotent while an
        export is generating or complete; they return the existing job ID or
        download URL rather than re-triggering generation.


        Only researchers with workspace access to the batch can request an
        export.
      tags:
        - subpackage_aiTaskBuilder
      parameters:
        - name: batch_id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Export already complete
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchExportComplete'
        '403':
          description: Forbidden — user does not have workspace access to this batch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
servers:
  - url: https://api.prolific.com
components:
  schemas:
    BatchExportCompleteStatus:
      type: string
      enum:
        - complete
      title: BatchExportCompleteStatus
    BatchExportComplete:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/BatchExportCompleteStatus'
        url:
          type: string
          format: uri
          description: >-
            Presigned HTTPS URL for downloading the ZIP archive. Valid for 24
            hours. Re-poll to get a refreshed URL if expired.
        expires_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp indicating when the presigned URL expires.
      required:
        - status
        - url
        - expires_at
      description: >-
        An export job that has completed successfully. The ZIP archive is ready
        to download.
      title: BatchExportComplete
    ErrorDetailDetail2:
      type: object
      properties:
        any_field:
          type: array
          items:
            type: string
          description: >-
            Name of the field with a validation error and as a value an array
            with the error descriptions
      description: All fields with validation errors
      title: ErrorDetailDetail2
    ErrorDetailDetail:
      oneOf:
        - type: string
        - type: array
          items:
            type: string
        - $ref: '#/components/schemas/ErrorDetailDetail2'
      description: Error detail
      title: ErrorDetailDetail
    ErrorDetail:
      type: object
      properties:
        status:
          type: integer
          description: Status code as in the http standards
        error_code:
          type: integer
          description: Internal error code
        title:
          type: string
          description: Error title
        detail:
          $ref: '#/components/schemas/ErrorDetailDetail'
          description: Error detail
        additional_information:
          type: string
          description: Optional extra information
        traceback:
          type: string
          description: Optional debug information
        interactive:
          type: boolean
      required:
        - status
        - error_code
        - title
        - detail
      title: ErrorDetail
    Error:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      title: Error
  securitySchemes:
    token:
      type: apiKey
      in: header
      name: Authorization

```

## SDK Code Examples

```python
import requests

url = "https://api.prolific.com/api/v1/data-collection/batches/batch_id/export"

headers = {"Authorization": "Token <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.prolific.com/api/v1/data-collection/batches/batch_id/export';
const options = {method: 'POST', headers: {Authorization: 'Token <token>'}};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.prolific.com/api/v1/data-collection/batches/batch_id/export"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Token <token>")

	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/export")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Token <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.prolific.com/api/v1/data-collection/batches/batch_id/export")
  .header("Authorization", "Token <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.prolific.com/api/v1/data-collection/batches/batch_id/export', [
  'headers' => [
    'Authorization' => 'Token <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.prolific.com/api/v1/data-collection/batches/batch_id/export");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Token <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Token <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/data-collection/batches/batch_id/export")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

```python
import requests

url = "https://api.prolific.com/api/v1/data-collection/batches/batch_id/export"

headers = {"Authorization": "Token <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.prolific.com/api/v1/data-collection/batches/batch_id/export';
const options = {method: 'POST', headers: {Authorization: 'Token <token>'}};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.prolific.com/api/v1/data-collection/batches/batch_id/export"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Token <token>")

	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/export")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Token <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.prolific.com/api/v1/data-collection/batches/batch_id/export")
  .header("Authorization", "Token <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.prolific.com/api/v1/data-collection/batches/batch_id/export', [
  'headers' => [
    'Authorization' => 'Token <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.prolific.com/api/v1/data-collection/batches/batch_id/export");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Token <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Token <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/data-collection/batches/batch_id/export")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```