Sign Up

Usage

GET
/sandboxes/{sandbox_id}/usage

Returns the latest resource measurements for a running sandbox.

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: read:sandboxes

Path Parameters

sandbox_id*string

The sandbox ID

Response Body

The sandbox usage

application/json
  1. response

Current resource use for a sandbox.

sandbox_id*string

The sandbox ID.

usage*array<>

Latest resource measurements for the sandbox.

curl -X GET 'https://example.com/sandboxes/string/usage'
{  "sandbox_id": "string",  "usage": [    {      "cpu_cores": 0.1,      "cpu_memory_available": true,      "cpu_nanoseconds": 0,      "disk_read_bytes": 0,      "disk_read_bytes_per_second": 0.1,      "disk_total_bytes": 0,      "disk_used_bytes": 0,      "disk_written_bytes": 0,      "disk_written_bytes_per_second": 0.1,      "memory_bytes": 0,      "network_received_bytes": 0,      "network_received_bytes_per_second": 0.1,      "network_sent_bytes": 0,      "network_sent_bytes_per_second": 0.1,      "sampled_at": "2019-08-24T14:15:22Z"    }  ]}
GET
/sandboxes/{sandbox_id}/usage/history

Returns resource usage in minute or hour buckets for the requested half-open time range.

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: read:sandboxes

Path Parameters

sandbox_id*string

The sandbox ID

Query Parameters

start_at?string

Start of the time range, inclusive. Defaults to 24 hours before end_at.

Formatdate-time
end_at?string

End of the time range, exclusive. Defaults to now.

Formatdate-time
resolution?string

Bucket size. Defaults to minute.

Value in"minute""hour"

Response Body

The sandbox usage history

application/json
  1. response

Historical resource usage for a sandbox.

available*boolean

Whether usage history is available. When false, periods is empty and resolution is absent.

periods*array<>

Usage buckets in chronological order.

resolution?|

Effective bucket size. Omitted when usage history is unavailable.

sandbox_id*string

The sandbox ID.

curl -X GET 'https://example.com/sandboxes/string/usage/history'
{  "available": true,  "periods": [    {      "cpu_core_seconds": 0.1,      "disk_read_bytes": 0,      "disk_used_bytes": 0,      "disk_written_bytes": 0,      "duration_ms": 0,      "memory_byte_seconds": 0.1,      "memory_peak_bytes": 0,      "network_received_bytes": 0,      "network_sent_bytes": 0,      "start_at": "2019-08-24T14:15:22Z"    }  ],  "resolution": null,  "sandbox_id": "string"}
GET
/usage/budget

Returns the project's monthly spend budget and its current status. A recent change can take up to 30 seconds to appear.

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: read:spending

Response Body

The project's spend budget

application/json
  1. response

A project's monthly spend budget and its current state.

created_at*|

When the budget was first set, or null when no budget is set.

Formatdate-time
evaluated_at?|

When spend was last evaluated in the current period. null until the first evaluation in the period.

Formatdate-time
exceeded_at?|

When the project reached its budget this period. null while the project is under its budget.

Formatdate-time
monthly_limit_cents*|

The monthly budget, in US cents, or null when no budget is set.

Formatint64
period_start_date*|

The first day of the current budget period (the calendar month in UTC), as YYYY-MM-DD.

Formatdate
spent_cents?|

Month-to-date spend at list price, in US cents, from the last evaluation in the current period. null until the first evaluation in the period.

Formatint64
stop_at?|

When running sandboxes are ended: exceeded_at plus the grace period. On the first sweep after this time, running persistent sandboxes are stopped and running ephemeral sandboxes are deleted; macOS sandboxes, which run on a prepaid Mac reservation, keep running. null when exceeded_at is null, and null when this time falls on or after the start of the next UTC month: the hold expires at the month boundary, so no sandbox is ended this period.

Formatdate-time
updated_at*|

When a member last set the budget, or null when no budget is set. Spend evaluations do not change it.

Formatdate-time
curl -X GET 'https://example.com/usage/budget'
{  "created_at": "2019-08-24T14:15:22Z",  "evaluated_at": "2019-08-24T14:15:22Z",  "exceeded_at": "2019-08-24T14:15:22Z",  "monthly_limit_cents": 0,  "period_start_date": "2019-08-24",  "spent_cents": 0,  "stop_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}
GET
/usage/report

Returns sandbox usage for the project. Changes can take up to 30 seconds to appear.

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: read:spending

Query Parameters

start_at?string

Start of the time range, inclusive. Defaults to 24 hours before end_at.

Formatdate-time
end_at?string

End of the time range, exclusive. Defaults to now.

Formatdate-time
resolution?string

Bucket size. Defaults to hour.

Value in"hour""day"

Response Body

The usage report

application/json
  1. response

Project usage over a time range.

available*boolean

Whether usage reporting is available.

end_at?|

End of the reported time range, exclusive.

Formatdate-time
items*array<>

Usage grouped by sandbox and interval.

resolution?|

Effective bucket size. Omitted when usage reporting is unavailable.

start_at?|

Start of the reported time range, inclusive.

Formatdate-time
curl -X GET 'https://example.com/usage/report'
{  "available": true,  "end_at": "2019-08-24T14:15:22Z",  "items": [    {      "interval_start_at": "2019-08-24T14:15:22Z",      "resources": {        "cpu_core_seconds": 0.1,        "disk_read_bytes": 0,        "disk_used_bytes": 0,        "disk_written_bytes": 0,        "memory_byte_seconds": 0.1,        "memory_peak_bytes": 0,        "network_received_bytes": 0,        "network_sent_bytes": 0      },      "sandbox_id": "string"    }  ],  "resolution": null,  "start_at": "2019-08-24T14:15:22Z"}