(meters)
- list - List Meters
- create - Create Meter
- get - Get Meter
- update - Update Meter
- quantities - Get Meter Quantities
List meters.
Scopes: meters:read meters:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.meters.list(organization_id="1dbfc517-0bbf-4301-9ba8-555ca42b9737", page=1, limit=10)
while res is not None:
# Handle items
res = res.next()| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id |
OptionalNullable[models.MetersListQueryParamOrganizationIDFilter] | ➖ | Filter by organization ID. |
query |
OptionalNullable[str] | ➖ | Filter by name. |
is_archived |
OptionalNullable[bool] | ➖ | Filter on archived meters. |
page |
Optional[int] | ➖ | Page number, defaults to 1. |
limit |
Optional[int] | ➖ | Size of a page, defaults to 10. Maximum is 100. |
sorting |
List[models.MeterSortProperty] | ➖ | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order. |
metadata |
Dict[str, models.MetadataQuery] | ➖ | Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Create a meter.
Scopes: meters:write
import polar_sdk
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.meters.create(request={
"name": "<value>",
"filter_": {
"conjunction": polar_sdk.FilterConjunction.OR,
"clauses": [
{
"property": "<value>",
"operator": polar_sdk.FilterOperator.NE,
"value": "<value>",
},
],
},
"aggregation": {
"func": polar_sdk.Func.SUM,
"property": "<value>",
},
"organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.MeterCreate | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Get a meter by ID.
Scopes: meters:read meters:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.meters.get(id="<value>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
id |
str | ✔️ | The meter ID. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Update a meter.
Scopes: meters:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.meters.update(id="<value>", meter_update={})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
id |
str | ✔️ | The meter ID. |
meter_update |
models.MeterUpdate | ✔️ | N/A |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Get quantities of a meter over a time period.
Scopes: meters:read meters:write
import polar_sdk
from polar_sdk import Polar
from polar_sdk.utils import parse_datetime
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.meters.quantities(id="<value>", start_timestamp=parse_datetime("2025-11-25T04:37:16.823Z"), end_timestamp=parse_datetime("2025-11-26T17:06:00.727Z"), interval=polar_sdk.TimeInterval.DAY, timezone="UTC")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
id |
str | ✔️ | The meter ID. |
start_timestamp |
date | ✔️ | Start timestamp. |
end_timestamp |
date | ✔️ | End timestamp. |
interval |
models.TimeInterval | ✔️ | Interval between two timestamps. |
timezone |
Optional[str] | ➖ | Timezone to use for the timestamps. Default is UTC. |
customer_id |
OptionalNullable[models.MetersQuantitiesQueryParamCustomerIDFilter] | ➖ | Filter by customer ID. |
external_customer_id |
OptionalNullable[models.MetersQuantitiesQueryParamExternalCustomerIDFilter] | ➖ | Filter by external customer ID. |
customer_aggregation_function |
OptionalNullable[models.AggregationFunction] | ➖ | If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events. |
metadata |
Dict[str, models.MetadataQuery] | ➖ | Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |