# Show Study predicted recruitment time POST https://api.prolific.com/api/v1/studies/predicted-recruitment-time/ Content-Type: application/json Returns the predicted recruitment time for a study that has not even been saved as a draft if it was published right now, based on a machine learning model. The recruitment time is the time from publish to the time when the final participant starts their submission. It does not account for the time to complete the submission. Reference: https://beta-docs.prolific.com/api-reference/studies/get-study-predicted-recruitment-time ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Show Study predicted recruitment time version: endpoint_studies.PostStudyPredictedRecruitmentTime paths: /api/v1/studies/predicted-recruitment-time/: post: operationId: post-study-predicted-recruitment-time summary: Show Study predicted recruitment time description: >- Returns the predicted recruitment time for a study that has not even been saved as a draft if it was published right now, based on a machine learning model. The recruitment time is the time from publish to the time when the final participant starts their submission. It does not account for the time to complete the submission. tags: - - subpackage_studies parameters: - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: Return the predicted recruitment time for the study content: application/json: schema: $ref: '#/components/schemas/StudyPredictedRecruitmentTimeResponse' '400': description: Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/StudyPredictedRecruitmentTimeRequest' components: schemas: SelectFilter: type: object properties: filter_id: type: string description: ID of the "select" type filter. selected_values: type: array items: type: string description: >- This schema applies for filters of the `select` type, as defined in the [filter list response](\#tag/Filters/paths/~1api~1v1~1filters~1/get). Array of IDs matching the response IDs, from the `select` filter's `choices` (see response linked above). String format should match the `data_type` of the `select` filter's `choices` (see response linked above). weightings: type: object additionalProperties: type: number format: double description: >- Ratios to control the distribution of participants across the selected values. Integer percentages, floats, and exact quantities are valid inputs. required: - filter_id - selected_values RangeFilterSelectedRangeLower: oneOf: - type: integer - type: string - type: number format: double RangeFilterSelectedRangeUpper: oneOf: - type: integer - type: string - type: number format: double RangeFilterSelectedRange: type: object properties: lower: $ref: '#/components/schemas/RangeFilterSelectedRangeLower' description: Your selected lower bound for the range. upper: $ref: '#/components/schemas/RangeFilterSelectedRangeUpper' description: Your selected upper bound for the range. RangeFilterWeightingsSelectedRangeLower: oneOf: - type: integer - type: string - type: number format: double RangeFilterWeightingsSelectedRangeUpper: oneOf: - type: integer - type: string - type: number format: double RangeFilterWeightingsSelectedRange: type: object properties: lower: $ref: '#/components/schemas/RangeFilterWeightingsSelectedRangeLower' upper: $ref: '#/components/schemas/RangeFilterWeightingsSelectedRangeUpper' RangeFilterWeightings: type: object properties: selected_range: $ref: '#/components/schemas/RangeFilterWeightingsSelectedRange' weighting: type: number format: double required: - selected_range - weighting RangeFilter: type: object properties: filter_id: type: string description: ID of the "range" type filter. selected_range: $ref: '#/components/schemas/RangeFilterSelectedRange' description: >- This schema applies for filters of the `range` type, as defined in the [filter list response](\#tag/Filters/paths/~1api~1v1~1filters~1/get). A dictionary with two possible objects, 'lower' and 'upper'. At least one must be present and a non-null value. The expected data type for these values is defined by the `range` filter's `data_type` (see response linked above). If the data_type is a date, string format should be a parseable ISO8601 date string. Date values should be provided as a string in ISO 8601 format. Leaving a value as null will result in that bound being set to the lowest or highest possible value, depending on whether it is the upper or lower bound. weightings: $ref: '#/components/schemas/RangeFilterWeightings' description: >- Ratios to control the distribution of participants across the selected values. Integers and exact quantities are valid inputs. required: - filter_id - selected_range StudyPredictedRecruitmentTimeRequestFiltersItems: oneOf: - $ref: '#/components/schemas/SelectFilter' - $ref: '#/components/schemas/RangeFilter' StudyPredictedRecruitmentTimeRequestStudyType: type: string enum: - value: SINGLE - value: UK_REP_SAMPLE - value: REP_SAMPLE_UK_ENGLISH_AGE_POLITICAL_AFFILIATION_ETHNICITY - value: REP_SAMPLE_UK_ENGLISH_AGE_POLITICAL_AFFILIATION - value: US_REP_SAMPLE - value: REP_SAMPLE_US_ENGLISH_AGE_POLITICAL_AFFILIATION_ETHNICITY - value: REP_SAMPLE_US_ENGLISH_AGE_POLITICAL_AFFILIATION - value: UK_REGIONAL_REP_SAMPLE - value: US_REGIONAL_REP_SAMPLE StudyPredictedRecruitmentTimeRequestDeviceCompatibilityItems: type: string enum: - value: desktop - value: tablet - value: mobile StudyPredictedRecruitmentTimeRequestPeripheralRequirementsItems: type: string enum: - value: audio - value: camera - value: download - value: microphone StudyPredictedRecruitmentTimeRequestStudyLabels: type: string enum: - value: survey - value: writing_task - value: annotation - value: decision_making_task - value: interview - value: other - value: ai_annotation - value: ai_evaluation - value: ai_reasoning - value: ai_fact_checking - value: ai_safety - value: ai_data_creation_text - value: ai_data_creation_audio - value: ai_data_creation_video - value: ai_data_creation_images - value: ai_other StudyPredictedRecruitmentTimeRequest: type: object properties: filters: type: array items: $ref: >- #/components/schemas/StudyPredictedRecruitmentTimeRequestFiltersItems description: >- List of filters to apply to the count. This parameter uses the new, simplified filters schema for interacting with eligibility. workspace_id: type: string description: The ID of the workspace the study will be created in. reward: type: number format: double description: >- How much are you going to pay the participants in cents. We use the currency of the workspace study_type: $ref: '#/components/schemas/StudyPredictedRecruitmentTimeRequestStudyType' description: Type of study. total_available_places: type: number format: double description: How many participants are you looking to recruit estimated_completion_time: type: number format: double description: Estimated duration in minutes of the experiment or survey device_compatibility: type: array items: $ref: >- #/components/schemas/StudyPredictedRecruitmentTimeRequestDeviceCompatibilityItems description: |- Add all devices that participants can use. You can include one or more options. peripheral_requirements: type: array items: $ref: >- #/components/schemas/StudyPredictedRecruitmentTimeRequestPeripheralRequirementsItems description: Add all requirements that participants have to meet. study_labels: $ref: '#/components/schemas/StudyPredictedRecruitmentTimeRequestStudyLabels' description: The field that the study is about to get tagged with. required: - filters - workspace_id - reward - study_type - total_available_places - estimated_completion_time StudyPredictedRecruitmentTimeResponse: type: object properties: precise_recruitment_time_hours: type: number format: double description: The predicted recruitment time in hours lower_bound_hours: type: number format: double description: The lower bound of the predicted recruitment time in hours upper_bound_hours: type: number format: double description: The upper bound of the predicted recruitment time in hours display_string: type: string description: A human-readable string representing the predicted recruitment time limit_at: type: number format: double description: >- The limit at which the accuracy of the prediction becomes unstable. This should be used when rendering the recruitment times in a GUI. For example if the limit_at is 10, and the predicted recruitment time is 12 hours, the display string should be "10 hours+". This has been done for you in the display_string field. ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/studies/predicted-recruitment-time/" payload = { "filters": [ { "filter_id": "first-language", "selected_values": ["1", "2"] } ], "workspace_id": "74581909c0265l1da4a71092", "reward": 100, "study_type": "SINGLE", "total_available_places": 30, "estimated_completion_time": 1, "device_compatibility": ["mobile", "tablet"], "peripheral_requirements": ["audio", "microphone"], "study_labels": "survey" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/studies/predicted-recruitment-time/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"filters":[{"filter_id":"first-language","selected_values":["1","2"]}],"workspace_id":"74581909c0265l1da4a71092","reward":100,"study_type":"SINGLE","total_available_places":30,"estimated_completion_time":1,"device_compatibility":["mobile","tablet"],"peripheral_requirements":["audio","microphone"],"study_labels":"survey"}' }; 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/studies/predicted-recruitment-time/" payload := strings.NewReader("{\n \"filters\": [\n {\n \"filter_id\": \"first-language\",\n \"selected_values\": [\n \"1\",\n \"2\"\n ]\n }\n ],\n \"workspace_id\": \"74581909c0265l1da4a71092\",\n \"reward\": 100,\n \"study_type\": \"SINGLE\",\n \"total_available_places\": 30,\n \"estimated_completion_time\": 1,\n \"device_compatibility\": [\n \"mobile\",\n \"tablet\"\n ],\n \"peripheral_requirements\": [\n \"audio\",\n \"microphone\"\n ],\n \"study_labels\": \"survey\"\n}") req, _ := http.NewRequest("POST", 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/studies/predicted-recruitment-time/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"filters\": [\n {\n \"filter_id\": \"first-language\",\n \"selected_values\": [\n \"1\",\n \"2\"\n ]\n }\n ],\n \"workspace_id\": \"74581909c0265l1da4a71092\",\n \"reward\": 100,\n \"study_type\": \"SINGLE\",\n \"total_available_places\": 30,\n \"estimated_completion_time\": 1,\n \"device_compatibility\": [\n \"mobile\",\n \"tablet\"\n ],\n \"peripheral_requirements\": [\n \"audio\",\n \"microphone\"\n ],\n \"study_labels\": \"survey\"\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/predicted-recruitment-time/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"filters\": [\n {\n \"filter_id\": \"first-language\",\n \"selected_values\": [\n \"1\",\n \"2\"\n ]\n }\n ],\n \"workspace_id\": \"74581909c0265l1da4a71092\",\n \"reward\": 100,\n \"study_type\": \"SINGLE\",\n \"total_available_places\": 30,\n \"estimated_completion_time\": 1,\n \"device_compatibility\": [\n \"mobile\",\n \"tablet\"\n ],\n \"peripheral_requirements\": [\n \"audio\",\n \"microphone\"\n ],\n \"study_labels\": \"survey\"\n}") .asString(); ``` ```php request('POST', 'https://api.prolific.com/api/v1/studies/predicted-recruitment-time/', [ 'body' => '{ "filters": [ { "filter_id": "first-language", "selected_values": [ "1", "2" ] } ], "workspace_id": "74581909c0265l1da4a71092", "reward": 100, "study_type": "SINGLE", "total_available_places": 30, "estimated_completion_time": 1, "device_compatibility": [ "mobile", "tablet" ], "peripheral_requirements": [ "audio", "microphone" ], "study_labels": "survey" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/studies/predicted-recruitment-time/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"filters\": [\n {\n \"filter_id\": \"first-language\",\n \"selected_values\": [\n \"1\",\n \"2\"\n ]\n }\n ],\n \"workspace_id\": \"74581909c0265l1da4a71092\",\n \"reward\": 100,\n \"study_type\": \"SINGLE\",\n \"total_available_places\": 30,\n \"estimated_completion_time\": 1,\n \"device_compatibility\": [\n \"mobile\",\n \"tablet\"\n ],\n \"peripheral_requirements\": [\n \"audio\",\n \"microphone\"\n ],\n \"study_labels\": \"survey\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "filters": [ [ "filter_id": "first-language", "selected_values": ["1", "2"] ] ], "workspace_id": "74581909c0265l1da4a71092", "reward": 100, "study_type": "SINGLE", "total_available_places": 30, "estimated_completion_time": 1, "device_compatibility": ["mobile", "tablet"], "peripheral_requirements": ["audio", "microphone"], "study_labels": "survey" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/predicted-recruitment-time/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" 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() ```