temperDocs
Menu

API reference

Usage

Usage and monthly limits: metered per environment; environments are suspended when a limit is exceeded.

Usage

GET/v1/usage

Usage per environment and in total over a time range. Hosts report cumulative CPU, VMM memory, disk and egress bytes, and the control plane records hourly increments; browser_hours is computed from browser lease durations. The range defaults to this month (start of the month, UTC) through now; from must be earlier than to, otherwise 400. With environment_id, only that environment is shown (someone else's or a nonexistent one gives 404). Environments with no usage records in the range do not appear in data.

Parameters

ParameterInTypeDescription
fromquerystring (date-time)

Inclusive. Defaults to 00:00 UTC on the 1st of this month.

toquerystring (date-time)

Exclusive. Defaults to now.

environment_idquerystring

Responses

  • 200Usage Usage
  • 400Invalid parameters: validation failed, the body is not valid JSON, or the query string could not be parsed (all returned in the same JSON shape).
  • 401Missing, invalid or revoked key
  • 404Does not exist, or does not belong to this developer (`no such resource`); for a nonexistent route `message` is `no such route`
  • 500Internal error (details are recorded only in server logs)

Monthly limits

GET/v1/limits

All monthly limits (developer-level ones first), with how much has been used this month (UTC).

Responses

  • 200Limits UsageLimitList
  • 401Missing, invalid or revoked key
  • 500Internal error (details are recorded only in server logs)

Set a monthly limit

PUT/v1/limits

Without environment_id the limit is developer-level (the total across all environments); with it, the limit applies to that environment. Setting the same (environment, metric) again replaces it. A limit is exceeded when this month's usage is greater than or equal to it: an environment over its limit is suspended within a minute (limits are checked again immediately after a change), over_limit states the reason, a limit_exceeded event is recorded and an environment.limit_exceeded webhook is sent; from then on resume, wake and exec return 409 limit_exceeded until the limit is raised or deleted, or the next month begins. When a developer-level limit is exceeded, every environment that has not been destroyed is suspended. A monthly_limit of 0 means nothing is allowed at all (suspended immediately). An unknown metric or a negative monthly_limit gives 400; an environment that is not yours gives 404.

Request body application/json · SetLimitRequest

FieldTypeDescription
environment_idstring | null

Omit for developer-level.

metricrequiredUsageMetric

active_hours: hours the VM was running; cpu_hours: CPU time (hours); memory_gib_hours: VMM memory GiB × hours; storage_gib_hours: actual data disk usage GiB × hours; egress_gib: egress traffic in GiB; browser_hours: browser lease hours.

monthly_limitrequirednumber

Responses

  • 200Set SetLimitResponse
  • 400Invalid parameters: validation failed, the body is not valid JSON, or the query string could not be parsed (all returned in the same JSON shape).
  • 401Missing, invalid or revoked key
  • 404Does not exist, or does not belong to this developer (`no such resource`); for a nonexistent route `message` is `no such route`
  • 415Missing `Content-Type: application/json` (`unsupported_media_type`)
  • 422The JSON does not match the schema: a missing field, a wrong type or enum value, or an unknown field (`invalid_body`)
  • 500Internal error (details are recorded only in server logs)

Delete a monthly limit

DELETE/v1/limits

Without environment_id, deletes the developer-level limit. 404 if there is no such limit. Limits are rechecked immediately after deletion, and environments suspended because of it can be woken again.

Parameters

ParameterInTypeDescription
metricrequiredqueryUsageMetric
environment_idquerystring

Responses

  • 204Deleted
  • 400Invalid parameters: validation failed, the body is not valid JSON, or the query string could not be parsed (all returned in the same JSON shape).
  • 401Missing, invalid or revoked key
  • 404Does not exist, or does not belong to this developer (`no such resource`); for a nonexistent route `message` is `no such route`
  • 500Internal error (details are recorded only in server logs)