---
title: "Update customer"
method: PUT
path: "/api/v1/customers/{customerIdOrKey}"
tags: ["Customers"]
---

# Update customer

`PUT /api/v1/customers/{customerIdOrKey}`

Update a customer by ID.

## Path parameters

- `customerIdOrKey` union, required — ULID (Universally Unique Lexicographically Sortable Identifier) or external unique key.
  - string — ULID (Universally Unique Lexicographically Sortable Identifier).
  - string — ExternalKey is a looser version of key.

## Request body

- CustomerReplaceUpdate — Resource update operation model.
  - `name` string, required — Human-readable name for the resource. Between 1 and 256 characters.
  - `description` string — Optional description of the resource. Maximum 1024 characters.
  - `metadata` Metadata — Set of key-value pairs. Metadata can be used to store additional information about a resource.
  - `key` string — An optional unique key of the customer. Either key or usageAttribution.subjectKeys must be provided. Useful to reference the customer in external systems. For example, your database ID.
  - `usageAttribution` CustomerUsageAttribution — Mapping to attribute metered usage to the customer. One customer can have zero or more subjects, but one subject can only belong to one customer.
    - `subjectKeys` string[], required — The subjects that are attributed to the customer. Can be empty when no subjects are associated with the customer.
  - `primaryEmail` string — The primary email address of the customer.
  - `currency` string — Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.
  - `billingAddress` Address — Address
    - `country` string — [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 country code. Custom two-letter country codes are also supported for convenience.
    - `postalCode` string — Postal code.
    - `state` string — State or province.
    - `city` string — City.
    - `line1` string — First line of the address.
    - `line2` string — Second line of the address.
    - `phoneNumber` string — Phone number.

## Response `200`

The request has succeeded.

- Customer — A customer object.
  - `id` string, required — A unique identifier for the resource.
  - `name` string, required — Human-readable name for the resource. Between 1 and 256 characters.
  - `description` string — Optional description of the resource. Maximum 1024 characters.
  - `metadata` Metadata — Set of key-value pairs. Metadata can be used to store additional information about a resource.
  - `createdAt` string, date-time, required — Timestamp of when the resource was created.
  - `updatedAt` string, date-time, required — Timestamp of when the resource was last updated.
  - `deletedAt` string, date-time — Timestamp of when the resource was permanently deleted.
  - `key` string — An optional unique key of the customer. Either key or usageAttribution.subjectKeys must be provided. Useful to reference the customer in external systems. For example, your database ID.
  - `usageAttribution` CustomerUsageAttribution — Mapping to attribute metered usage to the customer. One customer can have zero or more subjects, but one subject can only belong to one customer.
    - `subjectKeys` string[], required — The subjects that are attributed to the customer. Can be empty when no subjects are associated with the customer.
  - `primaryEmail` string — The primary email address of the customer.
  - `currency` string — Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.
  - `billingAddress` Address — Address
    - `country` string — [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 country code. Custom two-letter country codes are also supported for convenience.
    - `postalCode` string — Postal code.
    - `state` string — State or province.
    - `city` string — City.
    - `line1` string — First line of the address.
    - `line2` string — Second line of the address.
    - `phoneNumber` string — Phone number.
  - `currentSubscriptionId` string — The ID of the Subscription if the customer has one.
  - `subscriptions` Subscription[] — The subscriptions of the customer. Only with the `subscriptions` expand option.
    - `id` string, required — A unique identifier for the resource.
    - `name` string, required — Human-readable name for the resource. Between 1 and 256 characters.
    - `description` string — Optional description of the resource. Maximum 1024 characters.
    - `metadata` Metadata — Set of key-value pairs. Metadata can be used to store additional information about a resource.
    - `createdAt` string, date-time, required — Timestamp of when the resource was created.
    - `updatedAt` string, date-time, required — Timestamp of when the resource was last updated.
    - `deletedAt` string, date-time — Timestamp of when the resource was permanently deleted.
    - `activeFrom` string, date-time, required — The cadence start of the resource.
    - `activeTo` string, date-time — The cadence end of the resource.
    - `annotations` Annotations — Set of key-value pairs managed by the system. Cannot be modified by user.
    - `alignment` Alignment — Alignment configuration for a plan or subscription.
      - `billablesMustAlign` boolean — Whether all Billable items and RateCards must align. Alignment means the Price's BillingCadence must align for both duration and anchor time.
    - `status` 'active' | 'inactive' | 'canceled' | 'scheduled', required — Subscription status.
    - `customerId` string, required — The customer ID of the subscription.
    - `plan` PlanReference — References an exact plan.
      - `id` string, required — The plan ID.
      - `key` string, required — The plan key.
      - `version` integer, required — The plan version.
    - `currency` string, required — Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.
    - `costBasisMode` 'dynamic' | 'pinned', required — Controls how custom-currency cost bases are selected for the subscription.
    - `costBasisPins` SubscriptionCostBasisPin[], required — Cost bases pinned to custom-currency pairs for this subscription.
      - `customCurrencyId` string, required — The managed custom currency ID.
      - `invoiceCurrency` string, required — Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.
      - `costBasisId` string, required — The pinned cost basis resource ID.
    - `billingCadence` string, duration, required — The billing cadence for the subscriptions. Defines how often customers are billed using ISO8601 duration format. Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
    - `proRatingConfig` ProRatingConfig — Configuration for pro-rating behavior.
      - `enabled` boolean, required — Whether pro-rating is enabled for this plan.
      - `mode` 'prorate_prices', required — Pro-rating mode options for handling billing period changes.
    - `billingAnchor` string, date-time, required — The normalizedbilling anchor of the subscription.
    - `settlementMode` 'credit_then_invoice' | 'credit_only', required — The settlement mode of a plan. It determines how the billing system generates invoices and credits for the subscriptions using this plan. - credit_then_invoice: credits from the previous billing period are applied first, then the remaining balance is invoiced. This is the default and most common settlement mode. - credit_only: only credits from the previous billing period are generated and applied. No invoices are generated for the subscription.
  - `annotations` Annotations — Set of key-value pairs managed by the system. Cannot be modified by user.

## Other responses

- `400` — The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
- `401` — The request has not been applied because it lacks valid authentication credentials for the target resource.
- `403` — The server understood the request but refuses to authorize it.
- `404` — The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
- `412` — One or more conditions given in the request header fields evaluated to false when tested on the server.
- `500` — The server encountered an unexpected condition that prevented it from fulfilling the request.
- `503` — The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.
- `default` — An unexpected error response.

---

[API](https://skmtc.net/openmeterio/apis/openmeter-api.md) · [All operations](https://skmtc.net/openmeterio/apis/openmeter-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openmeterio/openmeter-api/revisions/1cd97f063f4a/schema)
