Aller au contenu

GET /v1/invoices/stats

GET
/v1/invoices/stats
curl --request GET \
--url https://api.asap.cool/v1/invoices/stats \
--header 'Authorization: Bearer <token>'
from
string

Inclusive lower bound (YYYY-MM-DD). Requires to.

to
string

Inclusive upper bound (YYYY-MM-DD). Requires from.

Org-scoped aggregate counts and amounts.

Media type application/json

Response body of GET /v1/invoices/stats.

object
amounts
required

Aggregated amounts (point-in-time; window-invariant).

object
aging
required

Age breakdown of overdue_cents, for the dashboard aging bar.

object
d0_30_cents
required

Overdue 1 to 30 days.

integer format: int64
d30_60_cents
required

Overdue 31 to 60 days.

integer format: int64
d60_90_cents
required

Overdue 61 to 90 days.

integer format: int64
d90_plus_cents
required

Overdue more than 90 days.

integer format: int64
collected_cents
required

Cash collected: sum of all recorded payment amounts.

integer format: int64
open_quotes_cents
required

Value of open quotes (sent/accepted, not yet converted).

integer format: int64
outstanding_cents
required

Outstanding receivable on issued, unsettled invoices (remaining balance: total_ttc minus recorded payments).

integer format: int64
overdue_cents
required

Overdue portion of the outstanding balance (due_date < today).

integer format: int64
counts
required

Per-type document counters (all-time; window-invariant).

object
acompte
required

Deposit-invoice counters.

object
total
required

Total documents, any status.

integer format: int64
avoir
required

Credit-note counters.

object
total
required

Total documents, any status.

integer format: int64
devis
required

Quote counters.

object
accepted
required

Accepted quotes.

integer format: int64
draft
required

Editable drafts.

integer format: int64
expired
required

Quotes past their validity date with no decision recorded.

integer format: int64
rejected
required

Rejected quotes.

integer format: int64
sent
required

Quotes awaiting a client decision (finalized/sent).

integer format: int64
total
required

Total quotes, any status.

integer format: int64
facture
required

Invoice counters.

object
draft
required

Editable drafts.

integer format: int64
overdue
required

Issued, unsettled invoices past their due date.

integer format: int64
paid
required

Fully settled invoices.

integer format: int64
sent
required

Issued invoices awaiting settlement (finalized/sent).

integer format: int64
total
required

Total invoices, any status.

integer format: int64
series

Daily revenue/issuance series. Empty unless both from and to are supplied; otherwise gap-filled and contiguous across the window.

Array<object>

One day of the rolling daily series (present only when the window params are supplied).

object
collected_cents
required

Cash collected that day (centimes).

integer format: int64
date
required

Calendar day (UTC), YYYY-MM-DD.

string
issued_cents
required

Total total_ttc of issued invoices dated that day (centimes) — the “émis” flow, alongside collected_cents.

integer format: int64
issued_count
required

Issued invoices (facture, non-draft) dated that day.

integer format: int64
trend
One of:
null
Example generated
{
"amounts": {
"aging": {
"d0_30_cents": 1,
"d30_60_cents": 1,
"d60_90_cents": 1,
"d90_plus_cents": 1
},
"collected_cents": 1,
"open_quotes_cents": 1,
"outstanding_cents": 1,
"overdue_cents": 1
},
"counts": {
"acompte": {
"total": 1
},
"avoir": {
"total": 1
},
"devis": {
"accepted": 1,
"draft": 1,
"expired": 1,
"rejected": 1,
"sent": 1,
"total": 1
},
"facture": {
"draft": 1,
"overdue": 1,
"paid": 1,
"sent": 1,
"total": 1
}
},
"series": [
{
"collected_cents": 1,
"date": "example",
"issued_cents": 1,
"issued_count": 1
}
],
"trend": {
"collected_cents": 1,
"collected_prev_cents": 1,
"issued_count": 1,
"issued_prev_count": 1
}
}

No active org.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}

Missing invoice:read scope.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}

Invalid window (bad date, from > to, span > 366d).

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}