Query an usage report
Queries usage over any time range, bucketed and grouped: the usage summary the console charts.
This method is not served on the public API.
api.sylphx.comdoes not route this call: its backend is not deployed behind the public API, or does not implement the call. This page documents the contract. It is kept out of the sidebar and of search engines.
Queries usage over any time range, bucketed and grouped: the usage summary the console charts. Reads rollups; never raw events.
Not available yet. This method answers 501 with the problem code UNIMPLEMENTED.
- Path
POST https://api.sylphx.com/v1/orgs/acme/usage_reports:query - Scope
billing:read - Effect
read— nothing is written. - Collection usage_reports
Request
| Field | Type | What it is |
|---|---|---|
parent | string | The org to query. Required. |
start_time | timestamp | The start of the range, inclusive. Required. |
end_time | timestamp | The end of the range, exclusive; at most 400 days after start_time. Required. |
granularity | UsageGranularity | The bucket width. Required. One of hour, day, period. |
projects | string[] | Only these projects; empty means every project. |
meters | string[] | Only these meter ids; empty means every meter. |
group_projects | bool | Group by project in addition to meter. |
group_dimensions | string[] | Dimension keys to group by, for example model. |
group_end_customers | bool | Group by optional opaque end-customer attribution, not a price dimension. |
Response
| Field | Type | What it is |
|---|---|---|
rows | UsageRow[] | One row per bucket and group, in time order; at most 10,000. |
completeness | double | The share of the range's usage that has reached Billing, from 0 to 1. |
compute_time | timestamp | The instant the answer reflects. |
watermarks | map<string, timestamp> | Each emitting service's watermark: the time of the oldest usage it has not yet delivered. |
UsageRow
| Field | Type | What it is |
|---|---|---|
start_time | timestamp | The start of the bucket. Output only. |
end_time | timestamp | The end of the bucket. Output only. |
project | string | The project, when grouped by project. Output only. |
meter | string | The meter id. Output only. |
dimensions | map<string, string> | The dimensions grouped on. Output only. |
quantity | int64 | The aggregated quantity, in the meter's base unit. Output only. |
service | string | The service that emits the meter. Output only. |
end_customer | string | Opaque attribution when grouped by end customer; absent for unattributed usage. Output only. |
Errors
UNAUTHENTICATED— No valid key or token was presented.PERMISSION_DENIED— The key lacks the method's permission.INVALID_FIELD— A field failed validation.
Every error arrives in the body Errors describes.
Examples
curl -X POST "https://api.sylphx.com/v1/orgs/acme/usage_reports:query" \
-H "Authorization: Bearer $SYLPHX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"end_time":{},"granularity":"hour","start_time":{}}'