financialAnalytics
Requires at least one of the permissions analytics:invoices:read or analytics:payments:read.
Financial analytics for a period. Limited to the customers you may see.. Needs the invoices or payments analytics read permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query FinancialAnalytics($period: AnalyticsPeriod!) {
financialAnalytics(period: $period) {
accountsPayable
accountsReceivable
cashFlow
expenses
grossMargin
profit
profitByCategory {
categoryName
categoryId
cost
margin
profit
revenue
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query FinancialAnalytics($period: AnalyticsPeriod!) {\n financialAnalytics(period: $period) {\n accountsPayable\n accountsReceivable\n cashFlow\n expenses\n grossMargin\n profit\n profitByCategory {\n categoryName\n categoryId\n cost\n margin\n profit\n revenue\n }\n }\n}",
"variables": {
"period": "LAST_6_MONTHS"
}
}
EOF
Variables:
{
"period": "LAST_6_MONTHS"
}
Response:
{
"data": {
"financialAnalytics": {
"accountsPayable": 0,
"accountsReceivable": 0,
"cashFlow": 0,
"expenses": 0,
"grossMargin": 0,
"profit": 0,
"profitByCategory": [
{
"categoryName": "string",
"categoryId": "string",
"cost": 0,
"margin": 0,
"profit": 0,
"revenue": 0
}
]
}
}
}
financialAnalytics(
currency: String
period: AnalyticsPeriod!
): FinancialAnalytics!
Arguments
financialAnalytics.currency ● String scalar
Does not change the figures: totals are always reported in the organization's base currency.
financialAnalytics.period ● AnalyticsPeriod! non-null enum
The reporting period to analyse.
Type
FinancialAnalytics object
Financial figures for the period.