# Get the balance of a workspace GET https://api.prolific.com/api/v1/workspaces/{workspace_id}/balance/ Provides details of the funds available in the workspace. Reference: https://beta-docs.prolific.com/api-reference/workspaces/get-workspace-balance ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get the balance of a workspace version: endpoint_workspaces.GetWorkspaceBalance paths: /api/v1/workspaces/{workspace_id}/balance/: get: operationId: get-workspace-balance summary: Get the balance of a workspace description: Provides details of the funds available in the workspace. tags: - - subpackage_workspaces parameters: - name: workspace_id in: path description: Workspace 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: Success content: application/json: schema: $ref: '#/components/schemas/WorkspaceBalance' '400': description: Error content: {} components: schemas: WorkspaceBalanceBalanceBreakdown: type: object properties: {} WorkspaceBalanceAvailableBalanceBreakdown: type: object properties: {} WorkspaceBalance: type: object properties: currency_code: type: string description: >- The currency used for all financial transactions within the workspace. total_balance: type: integer description: >- The total balance of the workspace, including funds which have already been assigned to active studies. All monetary values are shown in the sub-currency of your workspace currency (e.g. pence, cents). balance_breakdown: $ref: '#/components/schemas/WorkspaceBalanceBalanceBreakdown' description: |- A breakdown of the total balance of the workspace into: - Funds available to pay to participants - Funds pre-paid to Prolific for our services - Funds for any VAT applied to our Platform fees available_balance: type: integer description: >- The remaining balance of your workspace which is available to spend, after removing funds assigned to already active studies, etc. available_balance_breakdown: $ref: '#/components/schemas/WorkspaceBalanceAvailableBalanceBreakdown' description: |- A breakdown of the available balance of the workspace into: - Funds available to pay to participants - Funds pre-paid to Prolific for our services - Funds for any VAT applied to our Platform fees ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/workspaces/workspace_id/balance/" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/workspaces/workspace_id/balance/'; 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/workspaces/workspace_id/balance/" 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/workspaces/workspace_id/balance/") 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/workspaces/workspace_id/balance/") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://api.prolific.com/api/v1/workspaces/workspace_id/balance/', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/workspaces/workspace_id/balance/"); 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/workspaces/workspace_id/balance/")! 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() ```