Skip to main content
PATCH
/
customers
/
{id}
Python
from dub import Dub


with Dub(
    token="DUB_API_KEY",
) as d_client:

    res = d_client.customers.update(request={
        "id": "<id>",
    })

    # Handle response
    print(res)
{
  "id": "<string>",
  "externalId": "<string>",
  "name": "<string>",
  "createdAt": "<string>",
  "email": "<string>",
  "avatar": "<string>",
  "country": "<string>",
  "sales": 123,
  "saleAmount": 123,
  "link": {
    "id": "<string>",
    "domain": "<string>",
    "key": "<string>",
    "shortLink": "<string>",
    "url": "<string>",
    "programId": "<string>"
  },
  "programId": "<string>",
  "partner": {
    "id": "<string>",
    "name": "<string>",
    "email": "<string>",
    "image": "<string>"
  },
  "discount": {
    "id": "<string>",
    "amount": 123,
    "type": "percentage",
    "maxDuration": 123,
    "couponId": "<string>",
    "couponTestId": "<string>",
    "description": "<string>",
    "partnersCount": 123
  }
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Path Parameters

id
string
required

The unique ID of the customer. You may use either the customer's id on Dub (obtained via /customers endpoint) or their externalId (unique ID within your system, prefixed with ext_, e.g. ext_123).

Query Parameters

includeExpandedFields
boolean

Whether to include expanded fields on the customer (link, partner, discount).

Body

application/json
email
string<email> | null

The customer's email address.

name
string | null

The customer's name. If not provided, the email address will be used, and if email is not provided, a random name will be generated.

avatar
string<uri> | null

The customer's avatar URL. If not provided, a random avatar will be generated.

externalId
string

The customer's unique identifier your database. This is useful for associating subsequent conversion events from Dub's API to your internal systems.

stripeCustomerId
string | null

The customer's Stripe customer ID. This is useful for attributing recurring sale events to the partner who referred the customer.

country
string

The customer's country in ISO 3166-1 alpha-2 format. Updating this field will only affect the customer's country in Dub's system (and has no effect on existing conversion events).

Response

The customer was updated.

id
string
required

The unique ID of the customer. You may use either the customer's id on Dub (obtained via /customers endpoint) or their externalId (unique ID within your system, prefixed with ext_, e.g. ext_123).

externalId
string
required

Unique identifier for the customer in the client's app.

name
string
required

Name of the customer.

createdAt
string
required

The date the customer was created.

email
string | null

Email of the customer.

avatar
string | null

Avatar URL of the customer.

country
string | null

Country of the customer.

sales
number | null

Total number of sales for the customer.

saleAmount
number | null

Total amount of sales for the customer.

programId
string | null
partner
object
discount
object