# Get a Collection GET https://api.prolific.com/api/v1/data-collection/collections/{collection_id} Get a specific AI Task Builder Collection by its unique identifier. Reference: https://docs.prolific.com/api-reference/ai-task-builder/get-collection ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get a Collection version: endpoint_aiTaskBuilder.GetCollection paths: /api/v1/data-collection/collections/{collection_id}: get: operationId: get-collection summary: Get a Collection description: Get a specific AI Task Builder Collection by its unique identifier. tags: - - subpackage_aiTaskBuilder parameters: - name: collection_id in: path required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `Token ` required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Collection' '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 CollectionMultipleChoiceInstructionParentType: type: string enum: - value: batch - value: collection 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' parent_id: type: string format: uuid description: ID of the parent batch or collection parent_type: $ref: '#/components/schemas/CollectionMultipleChoiceInstructionParentType' 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 - parent_id - parent_type - created_by - description - order - answer_limit - options CollectionFreeTextInstructionType: type: string enum: - value: free_text CollectionFreeTextInstructionParentType: type: string enum: - value: batch - value: collection CollectionFreeTextInstruction: type: object properties: id: type: string format: uuid created_at: type: string format: date-time type: $ref: '#/components/schemas/CollectionFreeTextInstructionType' parent_id: type: string format: uuid description: ID of the parent batch or collection parent_type: $ref: '#/components/schemas/CollectionFreeTextInstructionParentType' 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 - parent_id - parent_type - created_by - description - order CollectionFreeTextWithUnitInstructionType: type: string enum: - value: free_text_with_unit CollectionFreeTextWithUnitInstructionParentType: type: string enum: - value: batch - value: collection CollectionFreeTextWithUnitInstructionUnitOptionsItemsValue: oneOf: - type: string - type: number format: double - type: boolean CollectionFreeTextWithUnitInstructionUnitOptionsItems: type: object properties: label: type: string description: Display text shown to participants value: $ref: >- #/components/schemas/CollectionFreeTextWithUnitInstructionUnitOptionsItemsValue description: Value returned in responses required: - label - value CollectionFreeTextWithUnitInstructionUnitPosition: type: string enum: - value: prefix - value: suffix CollectionFreeTextWithUnitInstruction: type: object properties: id: type: string format: uuid created_at: type: string format: date-time type: $ref: '#/components/schemas/CollectionFreeTextWithUnitInstructionType' parent_id: type: string format: uuid description: ID of the parent batch or collection parent_type: $ref: '#/components/schemas/CollectionFreeTextWithUnitInstructionParentType' 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 unit_options: type: array items: $ref: >- #/components/schemas/CollectionFreeTextWithUnitInstructionUnitOptionsItems description: List of available units that participants can select from default_unit: type: string description: Default selected unit (must match a value from unit_options) unit_position: $ref: >- #/components/schemas/CollectionFreeTextWithUnitInstructionUnitPosition description: >- Position of the unit selector relative to the text input. Use 'prefix' for units before the input (e.g., currency symbols) or 'suffix' for units after the input (e.g., measurements). required: - id - created_at - type - parent_id - parent_type - created_by - description - order - unit_options - unit_position CollectionMultipleChoiceWithFreeTextInstructionType: type: string enum: - value: multiple_choice_with_free_text CollectionMultipleChoiceWithFreeTextInstructionParentType: type: string enum: - value: batch - value: collection 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 parent_id: type: string format: uuid description: ID of the parent batch or collection parent_type: $ref: >- #/components/schemas/CollectionMultipleChoiceWithFreeTextInstructionParentType 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 - parent_id - parent_type - created_by - description - order - answer_limit - options CollectionFileUploadInstructionType: type: string enum: - value: file_upload CollectionFileUploadInstructionParentType: type: string enum: - value: batch - value: collection CollectionFileUploadInstruction: type: object properties: id: type: string format: uuid created_at: type: string format: date-time type: $ref: '#/components/schemas/CollectionFileUploadInstructionType' parent_id: type: string format: uuid description: ID of the parent batch or collection parent_type: $ref: '#/components/schemas/CollectionFileUploadInstructionParentType' 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 accepted_file_types: type: array items: type: string description: >- File extensions to accept (e.g., [".jpg", ".png", ".pdf"]). Each extension must start with a dot. Defaults to [".jpg", ".jpeg", ".png", ".heic", ".heif"] if not specified. max_file_size_mb: type: number format: double description: >- Maximum file size in megabytes per file. Must be a positive number. Defaults to 25. min_file_count: type: integer description: Minimum number of files required. Must be at least 1. Defaults to 1. max_file_count: type: integer description: >- Maximum number of files allowed. Must be at least 1 and greater than or equal to min_file_count. Defaults to 10. required: - id - created_at - type - parent_id - parent_type - created_by - description - order CollectionInstruction: oneOf: - $ref: '#/components/schemas/CollectionMultipleChoiceInstruction' - $ref: '#/components/schemas/CollectionFreeTextInstruction' - $ref: '#/components/schemas/CollectionFreeTextWithUnitInstruction' - $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: >- HTML content. If the original input used Markdown, it has been converted to HTML. 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 ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/data-collection/collections/collection_id" headers = {"Authorization": "Token "} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/data-collection/collections/collection_id'; const options = {method: 'GET', headers: {Authorization: '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/collections/collection_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "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/collections/collection_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Token ' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.prolific.com/api/v1/data-collection/collections/collection_id") .header("Authorization", "Token ") .asString(); ``` ```php request('GET', 'https://api.prolific.com/api/v1/data-collection/collections/collection_id', [ 'headers' => [ 'Authorization' => 'Token ', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.prolific.com/api/v1/data-collection/collections/collection_id"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Token "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Token "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/data-collection/collections/collection_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() ```