API ReferenceOrganization

Org usage breakdownv3.1

POST
/api/v3.1/org/usage/{entity_type}

Grouped metering usage breakdown for the authenticated organization. Groups results by a single dimension or column key. By default includes all projects; use filters.project_id to restrict.

Authorization

OrgApiKeyAuth
x-org-api-key<token>

Organization API key authentication

In: header

Path Parameters

entity_typestringRequired

Metering entity type to break down (e.g. tool_calls, sessions).

Request Body

application/json

fromnumber

Inclusive range start (Unix epoch milliseconds). Defaults to 30 days before to.

tonumber

Exclusive range end (Unix epoch milliseconds). Defaults to now.

group_bystring

Dimension or column to group results by. Defaults to tool_slug for tool_calls and user_id for sessions.

order_byenum

Field to order groups by. Defaults to total_quantity.

Possible values:
keytotal_quantityevent_count
order_directionenum

Sort direction. Defaults to desc.

Possible values:
ascdesc
limitinteger

Maximum number of groups to return. Defaults to 100, max 1000.

filtersobject

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v3.1/org/usage/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "entity_type": "string",  "unit": "string",  "total_quantity": "string",  "event_count": 0,  "groups": [    {      "key": "string",      "total_quantity": "string",      "event_count": 0    }  ]}