# List Collections GET https://api.prolific.com/api/v1/data-collection/collections Get all AI Task Builder Collections for a workspace. Reference: https://beta-docs.prolific.com/api-reference/ai-task-builder/list-collections ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: List Collections version: endpoint_aiTaskBuilder.ListCollections paths: /api/v1/data-collection/collections: get: operationId: list-collections summary: List Collections description: Get all AI Task Builder Collections for a workspace. tags: - - subpackage_aiTaskBuilder parameters: - name: workspace_id in: query description: The unique identifier of the workspace required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: >- #/components/schemas/AI Task Builder_ListCollections_Response_200 '400': description: Error content: {} components: schemas: CollectionSchemaVersion: type: string enum: - value: '1' TaskDetails: type: object properties: task_name: type: string description: The title displayed to participants task_introduction: type: string description: HTML formatted introduction shown at the start of the task task_steps: type: string description: HTML formatted step-by-step instructions required: - task_name - task_introduction - task_steps CollectionItemSchemaVersion: type: string enum: - value: '1' CollectionMultipleChoiceInstructionType: type: string enum: - value: multiple_choice CollectionMultipleChoiceInstructionOptionsItemsValue: oneOf: - type: string - type: number format: double - type: boolean CollectionMultipleChoiceInstructionOptionsItems: type: object properties: label: type: string value: $ref: >- #/components/schemas/CollectionMultipleChoiceInstructionOptionsItemsValue required: - label - value CollectionMultipleChoiceInstruction: type: object properties: id: type: string format: uuid created_at: type: string format: date-time type: $ref: '#/components/schemas/CollectionMultipleChoiceInstructionType' collection_id: type: string format: uuid created_by: type: string description: type: string order: type: integer helper_text: type: string description: Additional guidance text displayed below the question placeholder_text_input: type: string description: Placeholder text displayed in the input field answer_limit: type: integer disable_dropdown: type: boolean default: false options: type: array items: $ref: >- #/components/schemas/CollectionMultipleChoiceInstructionOptionsItems required: - id - created_at - type - collection_id - created_by - description - order - answer_limit - options CollectionFreeTextInstructionType: type: string enum: - value: free_text CollectionFreeTextInstruction: type: object properties: id: type: string format: uuid created_at: type: string format: date-time type: $ref: '#/components/schemas/CollectionFreeTextInstructionType' collection_id: type: string format: uuid created_by: type: string description: type: string order: type: integer helper_text: type: string description: Additional guidance text displayed below the question placeholder_text_input: type: string description: Placeholder text displayed in the input field required: - id - created_at - type - collection_id - created_by - description - order CollectionMultipleChoiceWithFreeTextInstructionType: type: string enum: - value: multiple_choice_with_free_text CollectionMultipleChoiceWithFreeTextInstructionOptionsItemsValue: oneOf: - type: string - type: number format: double - type: boolean CollectionMultipleChoiceWithFreeTextInstructionOptionsItems: type: object properties: label: type: string value: $ref: >- #/components/schemas/CollectionMultipleChoiceWithFreeTextInstructionOptionsItemsValue heading: type: string required: - label - value - heading CollectionMultipleChoiceWithFreeTextInstruction: type: object properties: id: type: string format: uuid created_at: type: string format: date-time type: $ref: >- #/components/schemas/CollectionMultipleChoiceWithFreeTextInstructionType collection_id: type: string format: uuid created_by: type: string description: type: string order: type: integer helper_text: type: string description: Additional guidance text displayed below the question placeholder_text_input: type: string description: Placeholder text displayed in the input field answer_limit: type: integer disable_dropdown: type: boolean default: false options: type: array items: $ref: >- #/components/schemas/CollectionMultipleChoiceWithFreeTextInstructionOptionsItems required: - id - created_at - type - collection_id - created_by - description - order - answer_limit - options CollectionFileUploadInstructionType: type: string enum: - value: file_upload CollectionFileUploadInstruction: type: object properties: id: type: string format: uuid created_at: type: string format: date-time type: $ref: '#/components/schemas/CollectionFileUploadInstructionType' collection_id: type: string format: uuid created_by: type: string description: type: string order: type: integer helper_text: type: string description: Additional guidance text displayed below the question placeholder_text_input: type: string description: Placeholder text displayed in the input field required: - id - created_at - type - collection_id - created_by - description - order CollectionInstruction: oneOf: - $ref: '#/components/schemas/CollectionMultipleChoiceInstruction' - $ref: '#/components/schemas/CollectionFreeTextInstruction' - $ref: '#/components/schemas/CollectionMultipleChoiceWithFreeTextInstruction' - $ref: '#/components/schemas/CollectionFileUploadInstruction' ImageContentBlockType: type: string enum: - value: image ImageContentBlockParentType: type: string enum: - value: collection - value: batch ImageContentBlockSchemaVersion: type: string enum: - value: '1' ImageContentBlock: type: object properties: id: type: string format: uuid created_at: type: string format: date-time type: $ref: '#/components/schemas/ImageContentBlockType' parent_id: type: string format: uuid description: ID of the parent collection item (page) parent_type: $ref: '#/components/schemas/ImageContentBlockParentType' created_by: type: string schema_version: $ref: '#/components/schemas/ImageContentBlockSchemaVersion' url: type: string format: uri description: HTTPS URL of the image alt_text: type: string description: Alt text for accessibility caption: type: string description: Optional caption displayed below the image required: - id - created_at - type - parent_id - parent_type - created_by - schema_version - url - alt_text RichTextContentBlockType: type: string enum: - value: rich_text RichTextContentBlockParentType: type: string enum: - value: collection - value: batch RichTextContentBlockSchemaVersion: type: string enum: - value: '1' RichTextContentBlock: type: object properties: id: type: string format: uuid created_at: type: string format: date-time type: $ref: '#/components/schemas/RichTextContentBlockType' parent_id: type: string format: uuid description: ID of the parent collection item (page) parent_type: $ref: '#/components/schemas/RichTextContentBlockParentType' created_by: type: string schema_version: $ref: '#/components/schemas/RichTextContentBlockSchemaVersion' content: type: string description: Markdown formatted content required: - id - created_at - type - parent_id - parent_type - created_by - schema_version - content ContentBlock: oneOf: - $ref: '#/components/schemas/ImageContentBlock' - $ref: '#/components/schemas/RichTextContentBlock' PageItem: oneOf: - $ref: '#/components/schemas/CollectionInstruction' - $ref: '#/components/schemas/ContentBlock' CollectionItem: type: object properties: id: type: string format: uuid created_at: type: string format: date-time created_by: type: string schema_version: $ref: '#/components/schemas/CollectionItemSchemaVersion' page_items: type: array items: $ref: '#/components/schemas/PageItem' description: Instructions and content blocks on this page required: - id - created_at - created_by - schema_version - page_items Collection: type: object properties: id: type: string format: uuid schema_version: $ref: '#/components/schemas/CollectionSchemaVersion' created_at: type: string format: date-time description: ISO-8601 formatted creation timestamp in UTC created_by: type: string description: User ID of the Prolific user that created the collection workspace_id: type: string description: The ID of the Prolific workspace name: type: string description: The name of the collection task_details: $ref: '#/components/schemas/TaskDetails' collection_items: type: array items: $ref: '#/components/schemas/CollectionItem' description: Pages within the collection. Each collection item represents a page. last_modified_at: type: string format: date-time description: ISO-8601 formatted last modification timestamp in UTC last_modified_by: type: string description: User ID of the Prolific user that last modified the collection required: - id - schema_version - created_at - created_by - workspace_id - name - task_details - collection_items ApiV1DataCollectionCollectionsGetResponsesContentApplicationJsonSchemaMeta: type: object properties: count: type: integer description: Total number of collections AI Task Builder_ListCollections_Response_200: type: object properties: results: type: array items: $ref: '#/components/schemas/Collection' meta: $ref: >- #/components/schemas/ApiV1DataCollectionCollectionsGetResponsesContentApplicationJsonSchemaMeta ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/data-collection/collections" querystring = {"workspace_id":"workspace_id"} headers = {"Authorization": ""} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/data-collection/collections?workspace_id=workspace_id'; const options = {method: 'GET', headers: {Authorization: ''}}; 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/collections?workspace_id=workspace_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "") 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/collections?workspace_id=workspace_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '' response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.get("https://api.prolific.com/api/v1/data-collection/collections?workspace_id=workspace_id") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://api.prolific.com/api/v1/data-collection/collections?workspace_id=workspace_id', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/data-collection/collections?workspace_id=workspace_id"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/data-collection/collections?workspace_id=workspace_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" 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() ```