ReferenceHTTP APILimits & receipts

What the sessions created in a period cost and the pull requests they made

GET
/v1/usage/outcomes

The sessions GET /v1/usage/summary would count for the same scope, since, until and agent_id, read by the same callers (403 and 404 alike), with the pull requests they opened (GET /v1/sessions/{id}/outcomes). Outcomes are counted per session before the sessions are summed, so a session's cost adds once however many pull requests it opened, and a session without one still adds its cost: session_count and cost_usd are the summary's.

pr_count, merged_pr_count and closed_pr_count count the pull requests by their state as last read; sessions_with_pr and sessions_with_merged_pr count sessions. cost_per_merged_pr_usd is every session's cost over merged_pr_count (null with none merged), since the sessions without one were spent to get them too; cost_of_merged_sessions_usd is only the sessions with a merged pull request. The period cuts on when each session was created, so a pull request merged after the period still counts in it, and reading the same period later can show more merged. An unmetered session costs 0; read token_count alongside.

group_by=agent adds groups, the same figures per agent, largest cost first; id and name are null for sessions without an agent. It is refused with scope=agent. It changes nothing.

Scope: sessions:read (API key or cookie session).

Authorization

headerAuthorizationBearer <token>

For servers and scripts: an API key sent as an HTTP bearer token, Bearer <key>. It holds exactly the scopes it was issued with; a key issued before scopes existed holds none. It never needs the CSRF header, and it cannot manage agents, members, teams or API keys. Issue one in the web console under Settings → API keys; each operation names the scope it needs.

Scope: sessions:read

Query Parameters

scope*string

Whose sessions to count. The description says who may read each scope.

Value in"installation""me""agent"
since*|

Start of the period, inclusive: a date (2026-10-01, that day's 00:00 UTC) or a timestamp with an offset, moved to UTC.

until?|

End of the period, exclusive, in the same forms as since. Without it the period ends when the figures are read.

agent_id?string

With scope=agent, the agent whose sessions to count; refused with any other scope.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
group_by?"agent"

agent adds groups, the same figures per agent.

Value in"agent"

Response Body

The figures as of refreshed_at.

application/json
  1. response
session_count*integer
Range0 <= value <= 9007199254740991
cost_usd*string
Match^\d+(\.\d+)?$
cost_complete*boolean
token_count*integer
Range0 <= value <= 9007199254740991
sessions_with_pr*integer
Range0 <= value <= 9007199254740991
sessions_with_merged_pr*integer
Range0 <= value <= 9007199254740991
pr_count*integer
Range0 <= value <= 9007199254740991
merged_pr_count*integer
Range0 <= value <= 9007199254740991
closed_pr_count*integer
Range0 <= value <= 9007199254740991
cost_of_merged_sessions_usd*string
Match^\d+(\.\d+)?$
cost_per_merged_pr_usd*|null
scope*string
Value in"installation""me""agent"
period*
refreshed_at*string
Match^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
Formatdate-time
groups?array<>
Example Request
curl -X GET 'https://example.com/v1/usage/outcomes?scope=installation&since=2019-08-24'
Example Response
{  "scope": "agent",  "period": {    "since": "2026-10-01T00:00:00.000Z",    "until": "2026-10-31T00:00:00.000Z"  },  "refreshed_at": "2026-10-31T00:00:02.000Z",  "session_count": 9,  "cost_usd": "4.120000",  "cost_complete": true,  "token_count": 2104300,  "sessions_with_pr": 3,  "sessions_with_merged_pr": 2,  "pr_count": 4,  "merged_pr_count": 2,  "closed_pr_count": 1,  "cost_of_merged_sessions_usd": "1.380000",  "cost_per_merged_pr_usd": "2.060000"}