# Calculate reward recommendations GET https://api.prolific.com/api/v1/reward-recommendations/ Calculate the recommended participant reward rates for a data collection, optionally based upon a given set of filters Reference: https://beta-docs.prolific.com/api-reference/reward-recommendations/calculate-reward-recommendations ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Calculate reward recommendations version: endpoint_rewardRecommendations.CalculateRewardRecommendations paths: /api/v1/reward-recommendations/: get: operationId: calculate-reward-recommendations summary: Calculate reward recommendations description: >- Calculate the recommended participant reward rates for a data collection, optionally based upon a given set of filters tags: - - subpackage_rewardRecommendations parameters: - name: workspace_id in: query description: The ID of the workspace in which you'll be creating the study required: true schema: type: string - name: currency in: query description: >- An ISO 4217 currency code. Note that we only support a selection of currency codes as per the enum values. required: true schema: $ref: >- #/components/schemas/ApiV1RewardRecommendationsGetParametersCurrency - name: screener_ids in: query description: >- A URL-encoded, comma-delimited list of filter IDs (e.g. custom group filter IDs) that you plan to apply to your study. There are various methods of converting an array of filter IDs to a URL-encoded, comma delimited array e.g: JavaScript: ```js const screenerIDs = ["mandarin", "spanish"]; const encodedScreenerIDs = encodeURIComponent(screenerIDs.join(",")); const url = `https://api.prolific.com/api/v1/reward-recommendations?screener_ids=${encodedScreenerIDs}&workspace_id=¤cy=GBP` ``` Python: ```python import urllib.parse screener_ids = ["mandarin", "spanish"] encoded_screener_ids = urllib.parse.quote(",".join(screener_ids)) url = f"https://api.prolific.com/api/v1/reward-recommendations?screener_ids={encoded_screener_ids}&workspace_id=¤cy=GBP" ``` required: false schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: > A list of reward recommendations. We suggest using the first recommendation in the list as this is guaranteed to be the most recent set of reward rates. content: application/json: schema: $ref: '#/components/schemas/RewardRecommendationsResponse' '400': description: Error content: {} components: schemas: ApiV1RewardRecommendationsGetParametersCurrency: type: string enum: - value: USD - value: GBP RewardRecommendationsResponseItemsCurrency: type: string enum: - value: USD - value: GBP RewardRecommendationsResponseItems: type: object properties: currency: $ref: '#/components/schemas/RewardRecommendationsResponseItemsCurrency' description: >- An ISO 4217 currency code. Note that we only support a selection of currency codes as per the enum values. min_reward_per_hour: type: integer description: > The **minimum** hourly reward rate that we recommend you pay to your study's participants. **Note that** this is returned as the hundredth subunit of the given currency i.e: * for USD, this will be the value in cents * for GBP, this will be the value in pence To display this as USD or GBP respectively, you'll need to divide this value by 100 and use an appropriate number formatting API e.g: JavaScript: ```js new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(2000/ 100); // "$20.00" ``` recommended_reward_per_hour: type: integer description: > The **good** hourly reward rate that we recommend you pay to your study's participants. **Note that** this is returned as the hundredth subunit of the given currency i.e: * for USD, this will be the value in cents * for GBP, this will be the value in pence To display this as USD or GBP respectively, you'll need to divide this value by 100 and use an appropriate number formatting API e.g: JavaScript: ```js new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(2000/ 100); // "$20.00" ``` RewardRecommendationsResponse: type: array items: $ref: '#/components/schemas/RewardRecommendationsResponseItems' ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/reward-recommendations/" querystring = {"workspace_id":"workspace_id","currency":"USD"} headers = {"Authorization": ""} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/reward-recommendations/?workspace_id=workspace_id¤cy=USD'; 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/reward-recommendations/?workspace_id=workspace_id¤cy=USD" 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/reward-recommendations/?workspace_id=workspace_id¤cy=USD") 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/reward-recommendations/?workspace_id=workspace_id¤cy=USD") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://api.prolific.com/api/v1/reward-recommendations/?workspace_id=workspace_id¤cy=USD', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/reward-recommendations/?workspace_id=workspace_id¤cy=USD"); 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/reward-recommendations/?workspace_id=workspace_id¤cy=USD")! 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() ```