Skip to main content

Endpoint

The {accountId} path segment is the identifier of the Blaxel account that owns the workspaces you want to query. You can retrieve it from your account settings in the Blaxel Console, or by calling GET /v0/accounts. All requests must be authenticated with a Bearer token. See Access tokens for how to obtain one.

Query parameters

Required

Optional

Use the enum discovery endpoints to populate dropdowns for groupBy and resourceType values without hard-coding them.

Resolution rules

When resolution is omitted, Blaxel picks one based on the window length: Explicit values have maximum window caps to keep responses bounded: Requesting a resolution that exceeds its cap returns 400 Bad Request.

Admin-only parameters

The following two features are restricted to account admins — non-admin callers get 403 Access denied:
  • workspace=<name> — filtering to a single workspace
  • groupBy=workspace — splitting the response by workspace (including when workspace appears as one dimension in a multi-dimension groupBy, e.g. groupBy=resource_type,workspace)
Non-admin members can still query their own workspace’s data via workspace= when they are admins of the account, which is distinct from the workspace admin role. See workspace access control for more on the role model.

Billing dimensions

A billing dimension is the canonical, unit-stable metric that Blaxel bills against. Each resource type maps to one or more dimensions, and each dimension carries a single unit (gbs = GB-seconds, count = discrete events, hours = active hours).
Because different dimensions use different units, mixed-unit totals are deliberately omitted. summary.totalUsage (and per-group summary.usage) is only populated when billing_dimension is among the requested groupBy dimensions — this guarantees every row shares a single unit. This applies to both groupBy=billing_dimension alone and multi-dimension queries that include it (e.g. groupBy=billing_dimension,workspace). For groupings that do not include billing_dimension you will only see totalCost / cost in USD — the unit-safe common denominator.

Response

A successful call returns 200 OK with an AccountMetricsResponse. Example for groupBy=resource_typeusage fields are omitted per the rule above:

Top-level fields

Per-group entry

Each item in data is an AccountMetricsDataEntry. The fields populated depend on which groupBy dimension(s) were requested: When using multi-dimension groupBy, all fields from each requested dimension are populated. Additionally, metadata enrichment fills in contextual fields — for example, groupBy=resource_uuid also populates workspace, resourceName, and resourceType from the underlying data. Every entry also carries:
  • summary.cost — cost in USD for this group over the window.
  • summary.usage — usage for this group. Only populated when billing_dimension is among the requested groupBy dimensions (same unit-safety rule as the top-level summary).
  • timeseries — one entry per resolution bucket for the full window. Buckets with no activity have cost: 0. Bucket-level usage follows the same rule as group-level usage.

Pagination

Grouped responses are paginated. To request the next page, pass the nextCursor value from the previous response back as the cursor query parameter:
When meta.hasMore is false, meta.nextCursor is empty and there are no more pages. limit defaults to 100 and is capped at 100; values above the cap are silently clamped.

Enum discovery endpoints

Two helper endpoints expose the valid values for groupBy and resourceType so you can render dropdowns without baking the list into your client.

GET /v0/accounts/{accountId}/metrics/enums/group-by

Returns every valid value for the groupBy query parameter. The enum is static but exposed as an endpoint so it stays in sync automatically if new groupings are added.

GET /v0/accounts/{accountId}/metrics/enums/resource-types

Returns the distinct resource_type values actually observed for the account in the supplied window. Unlike the group-by enum, this list is dynamic: a resource type only appears once there is at least one metric event for it in range. Required query parameters: startTime, endTime (same format as the main endpoint).

Errors

Multi-dimension groupBy

You can group by multiple dimensions at once by passing a comma-separated list. For example, groupBy=resource_type,workspace returns the cross-product — one entry per unique (resource_type, workspace) combination:
Constraints:
  • Maximum 3 dimensions per query. Exceeding this returns 400 Bad Request.
  • Pagination works the same way — the cursor is opaque and handles the composite grouping internally.
  • summary.usage follows the same unit-safety rule: only populated when billing_dimension is among the requested dimensions.

Example: daily cost per resource type over 30 days

Example: hourly sandbox compute cost for the last 24 hours

Example: per-workspace breakdown (account admin only)

Example: cost per resource type per workspace (multi-dimension, admin only)

Last modified on June 6, 2026