Organization API

2026-10-22

Organization API

Base URL

Loading…

Get started

Loading…

Facts and limits

FactDetail
The organization is the keyThe caller's API key resolves to exactly one organization; no organization id appears in any path, and any valid key of the organization can read this domain
Actual charges onlyWhat the organization was actually charged, in its settlement currency (CNY or USD); promotional balance is taken before cash and is included
Column names follow FOCUS 1.3BilledCost, ServiceName, ConsumedQuantity and the rest match the FOCUS 1.3 specification verbatim
Everything is UTCWindow bounds and buckets are UTC ISO 8601; buckets align to the hour or the UTC day
Windows cap at 93 daysCosts, usage and events accept at most 93 days per query; for longer ranges use the charges export, which paginates day by day server-side
Pagination is an opaque cursorLists carry has_more and next_page; pass next_page back as page unchanged

Amounts are decimal strings (e.g. "0.001234") in the currency named by BillingCurrency on the same row (CNY or USD) — don't sum them as floats, and never add amounts of different currencies; reconcile with exact decimal arithmetic.

Only usage billed in USD from the funding account is counted here; Credits balances are not part of this domain. See Authentication for how keys work.

Endpoints

MethodPathDescriptionSupport
GET/v1/costsList costs● Supported
GET/v1/usageList usage● Supported
GET/v1/eventsList usage events● Supported
GET/v1/events/{id}Get a usage event● Supported
GET/v1/chargesExport charges● Supported

Differences from FOCUS 1.3

  • The envelope follows OpenAI's organization usage/costs, the bucketing and estimated marker follow AWS GetCostAndUsage, column names follow FOCUS 1.3, and the export follows Vercel's charges JSONL. Raw facts only: shares, trends and top-N views are not in this domain — compute them on your side.

For authoritative parameters and fields, see the spec published at /meta/v1/openapi.yaml and the FOCUS 1.3 specification.

Errors follow the problem+json format, see errors; quotas and response headers are covered in rate limits.

List costs

GET /organization/v1/costs● Supported

Official reference ↗

Request parameters

  • starting_atstring必填

    query: Window start (inclusive), UTC ISO 8601, e.g. 2026-09-26T00:00:00Z

  • ending_atstring必填

    query: Window end (exclusive), UTC ISO 8601; at most 93 days after starting_at (the charges export has no such cap)

  • bucket_widthstring必填

    query: Bucket width: 1h (aligned to the hour) or 1d (aligned to the UTC day)

    取值 1h1d
  • time_zonestring可选
    默认 "UTC"

    query: IANA time zone name (for example Asia/Shanghai) whose local hours or days form the buckets. Defaults to UTC. Offsets such as +08:00 are rejected. The window widens to whole local buckets; a day that crosses a daylight-saving change lasts 23 or 25 hours. starting_at and ending_at stay UTC instants.

  • group_byarray可选

    query: Columns to group by (repeatable): ServiceName, ServiceCategory, ResourceId, ConsumedUnit; usage always splits ConsumedUnit out server-side

  • pagestring可选

    query: The opaque cursor from the previous page's next_page — pass it back unchanged

Returns

200 page

Errors follow the problem+json format — see error codes

Response

HTTP 200

Cost page

application/json

NameTypeDescription
objectstringObject type; always `page`.
dataarray<object>Cost buckets in time order, one per hour or day of the requested window.
data[].objectstringObject type; always `bucket`.
data[].starting_atstringStart of the bucket, UTC, inclusive.
data[].ending_atstringEnd of the bucket, UTC, exclusive.
data[].estimatedbooleanAlways false; kept for the AWS GetCostAndUsage shape.
data[].resultsarray<object>Aggregates of the bucket, one entry per group requested with group_by.
has_morebooleanWhether more results exist beyond this page; request again with `page` set to `next_page` to read them.
next_pagestring | nullOpaque cursor for the next page; null on the last page. Pass it unchanged as `page`.

Response fields

FieldDescription
objectalways "page"
data[].objectalways "bucket"
data[].starting_at / data[].ending_atBucket start and end (UTC, aligned to the hour or the day)
data[].estimatedAlways false: a charge is final when it is recorded; kept to match the AWS GetCostAndUsage shape
data[].results[].ServiceNameServing service name (present only when group_by requests ServiceName)
data[].results[].ServiceCategoryFOCUS service category (present only when requested)
data[].results[].ResourceId / data[].results[].ResourceNameResource id and display name; ResourceName rides ResourceId and falls back to the id when unresolvable
data[].results[].BilledCostThe group's cost in the bucket, a decimal string in BillingCurrency
data[].results[].BillingCurrencyThe currency charged, CNY or USD; a group charged in both currencies in one bucket is two rows
has_more / next_pageWhether more pages follow; the next page's opaque cursor (null when done)

For the transactions behind one event see Get a usage event.

List usage

GET /organization/v1/usage● Supported

Official reference ↗

Request parameters

  • starting_atstring必填

    query: Window start (inclusive), UTC ISO 8601, e.g. 2026-09-26T00:00:00Z

  • ending_atstring必填

    query: Window end (exclusive), UTC ISO 8601; at most 93 days after starting_at (the charges export has no such cap)

  • bucket_widthstring必填

    query: Bucket width: 1h (aligned to the hour) or 1d (aligned to the UTC day)

    取值 1h1d
  • time_zonestring可选
    默认 "UTC"

    query: IANA time zone name (for example Asia/Shanghai) whose local hours or days form the buckets. Defaults to UTC. Offsets such as +08:00 are rejected. The window widens to whole local buckets; a day that crosses a daylight-saving change lasts 23 or 25 hours. starting_at and ending_at stay UTC instants.

  • group_byarray可选

    query: Columns to group by (repeatable): ServiceName, ServiceCategory, ResourceId, ConsumedUnit; usage always splits ConsumedUnit out server-side

  • pagestring可选

    query: The opaque cursor from the previous page's next_page — pass it back unchanged

Returns

200 page

Errors follow the problem+json format — see error codes

Response

HTTP 200

Usage page

application/json

NameTypeDescription
objectstringObject type; always `page`.
dataarray<object>Usage buckets in time order, one per hour or day of the requested window.
data[].objectstringObject type; always `bucket`.
data[].starting_atstringStart of the bucket, UTC, inclusive.
data[].ending_atstringEnd of the bucket, UTC, exclusive.
data[].estimatedbooleanAlways false; kept for the AWS GetCostAndUsage shape.
data[].resultsarray<object>Aggregates of the bucket, one entry per group requested with group_by.
has_morebooleanWhether more results exist beyond this page; request again with `page` set to `next_page` to read them.
next_pagestring | nullOpaque cursor for the next page; null on the last page. Pass it unchanged as `page`.

Response fields

FieldDescription
object / data[].objectalways "page" / always "bucket"
data[].starting_at / data[].ending_at / data[].estimatedBucket start/end (UTC) and the estimated marker (always false), same as costs
data[].results[].ServiceName / ServiceCategoryService columns (present only when requested)
data[].results[].ResourceId / data[].results[].ResourceNameResource columns; ResourceName rides ResourceId
data[].results[].ConsumedQuantityThe group's consumed quantity, a decimal string
data[].results[].ConsumedUnitThe consumption unit; different units stay on separate rows and are never added together
has_more / next_pageCursor pagination, same as costs

For the transactions behind one event see Get a usage event.

List usage events

GET /organization/v1/events● Supported

Official reference ↗

Request parameters

  • starting_atstring必填

    query: Window start (inclusive), UTC ISO 8601, e.g. 2026-09-26T00:00:00Z

  • ending_atstring必填

    query: Window end (exclusive), UTC ISO 8601; at most 93 days after starting_at (the charges export has no such cap)

  • limitinteger可选

    query: Page size, 1–100, defaults to 25

  • pagestring可选

    query: The opaque cursor from the previous page's next_page — pass it back unchanged

Returns

200 page

Errors follow the problem+json format — see error codes

Response

HTTP 200

Event page

application/json

NameTypeDescription
objectstringObject type; always `page`.
dataarray<object>Usage events, newest first.
data[].objectstringObject type; always `usage.event`.
data[].idstringId of the usage event; pass it to getOrganizationEvent.
data[].occurred_atstringTime at which the usage happened, UTC.
data[].ServiceNamestringName of the platform service that produced the usage (the source service of the usage event).
data[].ServiceCategorystringCategory of the service; a service without a registered category reports its own name.
data[].ResourceIdstringId of the resource that the usage belongs to.
data[].ResourceNamestringDisplay name of the resource; falls back to ResourceId when no name is known.
data[].BilledCoststringAmount billed in USD as an exact decimal string; unsettled usage counts as 0 until it settles.
data[].BillingCurrencystringCurrency of BilledCost; always `USD`.
data[].ChargeClassstring | null`Correction` for an event that corrects an earlier charge (its BilledCost is negative); null for ordinary usage.
data[].request_idstring | nullX-Request-Id of the API call that produced the usage; null for usage that does not come from a request.
data[].settlementobjectHow the usage was charged: settlement state, any shortfall, and why nothing was charged.
data[].linesarray<object>Metering lines mapped from the billing measurements; the priced split (ListUnitPrice, PricingUnit, BilledCost) rides only GET /events/{id}.
has_morebooleanWhether more results exist beyond this page; request again with `page` set to `next_page` to read them.
next_pagestring | nullOpaque cursor for the next page; null on the last page. Pass it unchanged as `page`.

Response fields

FieldDescription
objectalways "page"
data[].objectalways "usage.event"
data[].idThe event id — use it for the single-event lookup and reconciliation
data[].occurred_atWhen the usage happened (UTC)
data[].ServiceName / ServiceCategory / ResourceId / ResourceNameFOCUS service and resource columns
data[].BilledCost / BillingCurrencyThe event's cost (decimal string) and the currency charged (CNY or USD)
data[].ChargeClass"Correction" for correction events (negative cost), null otherwise
data[].request_idThe X-Request-Id of the API call that produced this usage — look it up in your call logs
data[].settlement.statussettled (charged) / no_charge (recorded, nothing charged) / rejected (billing refused the charge)
data[].settlement.shortfall / data[].settlement.zero_reasonCurrently always null; reserved for later settlement detail
has_more / next_pageNewest first, one cursor page at a time; pages never duplicate or skip an event

For the transactions behind one event see Get a usage event.

Get a usage event

GET /organization/v1/events/{id}● Supported

Official reference ↗

Request parameters

  • idstring必填

    path: The usage event id from the events list's data[].id

Returns

200 usage.event

Errors follow the problem+json format — see error codes

Response

HTTP 200

The usage event

application/json

NameTypeDescription
objectstringObject type; always `usage.event`.
idstringId of the usage event; pass it to getOrganizationEvent.
occurred_atstringTime at which the usage happened, UTC.
ServiceNamestringName of the platform service that produced the usage (the source service of the usage event).
ServiceCategorystringCategory of the service; a service without a registered category reports its own name.
ResourceIdstringId of the resource that the usage belongs to.
ResourceNamestringDisplay name of the resource; falls back to ResourceId when no name is known.
BilledCoststringAmount billed in USD as an exact decimal string; unsettled usage counts as 0 until it settles.
BillingCurrencystringCurrency of BilledCost; always `USD`.
ChargeClassstring | null`Correction` for an event that corrects an earlier charge (its BilledCost is negative); null for ordinary usage.
request_idstring | nullX-Request-Id of the API call that produced the usage; null for usage that does not come from a request.
settlementobjectHow the usage was charged: settlement state, any shortfall, and why nothing was charged.
settlement.statusstringSettlement state of the event.
settlement.shortfallstring | nullUSD amount that could not be charged, as a decimal string, when status is settled_with_shortfall; null otherwise.
settlement.zero_reasonstring | nullWhy nothing was charged for the event: `byok` when the caller used its own provider key; null when a charge applies.
linesarray<object>Priced lines of the event; their BilledCost values add up to the event's BilledCost.
lines[].meterstringKey of the meter that measured the line.
lines[].display_namestringEnglish label of the meter; falls back to the meter key in list pages.
lines[].ConsumedQuantitystringQuantity consumed, an exact decimal string in ConsumedUnit.
lines[].ConsumedUnitstringUnit of ConsumedQuantity as reported by the metering line; quantities of different units are never added together.
lines[].ListUnitPricestring | nullList price in USD per PricingUnit as a decimal string; null when the line is not priced.
lines[].PricingUnitstring | nullUnit that ListUnitPrice applies to; null when the line is not priced.
lines[].BilledCoststringAmount billed for this line in USD as a decimal string.
x_Chargesarray<object>The transactions that paid this event; their BilledCost sums to the event's BilledCost.
x_Charges[].transaction_idstringThe id of the billing transaction that paid part of this event.
x_Charges[].BilledCoststringAmount billed in USD as an exact decimal string; unsettled usage counts as 0 until it settles.
x_Charges[].BillingCurrencystringCurrency of BilledCost; always `USD`.
x_Charges[].sub_accountstringWhich balance the transaction was taken from.

Response fields

FieldDescription
object / id / occurred_atalways "usage.event", the event id, when it happened (UTC)
ServiceName / ServiceCategory / ResourceId / ResourceName / BilledCost / BillingCurrency / ChargeClass / request_id / settlementExactly the same fields the events list carries for this event
lines[].meter / lines[].display_nameThe meter's identifier and its English display name
lines[].ConsumedQuantity / ConsumedUnitThe line's consumed quantity and unit
lines[].ListUnitPrice / PricingUnitAlways null: an event is priced as a whole, so there is no per-line unit price
lines[].BilledCostThe line's cost, equal to the event's BilledCost
x_Charges[]The transactions that paid this event: transaction_id, BilledCost, BillingCurrency and sub_account (promotional balance or cash; promotional is taken first). They add up to the event's BilledCost

For the transactions behind one event see Get a usage event.

Export charges

GET /organization/v1/charges● Supported

Official reference ↗

Request parameters

  • starting_atstring必填

    query: Window start (inclusive), UTC ISO 8601, e.g. 2026-09-26T00:00:00Z

  • ending_atstring必填

    query: Window end (exclusive), UTC ISO 8601; at most 93 days after starting_at (the charges export has no such cap)

Returns

200

Errors follow the problem+json format — see error codes

Response

HTTP 200

FOCUS 1.3 JSONL stream

application/x-ndjson

NameTypeDescription
ChargePeriodStartstringStart of the charge period (the event time), UTC.
ChargePeriodEndstringEnd of the charge period (the event time), UTC.
BilledCoststringAmount billed in USD as an exact decimal string; unsettled usage counts as 0 until it settles.
BillingCurrencystringCurrency of BilledCost; always `USD`.
ServiceNamestringName of the platform service that produced the usage (the source service of the usage event).
ServiceCategorystringCategory of the service; a service without a registered category reports its own name.
ResourceIdstringId of the resource that the usage belongs to.
ResourceNamestringDisplay name of the resource; falls back to ResourceId when no name is known.
ConsumedQuantitystringQuantity consumed, an exact decimal string in ConsumedUnit.
ConsumedUnitstringUnit of ConsumedQuantity as reported by the metering line; quantities of different units are never added together.
ChargeCategorystringKind of charge.
ChargeClassstring | null`Correction` for an event that corrects an earlier charge (its BilledCost is negative); null for ordinary usage.
ChargeDescriptionstringText such as `<service>/<offering> usage` that says what was charged.
x_RequestIdstring | nullAlways null in the export; look up the request id of an event with getOrganizationEvent.
x_EventIdstringId of the usage event this record comes from; pass it to getOrganizationEvent.

Response fields

FieldDescription
ChargePeriodStart / ChargePeriodEndCharge period start and end (UTC)
BilledCost / BillingCurrencyThe event's cost (decimal string) and the currency charged (CNY or USD)
ServiceName / ServiceCategory / ResourceId / ResourceNameFOCUS service and resource columns
ConsumedQuantity / ConsumedUnitConsumed quantity and unit
ChargeCategoryUsage or Adjustment
ChargeClass"Correction" for corrections, null otherwise
ChargeDescriptionA human-readable description of the meter
x_RequestId / x_EventIdThe X-Request-Id of the call behind this record; the matching usage event id

For the transactions behind one event see Get a usage event.