---
title: "Calculate average balance"
method: POST
path: "/v1/accounts/{accountId}/average-balance"
tags: ["Average balance"]
---

# Calculate average balance

`POST /v1/accounts/{accountId}/average-balance`

Calculate an average balance for an account.<br>
Using this endpoint, you can specify a datetime range and calculate the [average balance](https://www.investopedia.com/terms/a/average-balance.asp) of an account over that period. This involves multiplying the balance by the number of days it has remained unchanged, summing the results, and then dividing them by the total number of days in the specified period.

## Path parameters

- `accountId` integer, required

## Headers

- `x-idempotency-key` string

## Request body

- CalculateAverageBalanceRequest
  - `account_id` number — Account identifier.
  - `begin_date_datetime` string, date-time — The specified datetime when the average balance calculation begins. The datetime is displayed in the RFC 3339 format; for example: `2024-01-28T10:33:01Z`.
  - `end_date_datetime` string, date-time — The specified datetime when the average balance calculation ends. The datetime is displayed in the RFC 3339 format; for example: `2024-01-29T10:33:01Z`.
  - `balance_types_to_calculate` string[] — Choose a balance to calculate its average balance, you can select multiple balance types to calculate their average balances simultaneously. The balance types are:<br> * `available` * `savings` * `held_funds`

## Response `202`

Accepted

- CalculateAverageBalanceResponse
  - `account_id` number — Account ID.
  - `idempotency_key` string — Idempotency key.
  - `status` 'PROCESSING' | 'COMPLETE' — Status of the average balance calculation request.
  - `message` string — Message.

## Other responses

- `400` — Bad request
- `404` — Not Found
- `409` — The specified resource status conflicts with the current request.
- `500` — Internal server error

---

[API](https://skmtc.net/pismo/apis/platform-authentication.md) · [All operations](https://skmtc.net/pismo/apis/platform-authentication/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pismo/platform-authentication/versions/935b62e16de4/schema)
