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

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

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

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

    res, err := s.CustomerMeters.Get(ctx, "<value>")
    if err != nil {
        log.Fatal(err)
    }
    if res.CustomerMeter != nil {
        switch res.CustomerMeter.Customer.Type {
            case components.CustomerUnionTypeIndividual:
                // res.CustomerMeter.Customer.CustomerIndividual is populated
            case components.CustomerUnionTypeTeam:
                // res.CustomerMeter.Customer.CustomerTeam is populated
        }

    }
}
{
  "id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "customer_id": "<string>",
  "meter_id": "<string>",
  "consumed_units": 123,
  "credited_units": 123,
  "balance": 123,
  "customer": {
    "id": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "modified_at": "2023-11-07T05:31:56Z",
    "metadata": {},
    "email": "<string>",
    "email_verified": true,
    "type": "<string>",
    "name": "John Doe",
    "billing_address": {
      "country": "AD",
      "line1": "<string>",
      "line2": "<string>",
      "postal_code": "<string>",
      "city": "<string>",
      "state": "<string>"
    },
    "tax_id": {
      "[0]": "<string>"
    },
    "organization_id": "<string>",
    "deleted_at": "2023-11-07T05:31:56Z",
    "avatar_url": "<string>",
    "external_id": "usr_1337",
    "locale": "<string>"
  },
  "meter": {
    "metadata": {},
    "created_at": "2023-11-07T05:31:56Z",
    "modified_at": "2023-11-07T05:31:56Z",
    "id": "<string>",
    "name": "<string>",
    "unit": "scalar",
    "filter": {
      "conjunction": "and",
      "clauses": [
        {
          "property": "<string>",
          "operator": "eq",
          "value": "<string>"
        }
      ]
    },
    "aggregation": {
      "func": "count"
    },
    "organization_id": "<string>",
    "custom_label": "<string>",
    "custom_multiplier": 123,
    "archived_at": "2023-11-07T05:31:56Z"
  }
}

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 customer meter ID.

Response

Successful Response

An active customer meter, with current consumed and credited units.

id
string<uuid4>
required

The ID of the object.

created_at
string<date-time>
required

Creation timestamp of the object.

modified_at
string<date-time> | null
required

Last modification timestamp of the object.

customer_id
string<uuid4>
required

The ID of the customer.

Example:

"992fae2a-2a17-4b7a-8d9e-e287cf90131b"

meter_id
string<uuid4>
required

The ID of the meter.

Example:

"d498a884-e2cd-4d3e-8002-f536468a8b22"

consumed_units
number
required

The number of consumed units.

Example:

25

credited_units
integer
required

The number of credited units.

Example:

100

balance
number
required

The balance of the meter, i.e. the difference between credited and consumed units.

Example:

75

customer
CustomerIndividual · object
required

The customer associated with this meter.

meter
Meter · object
required

The meter associated with this customer.