Metrics API
Pre-Requisites
To use the metrics endpoint, make sure:
The accounting information you're fetching the metrics from is connected to an accounting integration.
If you want to use custom metrics, make sure you have an accounting.xlsx file uploaded to your WebDAV server.
Alternatively, you can also use our default metrics if they suit your needs - you can find a list at the end of this page.
Metrics API Endpoint
To fetch data available from the metrics endpoint, you have to make a GET request to the following URL:
https://{subdomain}.{domain}/api/metrics?start={startDate}&end={endDate}&refresh={refresh}
Where:
Variable | Description |
---|---|
subdomain | The subdomain of the account to get the metrics from |
domain | |
startDate | (Optional) The start date for the metric series |
endDate | (Optional) The end date for the metric series |
refresh | (Optional) Possible values are yes or no (default). If refresh is set to yes, data will be fetched from the source application even when cached data is available |
A successful request will return a response similar to the example below. The “metrics” object contains all the metrics configured on the Excel spreadsheet for the a given account.
It is best to assume that overtime metrics may be modified by the customer which will result in different metrics being returned in the metrics property of the result, your code should be designed to handle this change.
{
"end": "2021-04-31",
"start": "2021-01-31",
"metrics": {
"gross_income": {
"label": "Gross Income",
"format": "\"$\"#,##0.00",
"series": {
"2022-01-31": 25973.45,
"2022-02-28": 22573.45,
"2022-03-31": 68001.9,
"2022-04-30": 30973.45,
"2022-05-31": 50973.45,
"2022-06-30": 0
},
"comment": "",
"description": ""
},
"current_ratio": {
"label": "Current Ratio",
"format": "0.00",
"series": {
"2022-01-31": 6.444373122980516,
"2022-02-28": 6.467820283927578,
"2022-03-31": 3.022120085091376,
"2022-04-30": 3.07833126725232,
"2022-05-31": 3.2018274290984268,
"2022-06-30": 1.6669570820900634
},
"comment": "",
"description": ""
}
},
"sources": [
"quickbooks",
"chargebee",
"salesforce"
],
"timestamp": "2022-03-16T00:39:31+00:00",
"isReconciled": false,
"lastReconciled": "2021-01-31"
}
The format
property follows the ECMA-376 18.8.30 standard (aka the number formatting codes used by MS Excel).
Custom Metrics
To make custom metrics, please visit our tutorial: How To Create Custom Metrics.