Skip to content
Join our SlackContact usGet started

Create Pricing Metric Summary

pricing_metrics.create_summary(strpricing_metric_id, PricingMetricCreateSummaryParams**kwargs) -> PricingMetricCreateSummaryResponse
post/pricing-metrics/{pricing_metric_id}/summary

Create Pricing Metric Summary

ParametersExpand Collapse
pricing_metric_id: str
period: PeriodParam

The period that the summary should be computed over.

end: datetime
formatdate-time
start: datetime
formatdate-time
inclusive_end: Optional[bool]
inclusive_start: Optional[bool]
subject_id: str

The ID or external ID of the subject that the summary should be computed for.

ReturnsExpand Collapse
class PricingMetricCreateSummaryResponse:
id: str

The ID of the pricing metric summary.

period: Period

The period that the summary is computed over.

end: datetime
formatdate-time
start: datetime
formatdate-time
inclusive_end: Optional[bool]
inclusive_start: Optional[bool]
pricing_metric_id: str

The ID of the pricing metric that the summary is for.

subject_id: str

The ID of the subject that the summary is for.

value: Optional[str]

The computed value of the pricing metric for the period. If the pricing metric does not have any usage events for the period, this will be null.

Create Pricing Metric Summary
from datetime import datetime
from lark import Lark

client = Lark(
    api_key="My API Key",
)
response = client.pricing_metrics.create_summary(
    pricing_metric_id="pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
    period={
        "start": datetime.fromisoformat("2025-10-01T00:00:00"),
        "end": datetime.fromisoformat("2025-11-01T00:00:00"),
    },
    subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
)
print(response.id)
{
  "id": "pmtr_sum_vqXWIKBYia15D5dNyCLLlsa4",
  "period": {
    "end": "2025-11-01T00:00:00Z",
    "start": "2025-10-01T00:00:00Z",
    "inclusive_end": false,
    "inclusive_start": true
  },
  "pricing_metric_id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
  "subject_id": "subj_VyX6Q96h5avMho8O7QWlKeXE",
  "value": "22.5"
}
Returns Examples
{
  "id": "pmtr_sum_vqXWIKBYia15D5dNyCLLlsa4",
  "period": {
    "end": "2025-11-01T00:00:00Z",
    "start": "2025-10-01T00:00:00Z",
    "inclusive_end": false,
    "inclusive_start": true
  },
  "pricing_metric_id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
  "subject_id": "subj_VyX6Q96h5avMho8O7QWlKeXE",
  "value": "22.5"
}