Skip to main content
GET
/
v0
/
costs
/
{id}
/
summary
Query Summary
curl --request GET \
  --url https://api.paygentic.io/v0/costs/{id}/summary \
  --header 'Authorization: Bearer <token>'
{
  "object": "cost",
  "id": "<string>",
  "name": "<string>",
  "type": "metered",
  "currency": "<string>",
  "totalCost": 123,
  "eventType": "<string>",
  "totalQuantity": 123,
  "groups": [
    {
      "dimensions": {},
      "quantity": 123,
      "cost": 123
    }
  ],
  "timeSeries": [
    {
      "windowStart": "2023-11-07T05:31:56Z",
      "windowEnd": "2023-11-07T05:31:56Z",
      "quantity": 123,
      "cost": 123
    }
  ]
}

Authorizations

Authorization
string
header
required

API key authentication

Path Parameters

id
string
required

The unique identifier of the cost Unique identifier for a cost

Pattern: ^cst_[a-zA-Z0-9]+$

Query Parameters

subject
string

Filter usage to a specific subject (billing entity). When provided, only cost events matching this subject are included. When omitted, usage is aggregated across all subjects for the merchant.

from
string<date-time>
required

Start of the query window (ISO 8601). Required together with 'to'.

to
string<date-time>
required

End of the query window (ISO 8601). Required together with 'from'.

groupBy
string

Comma-separated dimension keys to group results by.

window
enum<string>

Time window granularity for time-series breakdown.

Available options:
MINUTE,
HOUR,
DAY
filterGroupBy
string

JSON-encoded dimension filter (e.g. {"model":"gpt-4","region":"us-east"}). Keys must match those defined in the cost's groupBy configuration. Retrieve the cost first to determine valid keys.

Response

Usage and cost data

object
enum<string>
default:cost
required
Available options:
cost
id
string
required

Unique identifier for a cost

Pattern: ^cst_[a-zA-Z0-9]+$
name
string
required
type
enum<string>
required
Available options:
metered
currency
string
required
totalCost
number | null
required

Total cost for the query window. Null if usage data could not be computed.

eventType
string

CloudEvents type for metered costs.

totalQuantity
number | null

Total usage quantity (metered costs only). Null when usage was not computed.

groups
object[]

Per-group breakdown (present when groupBy is specified).

timeSeries
object[]

Time-series breakdown (present when window is specified).