# Update a Collection PUT https://api.prolific.com/api/v1/data-collection/collections/{collection_id} Content-Type: application/json Update an existing AI Task Builder Collection. This is a full replacement — all fields must be provided. To preserve existing entities (collection items, page items) when updating, include their `id` fields in the request. Entities without IDs will be created as new, and existing entities not included in the request will be deleted. Reference: https://beta-docs.prolific.com/api-reference/ai-task-builder/update-collection ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Update a Collection version: endpoint_aiTaskBuilder.UpdateCollection paths: /api/v1/data-collection/collections/{collection_id}: put: operationId: update-collection summary: Update a Collection description: >- Update an existing AI Task Builder Collection. This is a full replacement — all fields must be provided. To preserve existing entities (collection items, page items) when updating, include their `id` fields in the request. Entities without IDs will be created as new, and existing entities not included in the request will be deleted. tags: - - subpackage_aiTaskBuilder parameters: - name: collection_id in: path 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/Collection' '400': description: Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/CollectionUpdateRequest' components: schemas: 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 CollectionInstructionInputType: type: string enum: - value: multiple_choice - value: free_text - value: multiple_choice_with_free_text - value: file_upload CollectionInstructionInputOptionsItemsValue: oneOf: - type: string - type: number format: double - type: boolean CollectionInstructionInputOptionsItems: type: object properties: label: type: string value: $ref: '#/components/schemas/CollectionInstructionInputOptionsItemsValue' heading: type: string description: Required for multiple_choice_with_free_text required: - label - value CollectionInstructionInput: type: object properties: id: type: string format: uuid description: Include to preserve an existing instruction when updating type: $ref: '#/components/schemas/CollectionInstructionInputType' description: type: string description: The question or prompt displayed to participants order: type: integer description: Position of this instruction relative to others 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 description: >- Number of options that can be selected. Use 1 for single-select, -1 for unlimited. disable_dropdown: type: boolean default: false description: >- When true, always renders checkbox/radio elements instead of a dropdown select. options: type: array items: $ref: '#/components/schemas/CollectionInstructionInputOptionsItems' required: - type - description - order ContentBlockInputType: type: string enum: - value: image - value: rich_text ContentBlockInput: type: object properties: id: type: string format: uuid description: Include to preserve an existing content block when updating type: $ref: '#/components/schemas/ContentBlockInputType' url: type: string format: uri description: HTTPS URL for image content blocks alt_text: type: string description: Alt text for image content blocks (required for accessibility) caption: type: string description: Optional caption for image content blocks content: type: string description: Markdown content for rich_text content blocks required: - type PageItemInput: oneOf: - $ref: '#/components/schemas/CollectionInstructionInput' - $ref: '#/components/schemas/ContentBlockInput' CollectionItemInput: type: object properties: id: type: string format: uuid description: Include to preserve an existing page when updating page_items: type: array items: $ref: '#/components/schemas/PageItemInput' description: Instructions and content blocks on this page required: - page_items CollectionUpdateRequest: type: object properties: name: type: string description: The name of the collection task_details: $ref: '#/components/schemas/TaskDetails' collection_items: type: array items: $ref: '#/components/schemas/CollectionItemInput' description: >- Pages within the collection. Include `id` to preserve existing items. required: - name - task_details - collection_items CollectionSchemaVersion: type: string enum: - value: '1' 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 ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/data-collection/collections/collection_id" payload = { "name": "Updated Skin Type Assessment", "task_details": { "task_name": "Assess Your Skin Type", "task_introduction": "

Please answer the following questions about your skin.

", "task_steps": "
  1. Read each question carefully
  2. Select the most accurate answer
" }, "collection_items": [ { "page_items": [ { "id": "01924850-9e29-744a-811c-b26612812346", "type": "rich_text", "content": "## Section 1: Basic Information" }, { "id": "01924850-9e29-744a-811c-b26612812347", "type": "multiple_choice", "content": "What is your skin type? Select the option that best describes your skin condition throughout the day. This will help us recommend suitable skincare products for you." } ], "id": "01924850-9e29-744a-811c-b26612812345" } ] } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.put(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/data-collection/collections/collection_id'; const options = { method: 'PUT', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"name":"Updated Skin Type Assessment","task_details":{"task_name":"Assess Your Skin Type","task_introduction":"

Please answer the following questions about your skin.

","task_steps":"
  1. Read each question carefully
  2. Select the most accurate answer
"},"collection_items":[{"page_items":[{"id":"01924850-9e29-744a-811c-b26612812346","type":"rich_text","content":"## Section 1: Basic Information"},{"id":"01924850-9e29-744a-811c-b26612812347","type":"multiple_choice","content":"What is your skin type? Select the option that best describes your skin condition throughout the day. This will help us recommend suitable skincare products for you."}],"id":"01924850-9e29-744a-811c-b26612812345"}]}' }; 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/collections/collection_id" payload := strings.NewReader("{\n \"name\": \"Updated Skin Type Assessment\",\n \"task_details\": {\n \"task_name\": \"Assess Your Skin Type\",\n \"task_introduction\": \"

Please answer the following questions about your skin.

\",\n \"task_steps\": \"
  1. Read each question carefully
  2. Select the most accurate answer
\"\n },\n \"collection_items\": [\n {\n \"page_items\": [\n {\n \"id\": \"01924850-9e29-744a-811c-b26612812346\",\n \"type\": \"rich_text\",\n \"content\": \"## Section 1: Basic Information\"\n },\n {\n \"id\": \"01924850-9e29-744a-811c-b26612812347\",\n \"type\": \"multiple_choice\",\n \"content\": \"What is your skin type? Select the option that best describes your skin condition throughout the day. This will help us recommend suitable skincare products for you.\"\n }\n ],\n \"id\": \"01924850-9e29-744a-811c-b26612812345\"\n }\n ]\n}") req, _ := http.NewRequest("PUT", 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/collections/collection_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"name\": \"Updated Skin Type Assessment\",\n \"task_details\": {\n \"task_name\": \"Assess Your Skin Type\",\n \"task_introduction\": \"

Please answer the following questions about your skin.

\",\n \"task_steps\": \"
  1. Read each question carefully
  2. Select the most accurate answer
\"\n },\n \"collection_items\": [\n {\n \"page_items\": [\n {\n \"id\": \"01924850-9e29-744a-811c-b26612812346\",\n \"type\": \"rich_text\",\n \"content\": \"## Section 1: Basic Information\"\n },\n {\n \"id\": \"01924850-9e29-744a-811c-b26612812347\",\n \"type\": \"multiple_choice\",\n \"content\": \"What is your skin type? Select the option that best describes your skin condition throughout the day. This will help us recommend suitable skincare products for you.\"\n }\n ],\n \"id\": \"01924850-9e29-744a-811c-b26612812345\"\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.put("https://api.prolific.com/api/v1/data-collection/collections/collection_id") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"name\": \"Updated Skin Type Assessment\",\n \"task_details\": {\n \"task_name\": \"Assess Your Skin Type\",\n \"task_introduction\": \"

Please answer the following questions about your skin.

\",\n \"task_steps\": \"
  1. Read each question carefully
  2. Select the most accurate answer
\"\n },\n \"collection_items\": [\n {\n \"page_items\": [\n {\n \"id\": \"01924850-9e29-744a-811c-b26612812346\",\n \"type\": \"rich_text\",\n \"content\": \"## Section 1: Basic Information\"\n },\n {\n \"id\": \"01924850-9e29-744a-811c-b26612812347\",\n \"type\": \"multiple_choice\",\n \"content\": \"What is your skin type? Select the option that best describes your skin condition throughout the day. This will help us recommend suitable skincare products for you.\"\n }\n ],\n \"id\": \"01924850-9e29-744a-811c-b26612812345\"\n }\n ]\n}") .asString(); ``` ```php request('PUT', 'https://api.prolific.com/api/v1/data-collection/collections/collection_id', [ 'body' => '{ "name": "Updated Skin Type Assessment", "task_details": { "task_name": "Assess Your Skin Type", "task_introduction": "

Please answer the following questions about your skin.

", "task_steps": "
  1. Read each question carefully
  2. Select the most accurate answer
" }, "collection_items": [ { "page_items": [ { "id": "01924850-9e29-744a-811c-b26612812346", "type": "rich_text", "content": "## Section 1: Basic Information" }, { "id": "01924850-9e29-744a-811c-b26612812347", "type": "multiple_choice", "content": "What is your skin type? Select the option that best describes your skin condition throughout the day. This will help us recommend suitable skincare products for you." } ], "id": "01924850-9e29-744a-811c-b26612812345" } ] }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/data-collection/collections/collection_id"); var request = new RestRequest(Method.PUT); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"Updated Skin Type Assessment\",\n \"task_details\": {\n \"task_name\": \"Assess Your Skin Type\",\n \"task_introduction\": \"

Please answer the following questions about your skin.

\",\n \"task_steps\": \"
  1. Read each question carefully
  2. Select the most accurate answer
\"\n },\n \"collection_items\": [\n {\n \"page_items\": [\n {\n \"id\": \"01924850-9e29-744a-811c-b26612812346\",\n \"type\": \"rich_text\",\n \"content\": \"## Section 1: Basic Information\"\n },\n {\n \"id\": \"01924850-9e29-744a-811c-b26612812347\",\n \"type\": \"multiple_choice\",\n \"content\": \"What is your skin type? Select the option that best describes your skin condition throughout the day. This will help us recommend suitable skincare products for you.\"\n }\n ],\n \"id\": \"01924850-9e29-744a-811c-b26612812345\"\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "name": "Updated Skin Type Assessment", "task_details": [ "task_name": "Assess Your Skin Type", "task_introduction": "

Please answer the following questions about your skin.

", "task_steps": "
  1. Read each question carefully
  2. Select the most accurate answer
" ], "collection_items": [ [ "page_items": [ [ "id": "01924850-9e29-744a-811c-b26612812346", "type": "rich_text", "content": "## Section 1: Basic Information" ], [ "id": "01924850-9e29-744a-811c-b26612812347", "type": "multiple_choice", "content": "What is your skin type? Select the option that best describes your skin condition throughout the day. This will help us recommend suitable skincare products for you." ] ], "id": "01924850-9e29-744a-811c-b26612812345" ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) 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 = "PUT" 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() ```