> ## Documentation Index
> Fetch the complete documentation index at: https://docs.infinity.swiss/llms.txt
> Use this file to discover all available pages before exploring further.

# List account balances

> Lists the balances of the chart of accounts at the end of a given date, or of a subset of accounts.

Balances are calculated within the fiscal year containing the date: balance sheet accounts start from their opening balance, while income and expense accounts start from zero at the beginning of the fiscal year. The closing entries of a fiscal year are not included, so the balances of a closed fiscal year remain meaningful.

## Balances at a date

Pass the date you are interested in to receive the balance of every account at the end of that day:

```bash theme={null}
curl "https://api.infinity.swiss/v1/accounts/balances?date=2025-06-30" \
  -H "x-api-token: your-api-token"
```

To read only some accounts, list their numbers in `accounts`:

```bash theme={null}
curl "https://api.infinity.swiss/v1/accounts/balances?date=2025-06-30&accounts=1020,1100,3200" \
  -H "x-api-token: your-api-token"
```

```json theme={null}
{
  "date": "2025-06-30",
  "fiscalYear": {
    "id": "686f1b2ce9500b3ffe4bbc71",
    "from": "2025-01-01",
    "to": "2025-12-31",
    "isClosed": false
  },
  "balances": [
    { "number": 1020, "name": "Bank", "type": "assets", "balance": 1250000 },
    {
      "number": 1100,
      "name": "Accounts receivable",
      "type": "assets",
      "balance": 430000
    },
    {
      "number": 3200,
      "name": "Revenue from services",
      "type": "income",
      "balance": 2180000
    }
  ]
}
```

## Reading the balances

* Amounts are integers in cents, so `1250000` means 12,500.00. `balance` is in CHF; foreign currency accounts additionally report their balance in their own currency under `fx`, also in cents.
* A balance is positive in the account's normal direction: a debit balance for assets and expenses, a credit balance for liabilities and income.
* Balances are calculated within the fiscal year that contains the date. Balance sheet accounts include their opening balance, while income and expense accounts count from the start of that fiscal year. A date outside every fiscal year returns `fiscal-year/not-found`.
* The closing entries of a fiscal year are left out, so the balances of a closed fiscal year still show its result.


## OpenAPI

````yaml GET /v1/accounts/balances
openapi: 3.1.0
info:
  title: infinity.swiss Open API
  version: '1.0'
  summary: ''
servers:
  - url: https://api.infinity.swiss
security:
  - apiKey: []
paths:
  /v1/accounts/balances:
    get:
      tags: []
      summary: List account balances
      description: >-
        Lists the balances of the chart of accounts at the end of a given date,
        or of a subset of accounts.


        Balances are calculated within the fiscal year containing the date:
        balance sheet accounts start from their opening balance, while income
        and expense accounts start from zero at the beginning of the fiscal
        year. The closing entries of a fiscal year are not included, so the
        balances of a closed fiscal year remain meaningful.
      operationId: find-account-balances-v1
      parameters:
        - schema:
            type: string
            format: date
          in: query
          name: date
          description: >-
            The date whose closing balances to return in YYYY-MM-DD format. Must
            lie within a fiscal year. Defaults to today.
          example: '2025-06-30'
        - schema:
            type: string
            pattern: ^\d{4}(,\d{4})*$
          in: query
          name: accounts
          description: >-
            Only return the balances of these accounts, as a comma-separated
            list of account numbers. Returns the whole chart of accounts if
            omitted.
          example: 1020,1100,3200
      responses:
        '200':
          description: >-
            The balances of the requested accounts at the end of the given date,
            sorted by account number.
          content:
            application/json:
              schema:
                type: object
                required:
                  - date
                  - fiscalYear
                  - balances
                properties:
                  date:
                    type: string
                    format: date
                    description: >-
                      The date the balances apply to in YYYY-MM-DD format. Every
                      ledger entry dated on or before this day is included.
                    example: '2025-06-30'
                  fiscalYear:
                    $ref: '#/components/schemas/FiscalYear'
                  balances:
                    type: array
                    items:
                      $ref: '#/components/schemas/AccountBalance'
        '400':
          description: A bad request is thrown if a query parameter is invalid.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                properties:
                  code:
                    type: string
                    description: >-
                      The specific error code for this request.

                      May be:

                      - `general/missing-fields` when `date` is not in
                      YYYY-MM-DD format or `accounts` is not a comma-separated
                      list of four-digit account numbers

                      - `general/invalid-date` when `date` is not a valid
                      calendar date
                  invalidFields:
                    type: array
                    description: >-
                      A list of the fields which were invalid, such as
                      `["accounts"]`.
                    items:
                      type: string
                      example: accounts
        '401':
          $ref: '#/components/responses/Unauthorised'
        '404':
          description: >-
            Returned when the date lies outside every fiscal year, or a
            requested account does not exist.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                properties:
                  code:
                    type: string
                    description: >-
                      The specific error code for this request.

                      May be:

                      - `fiscal-year/not-found` when no fiscal year contains
                      `date`

                      - `ledger/account-not-found` when an account in `accounts`
                      does not exist
                  accountNumbers:
                    type: array
                    description: >-
                      The requested account numbers that do not exist, if
                      applicable.
                    items:
                      type: integer
                      example: 1099
components:
  schemas:
    FiscalYear:
      title: FiscalYear
      type: object
      description: A fiscal year of the organisation.
      required:
        - id
        - from
        - to
        - isClosed
      properties:
        id:
          type: string
          description: A unique hex identifier for the fiscal year.
          example: 686f1b2ce9500b3ffe4bbc71
        from:
          type: string
          format: date
          description: The first day of the fiscal year in YYYY-MM-DD format.
          example: '2025-01-01'
        to:
          type: string
          format: date
          description: The last day of the fiscal year in YYYY-MM-DD format.
          example: '2025-12-31'
        isClosed:
          type: boolean
          description: >-
            Whether the fiscal year has been closed. Ledger entries can only be
            posted to open fiscal years.
    AccountBalance:
      title: AccountBalance
      type: object
      description: The balance of an account at a date.
      required:
        - number
        - name
        - type
        - balance
      properties:
        number:
          type: integer
          minimum: 1000
          maximum: 9999
          description: The four-digit account number.
          example: 1020
        name:
          type: string
          description: The name of the account.
          example: Bank
        type:
          type: string
          enum:
            - assets
            - liabilities
            - income
            - expense
          description: >-
            The type of the account, which determines the direction of its
            balance.
        balance:
          type: integer
          description: >-
            The balance in CHF cents (e.g. 125000 = 1,250.00). Positive in the
            account's normal direction: a debit balance for assets and expenses,
            a credit balance for liabilities and income. A negative balance runs
            against it, such as an overdrawn bank account.
          example: 125000
        fx:
          type: object
          description: >-
            The balance in the account's own currency. Only present for foreign
            currency accounts.
          required:
            - balance
            - currency
          properties:
            balance:
              type: integer
              description: The balance in cents of the foreign currency.
              example: 98000
            currency:
              type: string
              minLength: 3
              maxLength: 3
              description: The 3-character currency code (ISO 4217) of the account.
              example: EUR
  responses:
    Unauthorised:
      description: >-
        An unauthorised request was submitted. You may be using an incorrect or
        expired API token, or are attempting to access a document outside of the
        scope of the token.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                x-stoplight:
                  id: 08hkw8ukmi2lp
                description: Specific error code
          examples:
            Unauthorised request:
              value:
                code: general/unauthorised
  securitySchemes:
    apiKey:
      name: x-api-token
      type: apiKey
      in: header
      description: >-
        API token for authentication. Obtain from your Infinity account
        settings.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.