Get trigger usage Beta
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
fromstringperiod 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)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.24h7d30dtostringperiod 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.scalekit_client.actions.triggers.get_usage
Read metered trigger deliveries for a preset period or a UTC date range. Pass either period or both from_date and to_date. The server checks the combination and clamps the range to the last 30 days.
scalekit_client.actions.triggers.get_usage( period: TriggerUsagePeriod | str | None = None, from_date: date | str | None = None, to_date: date | str | None = None,) -> GetTriggerUsageResponseParameters
periodTriggerUsagePeriod | str | None"24h" (hourly counts) or "7d"/"30d" (daily counts).from_datedate | str | Nonedate, an aware datetime (its UTC date is used) or a "YYYY-MM-DD" string.to_datedate | str | NoneReturns GetTriggerUsageResponse: Daily or hourly counts and the range actually read.
From scalekit-sdk-python 2.23.0.
Response 200
bucketstring (enum)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_HOURcurrent_hourstringperiod=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 objectfrom..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
datestringunitsstringfromstringfrom 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 objectperiod=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
startstringZ) with zero minutes and seconds. The hour runs from start up to, not including, start plus one hour.unitsstringperiodstringperiod the request asked for: 24h, 7d or 30d. Empty when the request used from and to.tostringfrom and to request, the requested to, or today when the request ended later. For a period request, always today.todaystringfrom 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 refused404Not 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 request503Service unavailable - usage data could not be read right now. No partial figures are returned; retry the request later