PATCH
/
v1
/
customers
/
external
/
{external_id}
Typescript (SDK)
import { Polar } from "@polar-sh/sdk";

const polar = new Polar({
  accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});

async function run() {
  const result = await polar.customers.updateExternal({
    externalId: "<id>",
    customerUpdateExternalID: {
      email: "customer@example.com",
      name: "John Doe",
      billingAddress: null,
      taxId: [
        "911144442",
        "us_ein",
      ],
    },
  });

  console.log(result);
}

run();
{
  "id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b",
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "metadata": {},
  "external_id": "usr_1337",
  "email": "customer@example.com",
  "email_verified": true,
  "name": "John Doe",
  "billing_address": {
    "line1": "<string>",
    "line2": "<string>",
    "postal_code": "<string>",
    "city": "<string>",
    "state": "<string>",
    "country": "US"
  },
  "tax_id": [
    "911144442",
    "us_ein"
  ],
  "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
  "deleted_at": "2023-11-07T05:31:56Z",
  "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"
}

Authorizations

Authorization
string
header
required

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

Path Parameters

external_id
string
required

The customer external ID.

Body

application/json
metadata
object

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

email
string<email> | null

The email address of the customer. This must be unique within the organization.

Examples:

"customer@example.com"

name
string | null

The name of the customer.

Examples:

"John Doe"

billing_address
object | null
tax_id
any[] | null
Required array length: 2 elements
Examples:
["911144442", "us_ein"]
["FR61954506077", "eu_vat"]

Response

Customer updated.

A customer in an organization.

id
string<uuid4>
required

The ID of the customer.

Examples:

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

created_at
string<date-time>
required

Creation timestamp of the object.

modified_at
string<date-time> | null
required

Last modification timestamp of the object.

metadata
object
required
external_id
string | null
required

The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.

Examples:

"usr_1337"

email
string
required

The email address of the customer. This must be unique within the organization.

Examples:

"customer@example.com"

email_verified
boolean
required

Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.

Examples:

true

name
string | null
required

The name of the customer.

Examples:

"John Doe"

billing_address
object | null
required
tax_id
any[] | null
required
Required array length: 2 elements
Examples:
["911144442", "us_ein"]
["FR61954506077", "eu_vat"]
organization_id
string<uuid4>
required

The ID of the organization owning the customer.

Examples:

"1dbfc517-0bbf-4301-9ba8-555ca42b9737"

deleted_at
string<date-time> | null
required

Timestamp for when the customer was soft deleted.

avatar_url
string
required
Examples:

"https://www.gravatar.com/avatar/xxx?d=404"