---
title: "Get the fiscal summary of a company"
method: GET
path: "/v1/companies/{company_id}/fiscal-summary"
tags: ["CompanyFiscalSummary"]
---

# Get the fiscal summary of a company

`GET /v1/companies/{company_id}/fiscal-summary`

## Request

- Base URL: `https://app.beel.es/api`
- URL: `https://app.beel.es/api/v1/companies/{company_id}/fiscal-summary`
- Auth: HTTP bearer

Returns the VAT and IRPF summary of the invoices issued under this company over the requested period, together with the annual IRPF projection and its progressive bracket breakdown.
`start_date` and `end_date` go together: send both, or neither. Omitting both defaults to the current month; sending only one answers `400`, because a period you did not ask for is worse than an error. The range may not exceed 365 days, and every fault names itself in `details.reason`.

## Query parameters

- `start_date` string, date
- `end_date` string, date

## Response `200`

The fiscal summary of the company for the requested period.

- object: The envelope every successful JSON response of the BeeL. API is wrapped in. There are no bare resources in v1 and none are planned: the payload always hangs off `data`. - A **single resource** is an object in `data`. - A **collection** hangs off a named key inside `data`, together with its `pagination`, also inside `data` — `data: {invoices: [...], pagination: {...}}`. - A collection carries `pagination` unless its operation declares itself a **closed catalogue**: a fixed, bounded list with nothing to page through. The declaration is explicit in the operation; a missing `pagination` is never something to infer. - `GET /v1/accounts` pages by cursor (`data: {accounts: [...], next_cursor}`). It is a documented variant of pagination, not another envelope. Putting the array straight into `data` with `pagination` as its sibling is the shape a v2 would adopt; v1 is not being flipped to it.
  - `success` boolean, required
  - `data` object, required: Comprehensive fiscal summary for a period
    - `queried_period` QueriedPeriod, required: Information about the queried period
      - `start_date` string, date, required: Period start date
      - `end_date` string, date, required: Period end date
      - `days_included` integer, required: Number of days included in the period
    - `total_taxable_base` number, double, required: Total taxable base for the period
    - `total_vat` number, double, required: Total indirect tax for the period (IVA, IGIC, IPSI and other rates), not only VAT. See tax_breakdown for the split by tax type.
    - `tax_breakdown` TaxBreakdownItem[]: Tax breakdown by type (IVA, IGIC, IPSI) and rate. Allows a single invoice to have multiple tax types.
      - `tax_type` 'IVA' | 'IGIC' | 'IPSI' | 'OTHER', required: Tax type: IVA, IGIC, IPSI, OTHER
      - `percentage` number, double, required: Tax rate percentage
      - `taxable_base` number, double, required: Taxable base for this tax type/rate
      - `tax_amount` number, double, required: Tax amount (base * rate / 100)
      - `regime_key` string: VeriFactu regime key of the rows grouped here. Rows are grouped by (tax type, rate, regime key), so an invoice mixing general-regime and OSS lines at the same rate yields TWO rows at `percentage: 21` that only this field tells apart (`01` vs `17`). Index by `(tax_type, percentage, regime_key)`, never by `(tax_type, percentage)` alone.
    - `vat_breakdown_by_rate` object: DEPRECATED: Use tax_breakdown instead. Indirect tax breakdown by rate (rate -> amount). It aggregates EVERY indirect tax (IVA, IGIC, IPSI and other rates) by percentage alone, so two different tax types at the same rate collapse into a single entry and cannot be told apart. The rate key is always rendered with three decimals ("21.000", "0.000"). `tax_breakdown` is the replacement: it keeps `tax_type` and `percentage` separate.
    - `surcharge_breakdown` SurchargeBreakdownItem[]: Equivalence surcharge breakdown by rate, aggregated over the period. Same shape as `surcharge_breakdown` in the invoice detail. Empty (or absent) when no invoice in the period carries an equivalence surcharge.
      - `type` number, double, required: Surcharge rate percentage
      - `base` number, double, required: Taxable base subject to this surcharge rate
      - `amount` number, double, required: Surcharge amount (base * rate / 100)
    - `total_equivalence_surcharge` number, double: Total equivalence surcharge for the period. It is NOT part of `total_vat`: the surcharge is settled by the retailer, not by the issuer, and `total_vat` only carries the main indirect tax.
    - `total_irpf_withheld` number, double, required: Total IRPF withheld in the period
    - `period_base` number, double, required: Taxable base for the period
    - `projected_annual_base` number, double, required: Projected annual taxable base
    - `estimated_annual_irpf` number, double, required: Estimated annual IRPF based on projected income
    - `pending_annual_irpf` number, double, required: Pending annual IRPF (estimated - retained)
    - `bracket_details` IrpfBracket[], required: IRPF breakdown by tax brackets
      - `base_from` number, double, required: Lower bound of taxable base
      - `base_to` number, double, nullable: Upper bound of taxable base (null for unlimited)
      - `rate_percentage` number, double, required: Tax rate percentage for this bracket
      - `applicable_base` number, double, required: Portion of income falling in this bracket
      - `amount` number, double, required: Tax amount for this bracket
    - `invoices` InvoiceFiscalData[]: List of invoices included in the calculation
      - `id` string, uuid, required: Invoice ID
      - `invoice_number` string, required: Invoice number
      - `issue_date` string, date, required: Issue date
      - `customer_name` string: Customer name
      - `taxable_base` number, double, required: Taxable base
      - `total_vat` number, double, required: Total indirect tax amount (IVA, IGIC, IPSI and other rates), not only VAT. See tax_breakdown for the split by tax type.
      - `total_irpf` number, double, required: IRPF withholding amount
      - `invoice_total` number, double, required: Total invoice amount
    - `total_invoices` integer, required: Total number of invoices
  - `meta` ResponseMeta
    - `timestamp` string, date-time
    - `request_id` string

## Other responses

- `400`: The request target is malformed: a date that is not `YYYY-MM-DD`, or a range that is not a period. A range fault names itself in `details.reason`: - `PERIOD_INVERTED` — `start_date` is after `end_date` - `PERIOD_TOO_LONG` — the range exceeds `details.max_days` (365) - `PERIOD_INCOMPLETE` — only one of `start_date` / `end_date` was supplied `details` also echoes whichever of `start_date` and `end_date` was received. These are query parameters, so the fault is in the request target and the status is `400`, not `422`.
- `401`: Missing or invalid authentication. Like every other error, `message`/`detail` is localized according to `Accept-Language` (`es`, `en`, `ca`); defaults to English when the header is missing or asks for none of those.
- `403`: Authenticated but not allowed. Fourteen causes shared by every operation, told apart by `error.code`; an operation that adds a cause of its own names it in its `403`. You can branch on them exhaustively. - `INSUFFICIENT_SCOPE` — the credential lacks a scope the operation requires; `error.details.missing_scopes` names them as a single comma-separated string (for example `"invoices:write,customers:read"`), not as an array; `required_scopes` has the same shape and lists every scope the operation needs. Retrying will not help: mint a key that holds them. - `COMPANY_READ_ONLY` — the scope is there, but your access level over that NIF only lets you read it. - `ACCOUNT_MANAGEMENT_FORBIDDEN` — the scope is there, but your role over the account, or the management relationship you hold over it, does not cover this operation. - `ACCOUNT_NOT_ACCESSIBLE` — the account is not yours to reach, which is also the answer when it does not exist, so existence is never disclosed. - `ACTIVE_COMPANY_NOT_ACCESSIBLE` — the same, for a NIF: the company in the path, or the one named by `BeeL-Active-Company`, is not one this credential may reach — and again, this is also the answer when it does not exist. - `COMPANY_ACCESS_REVOKED` — your access to the NIF was withdrawn while the request was already in flight, so the write was rejected and nothing was recorded. Retrying will not help until the access is granted again. - `LIVE_CREDENTIAL_REQUIRED` — the operation changes the real account and the call came from a test API key (`beel_sk_test_…`). Use your live key or the dashboard. - `FEATURE_NOT_AVAILABLE` — your subscription does not include the entitlement the operation needs; `error.details.feature_code` names it. This gate runs **before** the scope gate, so for such an operation you never see `INSUFFICIENT_SCOPE` first. - `NO_ACTIVE_ACCOUNT` — the credential does not resolve to an account, so no scope can be evaluated against one. Fail-closed, not a permission that can be granted to you. - `OPERATION_REQUIRES_SESSION` — the operation is available only from the web session; no API key and no OAuth2 token can perform it, whatever scopes it holds. - `OPERATION_REQUIRES_API_KEY` — the reverse: the operation needs a scope that only an API key can hold (such as `accounts:write`), so a dashboard session never satisfies it. - `API_KEY_LIVE_NOT_AVAILABLE` — the call came with a live API key (`beel_sk_live_…`) and the account has no Live mode yet. It is never degraded to Test: use your test key, or activate Live first. - `ACCOUNT_REQUIRES_FOCUS_SWITCH` — dashboard session only: you are a member of the account in the path, but it is not the account in focus. Switch focus to it and retry. - `REQUEST_BLOCKED` — the edge security filter stopped the request before the API saw its body, usually because a text field carries something that looks like markup or a script (HTML tags, `<script>`). Review the body and retry.
- `429`: Rate limit exceeded. `RATE_LIMIT_EXCEEDED` when the request rate of your credential is over its limit; `TOO_MANY_REQUESTS` when an email the operation sends is held back because too many went out to that recipient in a short time. Either way, retry after the `Retry-After` seconds. `QUOTA_EXCEEDED` is the other `429`: the operation would go over a quota of your plan for the current period (issued invoices, for instance). Retrying does not help until the quota resets or the plan changes. `error.details` carries `feature_code`, `current_usage`, `quota_limit` and `reset_date`, and `RateLimit-Reset` the seconds until the reset when it is known.
- `500`: Internal server error
- `default`: Any status code the operation does not list above. Every operation declares it, so a generated client always has a branch to fall into and never loses the cause of a failure it did not anticipate. This is where the transport-level answers land — `405`, `406`, `415` and `429` — together with any status a future version of the API starts returning. All of them carry the same error envelope as the codes listed explicitly, so `error.code` is what tells them apart: switching on the status code alone is not enough. See «Transport-level errors» in the API description for when each one is produced. A `402` carrying `SUBSCRIPTION_REQUIRED` lands here when the account has no active subscription. `error.details` says why and what to do: `current_status` (absent if it never had one), `required_permission` and `action`. A `503` carrying `SERVICE_UNAVAILABLE` lands here too, with a `Retry-After` header: a dependency of BeeL itself (the database, the email provider) was momentarily unavailable and nothing was done. Retry after those seconds. A `502` carrying `EXTERNAL_SERVICE_ERROR` also lands here: an outbound integration the operation depends on failed or did not answer in time. It is a transient condition — retry with the same `Idempotency-Key` where the operation accepts one. One exception to the envelope: a failure of the network edge that never reaches the application (`502`, `503`, `504`, `524`) is generated by Cloudflare and its body is not BeeL's — it may not even be JSON. Treat those as "no answer", and retry.

---

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