> ## 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.

# Find ledger entries

> Finds the transactions of the ledger that match the given filters.

## Finding ledger entries

Ledger entries are returned as the individual transactions they consist of, newest first. For example, the following request returns all transactions posted to the bank account in January 2025:

```bash theme={null}
curl "https://api.infinity.swiss/v1/ledger-entries?account=1020&from=2025-01-01&to=2025-01-31" \
  -H "x-api-token: your-api-token"
```

All filters are optional and can be combined:

* `from` and `to` limit the results to a date range. Either can be used on its own.
* `account` returns transactions in which the account appears as debit or as credit account.
* `description` searches the description text of transactions.

## VAT transactions

A ledger entry posted with a tax code consists of two transactions: the net transaction and a VAT transaction booking the VAT debt. Both are returned, and they reference each other through `linkedTransactionIds`. The VAT transaction has `isVatTransaction` set to `true`, so you can filter it out if you only need the net bookings.

## Pagination

Results are paginated with `limit` (default 30, at most 200) and `skip`. To page through all results, increase `skip` by the limit until fewer results than the limit are returned.


## OpenAPI

````yaml GET /v1/ledger-entries
openapi: 3.1.0
info:
  title: infinity.swiss Open API
  version: '1.0'
  summary: ''
servers:
  - url: https://api.infinity.swiss
security:
  - apiKey: []
paths:
  /v1/ledger-entries:
    get:
      tags: []
      summary: Find ledger entries
      description: Finds the transactions of the ledger that match the given filters.
      operationId: find-ledger-entries-v1
      parameters:
        - schema:
            type: string
            format: date
          in: query
          name: from
          description: Only return transactions dated on or after this date (YYYY-MM-DD).
          example: '2025-01-01'
        - schema:
            type: string
            format: date
          in: query
          name: to
          description: Only return transactions dated on or before this date (YYYY-MM-DD).
          example: '2025-12-31'
        - schema:
            type: integer
            minimum: 1000
            maximum: 9999
          in: query
          name: account
          description: >-
            Only return transactions posted to this account number, either as
            debit or as credit account.
          example: 1020
        - schema:
            type: string
            maxLength: 128
          in: query
          name: description
          description: Only return transactions whose description contains this text.
        - schema:
            type: number
            default: 30
            maximum: 200
          in: query
          name: limit
          description: >-
            Pagination limit for the results. Defaults to 30 if not specified.
            Maximum allowed value is 200.
        - schema:
            type: number
          in: query
          name: skip
          description: Pagination offset for the results
      responses:
        '200':
          description: Successfully returns the matching transactions, newest first.
          content:
            application/json:
              schema:
                type: object
                required:
                  - transactions
                properties:
                  transactions:
                    type: array
                    description: >-
                      The transactions matching the query. Ledger entries with
                      VAT consist of a net transaction and a linked VAT
                      transaction, which are both returned.
                    items:
                      $ref: '#/components/schemas/Transaction'
        '400':
          description: >-
            A bad request is thrown if a query parameter is invalid or the limit
            exceeds the maximum allowed value.
          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 a query parameter is
                      malformed

                      - `general/invalid-date` when `from` or `to` is not a
                      valid date

                      - `general/malformed-request` when limit exceeds 200
                  invalidFields:
                    type: array
                    description: A list of the fields which were invalid, if applicable.
                    items:
                      type: string
                      example: account
        '401':
          $ref: '#/components/responses/Unauthorised'
components:
  schemas:
    Transaction:
      title: Transaction
      x-stoplight:
        id: 97x99tpfjv229
      type: object
      description: A transaction represents an accounting journal entry in the ledger.
      required:
        - id
        - date
        - debitAccount
        - creditAccount
        - description
        - amount
        - grossAmount
        - currency
      properties:
        id:
          type: string
          x-stoplight:
            id: zna9nqtheh70f
          description: A unique hex identifier for the transaction.
          example: 682338d9e9500b3ffe4baa5a
        date:
          type: string
          x-stoplight:
            id: rkpedcuqf5lqb
          description: The date for this transaction in YYYY-MM-DD format.
          format: date
          example: '2025-01-30'
        debitAccount:
          type: number
          x-stoplight:
            id: b0pwai5xgtruy
          minimum: 1000
          maximum: 9999
          description: The debit account number of this transaction.
          example: 1020
        creditAccount:
          type: number
          x-stoplight:
            id: ixoe9xvblw663
          description: The credit account number of this transaction.
          minimum: 1000
          maximum: 9999
          default: 3200
        description:
          type: string
          x-stoplight:
            id: z0x8ej74aecpd
          description: The single text-line description for this transaction.
          example: Einnahme aus Dienstleistungsverkauf
        amount:
          type: number
          x-stoplight:
            id: 4wmruda6gj23q
          example: 10050
          exclusiveMinimum: 0
          description: >-
            The net amount of this transaction in cents (e.g. 10050 = 100.50).


            If the transaction is a foreign currency transaction, this amount
            will be the converted amount in the primary currency.
        grossAmount:
          type: number
          x-stoplight:
            id: z7iyg6hnsr8ut
          description: >-
            The gross amount of this transaction in cents. Includes the VAT debt
            from its associated VAT transaction.


            For transactions without VAT, the gross amount is the same as the
            amount.
        currency:
          type: string
          x-stoplight:
            id: ksabekdr3unfk
          example: CHF
          minLength: 3
          maxLength: 3
          description: >-
            The 3-character alphanumeric currency code (ISO 4217) for the
            **converted amount** of this transaction.
        originalAmount:
          type: number
          x-stoplight:
            id: 958ry5vbzfkam
          exclusiveMinimum: 0
          description: >-
            Available for foreign currency transactions. This is the original
            gross amount of this transaction in cents (e.g. 10050 = 100.50) **in
            the original currency**.
        originalCurrency:
          type: string
          x-stoplight:
            id: igganf0t26o08
          description: >-
            The 3-character alphanumeric currency code (ISO 4217) for the
            **original amount** of this transaction.
        taxCode:
          enum:
            - UN81
            - UN77
            - UR26
            - UR25
            - US38
            - US37
            - UO81
            - UO77
            - BZB81
            - BZB77
            - BZM81
            - BZM77
            - VM81
            - VM38
            - VM26
            - VB81
            - VB38
            - VB26
            - VM77
            - VM37
            - VM25
            - VB77
            - VB37
            - VB25
            - ES81
            - ES26
            - ES77
            - ES25
            - UNO
            - UEX
            - ULA
          x-stoplight:
            id: bvikykcvio5vw
          description: >-
            The VAT tax code used for the ledger entry of this transaction. Will
            be set for both the net transaction and the VAT debt transaction.
        exchangeRate:
          type: number
          description: >-
            Available for foreign currency transactions. The exchange rate used
            to convert the original amount, as the value of one unit of the
            original currency in CHF.
          example: 0.95
        isVatTransaction:
          type: boolean
          description: >-
            Whether this transaction books the VAT of another transaction. VAT
            transactions are created automatically when a ledger entry is posted
            with a tax code.
        linkedTransactionIds:
          type: array
          description: >-
            The ids of the transactions this transaction belongs together with,
            e.g. the VAT transaction of a net transaction and vice versa.
          items:
            type: string
        receiptIds:
          type: array
          description: The ids of the receipts attached to this transaction.
          items:
            type: string
  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.

````