Aller au contenu

GET /v1/invoices/revenue

GET
/v1/invoices/revenue
curl --request GET \
--url 'https://api.asap.cool/v1/invoices/revenue?from=example&to=example' \
--header 'Authorization: Bearer <token>'
from
required
string

Inclusive lower bound (YYYY-MM-DD, required).

to
required
string

Inclusive upper bound (YYYY-MM-DD, required).

basis
string

Revenue basis (cash_collected (default) / invoiced_revenue / signed_revenue / pipeline_revenue).

contact_id
string format: uuid

Narrow the report to a single contact, when set.

group_by
string

Bucket grouping. month returns YYYY-MM buckets; omitted returns none.

Pre-computed revenue for the window.

Media type application/json

Response body of GET /v1/invoices/revenue.

object
buckets
required

Monthly buckets, empty unless group_by=month.

Array<object>

One YYYY-MM bucket of a grouped revenue report.

object
period
required

Calendar month, YYYY-MM.

string
total_cents
required

Bucket total (centimes).

integer format: int64
excluded_documents
required

Documents dated in the window but not counted, with a reason.

Array<object>

One document dated in the window but not counted, with the reason why.

object
number

Document number, None for an un-numbered draft.

string | null
reason
required

Reason code: quote_not_paid/not_paid/draft/cancelled/ rejected/credit_note.

string
included_documents
required

Documents counted toward the total.

Array<object>

One document counted toward the total.

object
amount_cents
required

Amount summed for this row (centimes).

integer format: int64
contact_name

Displayable contact name, None when the contact has vanished.

string | null
date
required

The dated dimension of the basis (YYYY-MM-DD).

string
number

Document number, None for an un-numbered draft.

string | null
status
required

Lifecycle status.

string
type
required

Document kind (devis/facture/avoir/acompte).

string
period
required

The window.

object
from
required

Inclusive lower bound (YYYY-MM-DD).

string
to
required

Inclusive upper bound (YYYY-MM-DD).

string
revenue_basis
required

Basis the figures total on.

string
total_cents
required

Total over the window (centimes); equals the sum of included_documents.

integer format: int64
Example generated
{
"buckets": [
{
"period": "example",
"total_cents": 1
}
],
"excluded_documents": [
{
"number": "example",
"reason": "example"
}
],
"included_documents": [
{
"amount_cents": 1,
"contact_name": "example",
"date": "example",
"number": "example",
"status": "example",
"type": "example"
}
],
"period": {
"from": "example",
"to": "example"
},
"revenue_basis": "example",
"total_cents": 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/basis/group_by.

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"
}