Skip to main content
PATCH
/
v0
/
billableMetrics
/
{id}
Update
curl --request PATCH \
  --url https://api.paygentic.io/v0/billableMetrics/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "description": "<string>",
  "name": "<string>",
  "unit": "<string>",
  "eventType": "<string>",
  "valueProperty": "<string>",
  "groupBy": {},
  "eventFrom": "2023-11-07T05:31:56Z"
}
'
{
  "id": "bm_u3v4w5x6y7z8a9b0",
  "object": "billableMetric",
  "aggregation": "SUM",
  "createdAt": "2024-02-01T14:45:30Z",
  "description": "Language model token consumption",
  "merchantId": "org_c1d2e3f4g5h6i7j8",
  "name": "LLM Tokens",
  "productId": "prod_k9l0m1n2o3p4q5r6",
  "unit": "tokens",
  "updatedAt": "2024-03-15T11:30:00Z"
}

Authorizations

Authorization
string
header
required

API key authentication

Path Parameters

id
string
required

Unique identifier for a billable metric

Body

application/json
description
string

Revised explanation of what the metric represents. Sample values: 'Language model token consumption', 'Database storage capacity used', 'Machine learning prediction API calls', 'AI-generated content items'

name
string

Updated label for the metric. Sample values: 'LLM Tokens', 'Database Storage', 'Prediction Requests', 'Content Generations'

unit
string

Updated measurement unit. Common examples: 'tokens', 'GB', 'requests', 'items', 'hours'

eventType
string | null

CloudEvents type for meter routing.

valueProperty
string | null

JSONPath to extract numeric value from event data.

groupBy
object

Map of dimension name to JSONPath for group-by queries.

eventFrom
string<date-time> | null

Only count events after this timestamp.

Response

Billable metric updated successfully

id
string
required

Unique identifier for a billable metric

object
enum<string>
default:billableMetric
required
Available options:
billableMetric
aggregation
enum<string>
required
Available options:
SUM,
COUNT,
AVG,
MIN,
MAX,
UNIQUE_COUNT,
LATEST
createdAt
string<date-time>
required
description
string
required
merchantId
string
required

Unique identifier for an organization

name
string
required
productId
string
required

Unique identifier for a product

unit
string
required
updatedAt
string<date-time>
required
eventType
string | null
valueProperty
string | null
groupBy
object
eventFrom
string<date-time> | null