Get Account Statement Coverage

GET /api/v1/accounts/:id/coverage

Returns which days the account's uploaded statements cover, the days no statement covers, how current the account's data is, and the statements still being processed. This is the data behind the Statement Coverage timeline and the Missing Data list on the account page.

Path Parameters

ParameterTypeDescription
idstringAccount ID

Query Parameters

ParameterTypeRequiredDescription
date_fromstringNoWindow start (YYYY-MM-DD, inclusive)
date_tostringNoWindow end (YYYY-MM-DD, inclusive)

Without a window, gaps run only between the first and last statement, as on the account page. With date_from and date_to, only statements whose period overlaps the window are considered, coverage is clipped to the window, and the days before the first statement and after the last are gaps too. Give both to check that a period is complete before a close.

Example Request

curl -X GET "https://statements.finopsbricks.com/api/v1/accounts/acc123xyz/coverage?date_from=2024-01-01&date_to=2024-03-31" \
  -H "api-key: fob_stm_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"

Response

{
  "data": {
    "account_id": "acc123xyz",
    "account_name": "Main Business Account",
    "period": { "date_from": "2024-01-01", "date_to": "2024-03-31" },
    "coverage": [
      { "start": "2024-01-01", "end": "2024-01-31" },
      { "start": "2024-03-01", "end": "2024-03-20" }
    ],
    "gaps": [
      { "gap_start": "2024-02-01", "gap_end": "2024-02-29", "days": 29 },
      { "gap_start": "2024-03-21", "gap_end": "2024-03-31", "days": 11 }
    ],
    "incomplete_statements": [
      {
        "id": "stm456abc",
        "file_name": "march.pdf",
        "period_start": "2024-03-01",
        "period_end": "2024-03-20",
        "step": "create_transactions"
      }
    ],
    "upload_status": {
      "data_coverage_date": "2024-03-20",
      "last_transaction_date": "2024-03-19",
      "days_since": 12,
      "status": "ok",
      "upload_frequency": "monthly"
    }
  }
}

Response Fields

FieldTypeDescription
account_idstringThe account ID
account_namestringThe account name
period.date_fromstring|nullThe window start, or null without a window
period.date_tostring|nullThe window end, or null without a window
coveragearrayMerged statement periods { start, end }, oldest first. Overlapping periods merge; adjacent ones (Jan 31, then Feb 1) are separate entries with no gap between them
gapsarrayDays no statement covers { gap_start, gap_end, days }, oldest first; days counts both ends
incomplete_statementsarrayStatements not at the complete step (no transactions created yet): { id, file_name, period_start, period_end, step }. With a window, only those whose period overlaps it
upload_status.data_coverage_datestring|nullThe later of the last transaction date and the last statement period end, across all the account's statements
upload_status.last_transaction_datestring|nullDate of the account's newest transaction
upload_status.days_sincenumber|nullDays from data_coverage_date to today
upload_status.statusstringok, warning or overdue against the upload cadence
upload_status.upload_frequencystringThe account's upload cadence (default weekly)

A statement counts as coverage whatever its step. Check incomplete_statements: a covered day whose statement is still processing has no transactions yet.

Errors

CodeDescription
400date_from or date_to is not a YYYY-MM-DD date, or date_from is after date_to
401Invalid or missing API credentials
403API key lacks accounts:read permission
404Account not found