Skip to main content
GET
/
v1
/
meters
/
{id}
/
quantities
Go (SDK)
package main

import(
	"context"
	"os"
	polargo "github.com/polarsource/polar-go"
	"github.com/polarsource/polar-go/types"
	"github.com/polarsource/polar-go/models/components"
	"github.com/polarsource/polar-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := polargo.New(
        polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
    )

    res, err := s.Meters.Quantities(ctx, operations.MetersQuantitiesRequest{
        ID: "<value>",
        StartTimestamp: types.MustTimeFromString("2025-11-25T04:37:16.823Z"),
        EndTimestamp: types.MustTimeFromString("2025-11-26T17:06:00.727Z"),
        Interval: components.TimeIntervalDay,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.MeterQuantities != nil {
        // handle response
    }
}
{
  "quantities": [
    {
      "timestamp": "2023-11-07T05:31:56Z",
      "quantity": 123
    }
  ],
  "total": 123
}

Documentation Index

Fetch the complete documentation index at: https://polar.sh/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

You can generate an Organization Access Token from your organization's settings.

Path Parameters

id
string<uuid4>
required

The meter ID.

Query Parameters

start_timestamp
string<date-time>
required

Start timestamp.

end_timestamp
string<date-time>
required

End timestamp.

interval
enum<string>
required

Interval between two timestamps.

Available options:
year,
month,
week,
day,
hour
timezone
string
default:UTC

Timezone to use for the timestamps. Default is UTC.

Minimum string length: 1
customer_id

Filter by customer ID. The customer ID.

external_customer_id

Filter by external customer ID.

customer_aggregation_function
enum<string> | null

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.

Available options:
count,
sum,
max,
min,
avg,
unique
metadata
MetadataQuery · object

Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value.

Response

Successful Response

quantities
MeterQuantity · object[]
required
total
number
required

The total quantity for the period.

Example:

100