Swagger UI openapi.json openapi.yaml
Guide

Revenue

Revenue resumes per fiscal entity with per-FE status, forward projection, and aggregated totals. Monthly-refreshed cache with premature-detection for MEI and non-MEI entities.

TL;DR

Revenue data tracks how much each fiscal entity has invoiced in the current year. The system fetches data monthly from the invoice provider, caches it, and projects whether the entity is on track for annual limits (MEI: R$ 81k, configurable for others).

Revenue resumes

A revenue resume aggregates the total invoiced amount for a fiscal entity in the current fiscal year. It includes:

  • Total invoiced — sum of all issued invoices for the year
  • Annual limit — the maximum allowed (R$ 81,000 for MEI, configurable for others)
  • Forward projection — ok / warning / danger based on current pace
  • Errored months — months where data fetch failed
  • Processing months — months currently being fetched

The cache is refreshed monthly. After a month closes, the system fetches the previous month's data from the invoice provider (eNotas). The premature-detection feature flags entities that may exceed their limit before year-end.

Per-entity queries

Revenue can be queried at different levels:

Per business

Aggregate revenue across all professionals in a business. Use /businesses/{id}/revenue.

Per professional

Revenue for a specific professional across all their fiscal entities. Use /professionals/{id}/fiscal-entity/revenue.

Per fiscal entity

Revenue for a specific CNPJ/CPF. Use /professional-fiscal-entities/revenue with filter parameters.

Status machine

Each revenue resume entry has a status that tracks the data fetch lifecycle:

none
requested
fetched

If the fetch fails:

requested
errored
  • none — no data fetched yet for this month
  • requested — data fetch has been triggered
  • fetched — data successfully retrieved and cached
  • errored — fetch failed, will be retried on next cycle

Endpoints

MethodPathPurpose
GET/businesses/{id}/revenueAggregate revenue for all professionals in a business.
GET/professionals/{id}/fiscal-entity/revenueRevenue for a specific professional across all fiscal entities.
GET/professional-fiscal-entities/revenueRevenue for specific fiscal entities. Use ?filter[fiscal_entity_id]=... to narrow.

All endpoints require Authorization: Bearer <jwt> and ilm-business: <id>.