# Customers ## Create **post** `/v1/customers` Create a new customer ### Returns - **data:** `Customer` ## Retrieve **get** `/v1/customers/{customer_id}` Get a customer by Metronome ID. ### Returns - **data:** `CustomerDetail` ## List **get** `/v1/customers` List all customers. ### Returns - **data:** `array of CustomerDetail` - **next\_page:** `string` ## Archive **post** `/v1/customers/archive` Archive a customer Note: any alerts associated with the customer will not be triggered. ### Returns - **data:** `ID` ## List Billable Metrics **get** `/v1/customers/{customer_id}/billable-metrics` Get all billable metrics for a given customer. ### Returns - **data:** `array of object` - **next\_page:** `string` ## List Costs **get** `/v1/customers/{customer_id}/costs` Fetch daily pending costs for the specified customer, broken down by credit type and line items. Note: this is not supported for customers whose plan includes a UNIQUE-type billable metric. ### Returns - **data:** `array of object` - **next\_page:** `string` ## Preview Events **post** `/v1/customers/{customer_id}/previewEvents` Preview how a set of events will affect a customer's invoice. Generates a draft invoice for a customer using their current contract configuration and the provided events. This is useful for testing how new events will affect the customer's invoice before they are actually processed. ### Returns - **data:** `Invoice` ## Set Ingest Aliases **post** `/v1/customers/{customer_id}/setIngestAliases` Sets the ingest aliases for a customer. Ingest aliases can be used in the `customer_id` field when sending usage events to Metronome. This call is idempotent. It fully replaces the set of ingest aliases for the given customer. ## Set Name **post** `/v1/customers/{customer_id}/setName` Updates the specified customer's name. ### Returns - **data:** `Customer` ## Update Config **post** `/v1/customers/{customer_id}/updateConfig` Updates the specified customer's config. ## Domain Types ### Customer - **Customer:** `object` - **id:** `string` the Metronome ID of the customer - **external\_id:** `string` (deprecated, use ingest_aliases instead) the first ID (Metronome or ingest alias) that can be used in usage events - **ingest\_aliases:** `array of string` aliases for this customer that can be used instead of the Metronome customer ID in usage events - **name:** `string` - **custom\_fields:** `map[string]` ### Customer Detail - **CustomerDetail:** `object` - **id:** `string` the Metronome ID of the customer - **created\_at:** `string` RFC 3339 timestamp indicating when the customer was created. - **custom\_fields:** `map[string]` - **customer\_config:** `object` - **salesforce\_account\_id:** `string` The Salesforce account ID for the customer - **external\_id:** `string` (deprecated, use ingest_aliases instead) the first ID (Metronome or ingest alias) that can be used in usage events - **ingest\_aliases:** `array of string` aliases for this customer that can be used instead of the Metronome customer ID in usage events - **name:** `string` - **archived\_at:** `string` RFC 3339 timestamp indicating when the customer was archived. Null if the customer is active. - **current\_billable\_status:** `object` This field's availability is dependent on your client's configuration. - **value:** `"billable" OR "unbillable"` - `"billable"` - `"unbillable"` - **effective\_at:** `string`