---
title: "Consolidated AR aging across client workspaces"
method: POST
path: "/v1/gestoria/aging"
tags: ["Gestoria"]
---

# Consolidated AR aging across client workspaces

`POST /v1/gestoria/aging`

## Request

- Base URL: `https://api.frihet.io`
- URL: `https://api.frihet.io/v1/gestoria/aging`
- Auth: API key in header `X-API-Key`

For an accountant/gestor, returns accounts-receivable aging consolidated across the given client workspaces. Each workspaceId is authorised per-workspace: the caller must be an active accountant or owner member of that workspace, otherwise it is silently rejected and listed in rejectedWorkspaceIds (no data returned for it).

## Request body

- object
  - `workspaceIds` string[], required: Client workspace UIDs the caller manages.
  - `asOf` string, date: Reference date (YYYY-MM-DD). Defaults to today.
  - `bustCache` boolean: Honoured only by the callable CF; REST always computes fresh.

## Response `200`

Consolidated aging report

- object
  - `data` object
    - `workspaces` object[]
      - `workspaceId` string
      - `ownerName` string
      - `buckets` object
        - `current` number
        - `days1_30` number
        - `days31_60` number
        - `days61_90` number
        - `days90plus` number
      - `grandTotal` number
      - `totalOverdue` number
      - `asOf` string
      - `currency` string
      - `topDebtors` object[]
        - `clientId` string
        - `clientName` string
        - `totalOutstanding` number
        - `daysOldestInvoice` number
        - `invoiceCount` number
    - `rejectedWorkspaceIds` string[]: Workspaces the caller is not an authorised member of.
    - `consolidatedBuckets` object
      - `current` number
      - `days1_30` number
      - `days31_60` number
      - `days61_90` number
      - `days90plus` number
    - `consolidatedTotal` number
    - `consolidatedOverdue` number
    - `asOf` string
    - `generatedAt` string, date-time

## Other responses

- `400`: Bad request - invalid parameters or request body
- `401`: Authentication required or invalid API key

---

[API](https://skmtc.dev/frihet/apis/frihet-api.md) · [All operations](https://skmtc.dev/frihet/apis/frihet-api/llms.txt) · [OpenAPI document](https://skmtc.dev/frihet/apis/frihet-api/revisions/3dd37f6a72d1?raw)
