---
title: "Aged debtors report"
method: GET
path: "/companies/{companyId}/reports/agedDebtor"
tags: ["Accounts receivable"]
---

# Aged debtors report

`GET /companies/{companyId}/reports/agedDebtor`

Returns aged debtors report for company that shows the total outstanding balance due from customers to the business over time.

## Query parameters

- `reportDate` string, date
- `numberOfPeriods` integer
- `periodLengthDays` integer

## Response `200`

OK

- AccountingAgedDebtorReport — The Aged Debtors report shows the total outstanding balance due from customers to the business over time. You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. Total assets or liabilities are grouped into 30-day periods for each customer, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. > It is not guaranteed that write-offs are included in the Aged Debtors report. ## Underlying data The Aged Debtors report is generated from a set of required data types: [Customers](https://docs.codat.io/lending-api#/schemas/Customer), [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice), [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote), and [Payments](https://docs.codat.io/lending-api#/schemas/Payment). To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. > The Aged Debtors report runs based on the **issue dates** of the underlying data types rather than the due date. ## Accessing the Aged Debtors report in Portal Apart from returning the report via the API as JSON and query, you can also return the Aged Debtors report in the Codat portal. 1. In the navigation bar, click **Companies**. 2. Click the name of the company you want to generate the report for. The company's data page is displayed. 3. Click the **Accounting** tab then click **Reports**. 4. Select **Aged Debtors**. 5. _(Optional)_ Edit the default reporting parameters. a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). 6. To run the report, click **Load aged debtors**. 7. The report is generated and displayed at the bottom of the page. The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding invoices or credit notes.
  - `generated` string — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
  - `reportDate` string — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
  - `data` AgedDebtor[] — Array of aged debtors. — unresolved $ref

## Other responses

- `401` — Your API request was not properly authorized.
- `402` — An account limit has been exceeded. The type of limit is described in the error property: - You have exceeded the 50-company limit that applies to a Free plan. Delete any companies you no longer need and retry the request. - The requested sync schedule is not allowed. You requested an hourly sync schedule but this functionality is not included in the Free plan. - Your Free account is older than 365 days and has expired. Contact support@codat.io.
- `403` — You are using an outdated API key or a key not associated with that resource.
- `404` — One or more of the resources you referenced could not be found. This might be because your company or data connection id is wrong, or was already deleted.
- `429` — Too many requests were made in a given amount of time. Wait a short period and then try again.
- `500` — There is a problem with our server. Please try again later.
- `503` — The Codat API is temporarily offline for maintenance. Please try again later.

---

[API](https://skmtc.net/codatio/apis/lending.md) · [All operations](https://skmtc.net/codatio/apis/lending/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/codatio/lending/revisions/791e242d1faf/schema)
