# Calculate the study cost POST https://api.prolific.com/api/v1/study-cost-calculator/ Content-Type: application/json Calculate the study cost, including VAT and fees. Reference: https://beta-docs.prolific.com/api-reference/studies/calculate-study-cost ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Calculate the study cost version: endpoint_studies.CalculateStudyCost paths: /api/v1/study-cost-calculator/: post: operationId: calculate-study-cost summary: Calculate the study cost description: Calculate the study cost, including VAT and fees. tags: - - subpackage_studies parameters: - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: Calculated total cost content: application/json: schema: $ref: '#/components/schemas/StudyCostResponse' '400': description: Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/StudyCostRequest' components: schemas: StudyCostRequest: type: object properties: reward: type: number format: double description: >- How much are you going to pay the participants in cents. We use the currency of your account total_available_places: type: number format: double description: How many participants are you looking to recruit required: - reward - total_available_places StudyCostResponse: type: object properties: total_cost: type: number format: double description: >- Total cost of the study including VAT and fees in cents. We use your account VAT and Fee percentage. The amount is in your account's currency. required: - total_cost ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/study-cost-calculator/" payload = { "reward": 100, "total_available_places": 5 } 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/study-cost-calculator/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"reward":100,"total_available_places":5}' }; 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/study-cost-calculator/" payload := strings.NewReader("{\n \"reward\": 100,\n \"total_available_places\": 5\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/study-cost-calculator/") 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 \"reward\": 100,\n \"total_available_places\": 5\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/study-cost-calculator/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"reward\": 100,\n \"total_available_places\": 5\n}") .asString(); ``` ```php request('POST', 'https://api.prolific.com/api/v1/study-cost-calculator/', [ 'body' => '{ "reward": 100, "total_available_places": 5 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/study-cost-calculator/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"reward\": 100,\n \"total_available_places\": 5\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "reward": 100, "total_available_places": 5 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/study-cost-calculator/")! 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() ```