Skip to main content
POST
/
v1
/
customers
Python (SDK)
import polar_sdk
from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.customers.create(request={
        "external_id": "usr_1337",
        "email": "[email protected]",
        "name": "John Doe",
        "billing_address": {
            "country": polar_sdk.CountryAlpha2Input.US,
        },
        "tax_id": [
            "911144442",
            "us_ein",
        ],
        "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
        "owner": {
            "email": "[email protected]",
            "name": "Jane Doe",
            "external_id": "usr_1337",
        },
    })

    # Handle response
    print(res)
{
  "id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "metadata": {},
  "external_id": "usr_1337",
  "email": "<string>",
  "email_verified": true,
  "name": "John Doe",
  "billing_address": {
    "country": "AD",
    "line1": "<string>",
    "line2": "<string>",
    "postal_code": "<string>",
    "city": "<string>",
    "state": "<string>"
  },
  "tax_id": [
    "911144442",
    "us_ein"
  ],
  "organization_id": "<string>",
  "deleted_at": "2023-11-07T05:31:56Z",
  "avatar_url": "<string>",
  "members": [
    {
      "id": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "modified_at": "2023-11-07T05:31:56Z",
      "customer_id": "<string>",
      "email": "<string>",
      "name": "Jane Doe",
      "external_id": "usr_1337",
      "role": "owner"
    }
  ]
}

Authorizations

Authorization
string
header
required

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

Body

application/json
email
string<email>
required

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

metadata
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.

external_id
string | null

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

Example:

"usr_1337"

name
string | null

The name of the customer.

Maximum string length: 256
Example:

"John Doe"

billing_address
AddressInput · object
tax_id
any[] | null
Required array length: 2 elements
Example:
["911144442", "us_ein"]
organization_id
string<uuid4> | null

The organization ID.

Example:

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

owner
OwnerCreate · object

Optional owner member to create with the customer. If not provided, an owner member will be automatically created using the customer's email and name.

Response

Customer created.

A customer in an organization with their members loaded.

id
string<uuid4>
required

The ID of the customer.

Example:

"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.

Example:

"usr_1337"

email
string
required

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

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.

Example:

true

name
string | null
required

The name of the customer.

Example:

"John Doe"

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

The ID of the organization owning the customer.

Example:

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

deleted_at
string<date-time> | null
required

Timestamp for when the customer was soft deleted.

avatar_url
string
required
Example:

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

members
Member · object[]

List of members belonging to this customer.