---
title: "Retrieve invoicing statistics per company"
method: GET
path: "/accounts/{account}/companies/stats"
tags: ["Companies"]
---

# Retrieve invoicing statistics per company

`GET /accounts/{account}/companies/stats`

## Request

- Base URL: `https://api.factuarea.com/v1`
- URL: `https://api.factuarea.com/v1/accounts/{account}/companies/stats`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Return one `company_stats` row per company of the account that your credential reads, with `invoices_count`, `total_invoiced` and `last_invoice`.
- Period is `date_from`/`date_to` (`YYYY-MM-DD`, inclusive); default is the current calendar year.
- Not paginated: `has_more` is always `false`. A bad date or range returns 422 `invalid_param_value`.

## Path parameters

- `account` string, uuid, required

## Query parameters

- `date_from` string, date
- `date_to` string, date

## Headers

- `Factuarea-Version` string, date

## Response `200`

`AccountNifStatsListV1Resource`

- object: Invoicing statistics of every company (tax ID) your credential reads in the account (`{ data, has_more, next_cursor }`). Not paginated: an account holds a bounded set of companies, so `has_more` is always `false` and `next_cursor` always `null`.
  - `data` object[], required: One row per company of the account your credential reads (active and inactive; archived ones are not included).
    - `object` 'company_stats', required: Always `company_stats`.
    - `company_id` string, uuid, required: Public identifier (UUID v7) of the company, the same `id` as in `GET /v1/accounts/{account}/companies`.
    - `tax_id` string, required: Spanish fiscal identifier (NIF/CIF/NIE) of the company.
    - `name` string, required: Commercial name of the company.
    - `invoices_count` integer, required: Issued invoices of the period: sent, paid and overdue. Drafts, annulled and cancelled invoices are not counted.
    - `total_invoiced` string, required: What those invoices invoice (paid plus pending), in euros as a 2-decimal string.
    - `last_invoice` object, nullable, required: The last issued invoice of the company regardless of the period, or `null` when it has not issued any yet.
      - `number` string, required: Invoice number.
      - `issued_on` string, date, required: Issue date (ISO 8601 date), the same name as in the invoice resource.
      - `total` string, required: Invoice total in euros as a 2-decimal string.
  - `has_more` boolean, required: Always `false`: the whole list is returned in one response.
  - `next_cursor` string, nullable, required: Always `null`: there is no next page.

## Other responses

- `400`: `parameter_unknown` with `subcode` `retired_active_profile_header`: the retired `X-Active-Profile` header was sent; the company goes in the path. `parameter_invalid_format` on `Factuarea-Version`: the header is not a `YYYY-MM-DD` date. `unsupported_api_version`: the `Factuarea-Version` date is not a supported version.
- `401`: Missing or invalid API key.
- `403`: The request is authenticated but not allowed: the API key lacks the required scope (`insufficient_scope`), the plan does not include the public API or this feature (`addon_not_active`, `feature_not_available_in_plan`), or the module is not available with a test key (`module_not_available_in_sandbox`).
- `404`: The requested resource does not exist or belongs to another company. `account_not_found`: the account in the path does not exist or is not the account of the API key.
- `422`: Validation failed. The `error.param` field identifies which input is invalid.
- `429`: Rate limit exceeded. Retry after the duration in `Retry-After`.
- `500`: Unexpected server error.

---

[API](https://skmtc.dev/factuarea/apis/factuarea-public-api.md) · [All operations](https://skmtc.dev/factuarea/apis/factuarea-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/factuarea/apis/factuarea-public-api/revisions/718e77934422?raw)
