Skip to content
  • Auto
  • Light
  • Dark
Talk to an expert

List Customers

List customers on a plan
client.V1.Plans.ListCustomers(ctx, params) (*CursorPage[CustomerDetailsCustomerDetailPlanDetailsV1PlanListCustomersResponsePlanDetailsV1PlanListCustomersResponse], error)
get/v1/planDetails/{plan_id}/customers

Fetches a list of customers on a specific plan (by default, only currently active plans are included)

Parameters
paramsPlanIDfieldLimitfieldNextPagefieldStatusfieldV1PlanListCustomersParams
Hide ParametersShow Parameters
PlanIDfield
param.Field[string]

Path param:

formatuuid
Limitfield
optional
param.Field[int64]

Query param: Max number of results that should be returned

minimum1
maximum100
NextPagefield
optional
param.Field[string]

Query param: Cursor that indicates where the next page of results should start.

Statusfield
optional

Query param: Status of customers on a given plan. Defaults to active.

  • all - Return current, past, and upcoming customers of the plan.
  • active - Return current customers of the plan.
  • ended - Return past customers of the plan.
  • upcoming - Return upcoming customers of the plan.

Multiple statuses can be OR'd together using commas, e.g. active,ended. Note: ended,upcoming combination is not yet supported.

Hide ParametersShow Parameters
V1PlanListCustomersParamsStatusAllconst
"all"
V1PlanListCustomersParamsStatusActiveconst
"active"
V1PlanListCustomersParamsStatusEndedconst
"ended"
V1PlanListCustomersParamsStatusUpcomingconst
"upcoming"
Returns
V1PlanListCustomersResponsestruct
Hide ParametersShow Parameters
CustomerDetailsIDstringCreatedAtTimeCustomFieldsmapCustomerConfigCustomerDetailCustomerConfigExternalIDstringIngestAliasesarrayNamestringArchivedAtTimeCurrentBillableStatusCustomerDetailCurrentBillableStatusCustomerDetail
PlanDetailsIDstringCustomFieldsmapCustomerPlanIDstringNamestringStartingOnTimeEndingBeforeTimeV1PlanListCustomersResponsePlanDetails
Hide ParametersShow Parameters
IDstring
formatuuid
CustomFieldsmap
map[string, string]
CustomerPlanIDstring
formatuuid
Namestring
StartingOnTime

The start date of the plan

formatdate-time
EndingBeforeTime
optional

The end date of the plan

formatdate-time
package main

import (
  "context"
  "fmt"

  "github.com/Metronome-Industries/metronome-go"
  "github.com/Metronome-Industries/metronome-go/option"
)

func main() {
  client := metronome.NewClient(
    option.WithBearerToken("My Bearer Token"),
  )
  page, err := client.V1.Plans.ListCustomers(context.TODO(), metronome.V1PlanListCustomersParams{
    PlanID: metronome.F("d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
200 Example
{
  "data": [
    {
      "customer_details": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "created_at": "2019-12-27T18:11:19.117Z",
        "custom_fields": {
          "foo": "string"
        },
        "customer_config": {
          "salesforce_account_id": "salesforce_account_id"
        },
        "external_id": "external_id",
        "ingest_aliases": [
          "string"
        ],
        "name": "name",
        "archived_at": "2019-12-27T18:11:19.117Z",
        "current_billable_status": {
          "value": "billable",
          "effective_at": "2019-12-27T18:11:19.117Z"
        }
      },
      "plan_details": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "custom_fields": {
          "foo": "string"
        },
        "customer_plan_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "name": "name",
        "starting_on": "2019-12-27T18:11:19.117Z",
        "ending_before": "2019-12-27T18:11:19.117Z"
      }
    }
  ],
  "next_page": "next_page"
}