# Download demographic data for a single submission GET https://api.prolific.com/api/v1/submissions/{id}/demographics/ ### Overview Retrieves demographic data for a specific submission, reflecting a snapshot of the participant's demographics at the time of submission completion. ### Data Source - Demographic data is retrieved from archives and is not generated on-the-fly - If no archived demographic data exists for the submission, a 404 response will be returned ### Data Format - The demographic dataset is dynamic and evolves as questions are added or removed - For questions that weren't answered by the participant, the value will be `DATA_EXPIRED` - Fields may include standard demographic information such as age range, gender, education level, etc. This feature is only available to specific workspaces. Reference: https://beta-docs.prolific.com/api-reference/submissions/get-submission-demographics ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Download demographic data for a single submission version: endpoint_submissions.GetSubmissionDemographics paths: /api/v1/submissions/{id}/demographics/: get: operationId: get-submission-demographics summary: Download demographic data for a single submission description: > ### Overview Retrieves demographic data for a specific submission, reflecting a snapshot of the participant's demographics at the time of submission completion. ### Data Source - Demographic data is retrieved from archives and is not generated on-the-fly - If no archived demographic data exists for the submission, a 404 response will be returned ### Data Format - The demographic dataset is dynamic and evolves as questions are added or removed - For questions that weren't answered by the participant, the value will be `DATA_EXPIRED` - Fields may include standard demographic information such as age range, gender, education level, etc. This feature is only available to specific workspaces. tags: - - subpackage_submissions parameters: - name: id in: path description: The submission id required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: Demographic data for the submission content: application/json: schema: $ref: '#/components/schemas/SubmissionDemographicsResponse' '400': description: Error content: {} '404': description: >- Archive not found - no demographic data was archived for this submission content: {} components: schemas: SubmissionDemographicsResponse: type: object properties: submission_id: type: string description: The ID of the submission participant_id: type: string description: The ID of the participant who made the submission custom_study_tncs_accepted_at: type: string description: >- When custom study terms and conditions were accepted, if not accepted this will be `Not Applicable` started_at: type: string format: date-time description: When the submission was started (UTC, ISO 8601 format) completed_at: type: string format: date-time description: When the submission was completed (UTC, ISO 8601 format) archived_at: type: string format: date-time description: When the demographic data was archived (UTC, ISO 8601 format) time_taken: type: integer description: Time taken to complete the submission in seconds completion_code: type: string description: The completion code entered by the participant total_approvals: type: integer description: Total number of approved submissions by this participant demographics: type: object additionalProperties: description: Any type description: Demographic data that was archived when the submission was completed ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/submissions/id/demographics/" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/submissions/id/demographics/'; 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/submissions/id/demographics/" 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/submissions/id/demographics/") 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/submissions/id/demographics/") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://api.prolific.com/api/v1/submissions/id/demographics/', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/submissions/id/demographics/"); 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/submissions/id/demographics/")! 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() ```