Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Get trigger usage Beta

GET/api/v1/trigger-usage

This endpoint is in beta. Its request and response may change.

Gets the trigger deliveries metered for your environment. One unit is one event sent to one of your endpoints. Ask for period (24h by the hour, 7d or 30d by the UTC day), or for a range of UTC dates with from and to, up to 30 days back. Hours and days with no usage are left out, so fill the gaps with zero.

Authorization

Authorization: Bearer $TOKEN, an access token from the client credentials grant. See Authentication.

Query parameters

fromstring
First UTC calendar date to include, as YYYY-MM-DD. Inclusive. Required when period is not sent, and must be left empty when it is. Must be a real date, must not be after to, and must not be after today's UTC date. A date more than 30 days before today's UTC date is clamped to the first day of the readable window, 30 days before today.
periodstring (enum)
A preset period ending now, sent instead of from and to: exactly 24h, 7d or 30d, lowercase. 24h reads hourly counts for the 24 UTC clock hours ending with the hour in progress. 7d and 30d read daily counts for the UTC calendar days ending with today's UTC date: the week ending today, or the 30 days ending today. Leave from and to empty when this is set; when it is not, both are required.
24h7d30d
tostring
Last UTC calendar date to include, as YYYY-MM-DD. Inclusive. Required when period is not sent, and must be left empty when it is. Must be a real date and must not be more than 30 days before today's UTC date. A date after today's UTC date is clamped to today.

Response 200

bucketstring (enum)
What each entry counts. TRIGGER_USAGE_BUCKET_HOUR for period=24h, whose counts are in hours. TRIGGER_USAGE_BUCKET_DAY for period=7d and period=30d, whose counts are in days. TRIGGER_USAGE_BUCKET_UNSPECIFIED when the request used from and to; those counts are always by UTC day, in days.
TRIGGER_USAGE_BUCKET_DAYTRIGGER_USAGE_BUCKET_HOUR
current_hourstring
Only for period=24h, and empty otherwise. The start of the UTC clock hour in progress on the server, as an RFC 3339 timestamp in UTC (Z). It is the last of the 24 hours hours covers, and its count grows until the hour ends. Returned so a client lays out the 24 hours and marks the one in progress without relying on its own clock.
daysarray of object
One entry per UTC day within the range read (from..to) that has metered deliveries, oldest first. A day in that range with none is absent rather than listed as zero, so a client that needs a continuous series fills the missing days itself, over the returned from and to rather than the range it requested. Days outside the range read were not read and must not be drawn as zero. Always empty for period=24h, whose counts are in hours.
Show 2 child attributes
datestring
The UTC calendar date, as YYYY-MM-DD.
unitsstring
Trigger deliveries metered for this environment on this day: one for each trigger event sent to one receiving endpoint. Always greater than zero; a day with none is left out of the response.
fromstring
First UTC calendar date of the range read, as YYYY-MM-DD. For a from and to request, the requested from, or the first day of the readable window, 30 days before today, when the request started earlier. For a period request, the UTC date of the first hour (24h) or the first day (7d, 30d) of the period.
hoursarray of object
Only for period=24h, and empty otherwise. One entry per UTC clock hour that has metered deliveries, oldest first, among the 24 hours from 23 hours before current_hour through current_hour. An hour in that range with none is absent rather than listed as zero, so a client that needs a continuous series fills the missing hours itself over those 24 hours. Hours outside them were not read and must not be drawn.
Show 2 child attributes
startstring
The start of the UTC clock hour, as an RFC 3339 timestamp in UTC (Z) with zero minutes and seconds. The hour runs from start up to, not including, start plus one hour.
unitsstring
Trigger deliveries metered for this environment in this hour: one for each trigger event sent to one receiving endpoint. Always greater than zero; an hour with none is left out of the response.
periodstring
The period the request asked for: 24h, 7d or 30d. Empty when the request used from and to.
tostring
Last UTC calendar date of the range read, as YYYY-MM-DD. For a from and to request, the requested to, or today when the request ended later. For a period request, always today.
todaystring
The server's current UTC calendar date, as YYYY-MM-DD. Deliveries on this day are still being metered, so its count grows until the day ends. The readable window and any clamping of from and to are measured from this date. Returned so a client tells the day in progress apart from completed days without relying on its own clock.

Errors

Every error has the same body: code, message and details. See Errors and rate limits.

400Invalid request - period is not exactly 24h, 7d or 30d; period is sent together with from or to; period is not sent and from or to is missing; a date is not a real calendar date in YYYY-MM-DD form; from is after to; from is after today's UTC date; or to is more than 30 days before today's UTC date. A range that only extends past the readable window is clamped, not refused
404Not found - trigger usage is not metered for this environment (error_code TRIGGER_USAGE_NOT_METERED), or Triggers isn't turned on for your environment (error_code RESOURCE_NOT_FOUND)
500Internal error - the usage could not be read; retry the request
503Service unavailable - usage data could not be read right now. No partial figures are returned; retry the request later