リファレンスHTTP APILimits & receipts

What the sessions created in a period cost and the achievements they earned

GET
/v1/usage/achievements

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 achievements the workspace's achievement rules counted for them (GET /v1/sessions/{id}/achievements). With scope=installation or me, agent_id narrows the sessions to that agent's. session_count and cost_usd are the summary's; each session's cost adds once however many achievements it has.

achievement_count counts the achievements in force whose review state is auto or confirmed; needs_review_count and rejected_count count the others. cost_per_achievement_usd is every session's cost, those without an achievement included, over achievement_count (null with none). judge_cost_usd, judge_calls and judgment_count are the judge's spend on the same sessions, apart from the sessions' cost; judgment_count counts the judgments that called the judge.

type_id and category_id narrow the achievements, never the sessions, their cost or the judge's cost. by_category, by_type and by_rule list the rows with an achievement counted or waiting for review, a category or type under its current name and a rule family once, under its latest version's category, title and version and with every version's achievements; by_agent lists every agent with a session in the period; recent the latest 20 achievements in force, rejected ones included. An achievement of a session the caller may not read (one in another owner, one not shared with the caller, or a workspace-scoped session of an agent whose managing team the caller is outside while agent_outsider_session_visibility is managing_team) is left out of recent, since a conversation's achievement carries its session's title and link; the counts still include it. The period cuts on when each session was created. 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

Counts only the sessions of this agent, any of its releases.

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
type_id?string

Counts only the achievements of this achievement type.

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
category_id?string

Counts only the achievements of this category.

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

Response Body

The figures as of refreshed_at.

application/json
  1. response
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
session_count*integer
Range0 <= value <= 9007199254740991
sessions_with_achievement_count*integer
Range0 <= value <= 9007199254740991
cost_usd*string
Match^\d+(\.\d+)?$
cost_complete*boolean
achievement_count*integer
Range0 <= value <= 9007199254740991
needs_review_count*integer
Range0 <= value <= 9007199254740991
rejected_count*integer
Range0 <= value <= 9007199254740991
judgment_count*integer
Range0 <= value <= 9007199254740991
judge_calls*integer
Range0 <= value <= 9007199254740991
judge_cost_usd*string
Match^\d+(\.\d+)?$
cost_per_achievement_usd*|null
by_category*array<>
by_type*array<>
by_rule*array<>
by_agent*array<>
recent*array<>
Itemsitems <= 20
Example Request
curl -X GET 'https://example.com/v1/usage/achievements?scope=installation&since=2019-08-24'
Example Response
{  "scope": "installation",  "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,  "sessions_with_achievement_count": 2,  "cost_usd": "4.120000",  "cost_complete": true,  "achievement_count": 2,  "needs_review_count": 0,  "rejected_count": 0,  "judgment_count": 1,  "judge_calls": 2,  "judge_cost_usd": "0.000310",  "cost_per_achievement_usd": "2.060000",  "by_category": [    {      "id": "8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",      "name": "Development",      "achievement_count": 2,      "needs_review_count": 0    }  ],  "by_type": [    {      "id": "6a7b8c9d-0e1f-4a2b-8c3d-4e5f6a7b8c9d",      "key": "pull_request",      "name": "GitHub PR",      "achievement_count": 2,      "needs_review_count": 0    }  ],  "by_rule": [    {      "id": "2f3e4d5c-6b7a-4980-8b1c-2d3e4f5a6b7c",      "family_id": "2f3e4d5c-6b7a-4980-8b1c-2d3e4f5a6b7c",      "version": 1,      "title": "Merged pull request",      "category_id": "8c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",      "category_name": "Development",      "type_id": "6a7b8c9d-0e1f-4a2b-8c3d-4e5f6a7b8c9d",      "type_key": "pull_request",      "achievement_count": 2,      "needs_review_count": 0    }  ],  "by_agent": [    {      "id": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",      "name": "backend-fixer",      "session_count": 9,      "cost_usd": "4.120000",      "achievement_count": 2,      "cost_per_achievement_usd": "2.060000"    }  ],  "recent": [    {      "id": "0b1c2d3e-4f5a-4b6c-8d7e-8f9a0b1c2d3e",      "created_at": "2026-10-30T11:03:00.000Z",      "session_id": "9a8b7c6d-5e4f-4a3b-9c2d-1e0f9a8b7c6d",      "session_title": "Orders are charged twice when payment fails",      "rule_id": "2f3e4d5c-6b7a-4980-8b1c-2d3e4f5a6b7c",      "rule_title": "Merged pull request",      "title": "acme/shop#412",      "link": "https://github.com/acme/shop/pull/412",      "evidence_kind": "github_pull_request",      "judge": "luna",      "review_state": "auto"    }  ]}