Docs API reference Usage reports

Usage reports

Generate usage reports for your customer for the specified time period.

GET https://appapi.heymantle.com/v1/usage_metrics/:id/report

The Usage Report object

A structured report of the usage events for a customer’s account for the specified time period.

Header parameters

X-Mantle-App-Idstring

The App Id when you create an API key in your Mantle dashboard.

X-Mantle-Customer-Api-Tokenstring

The API token you receive from your POST request to the /identify endpoint.

Attributes

startDatedate

The start date of the report.

endDatedate

The end date of the report.

periodenum

The period of the report. One of daily, weekly, or monthly.

data[object]

An array of usage report data, with date and value parameters, where value is the result of the usage metric.

{ "usageReport": { "startDate": "2024-01-01T00:00:00Z", "endDate": "2024-12-31T23:59:59Z", "period": "monthly", "data": [ { "date": "2024-01-01T00:00:00Z", "value": 5612.1 }, { "date": "2024-02-01T00:00:00Z", "value": 7227.1 } ] } }


GET /v1/usage_metrics/:id/report

Generate a usage report for your customer’s account for the specified time period.

Header parameters

X-Mantle-App-Idstring

The App Id when you create an API key in your Mantle dashboard.

X-Mantle-Customer-Api-Tokenstring

The API token you receive from your POST request to the /identify endpoint.

Request parameters

:idstring

The unique identifier for the Usage Metric.

periodenum

(Required) The period of the report. One of daily, weekly, or monthly.

startDatedate

(Optional) The start date of the report. If not provided, the start date will be the end date minus 30 days, 12 weeks, or 12 months depending on the period. The difference between the start and end date cannot be larger than 90 days, 12 weeks, or 12 months respectively, depending on the period.

endDatedate

(Optional) The end date of the report. If not provided, the end date will be the start date plus 30 days, 12 weeks, or 12 months depending on the period. The difference between the start and end date cannot be larger than 90 days, 12 weeks, or 12 months respectively, depending on the period.

curl --request GET \ --url https://appapi.heymantle.com/v1/usage_metrics/123/report \ --header 'X-Mantle-App-Id: string' \ --header 'X-Mantle-Customer-Api-Token: string' \ --header 'Content-Type: application/json' \ --data ' { "period": "monthly", } '

Returns a Usage Report for the specified time period.