- list - List all customers
- get - Retrieve a customer
- delete - Delete a customer
- update - Update a customer
Retrieve a paginated list of customers for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.customers.list(request={
"ending_before": "cus_1KAP4CDPBSVMMBMH9XX3YZZ0Z",
"starting_after": "cus_1KAP4CDPBSVMMBMH9XX3YZZ0Z",
"page": 1,
"page_size": 50,
})
while res is not None:
# Handle items
res = res.next()| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetCustomersRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GetCustomersResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequest | 400 | application/json |
| errors.Unauthorized | 401 | application/json |
| errors.Forbidden | 403 | application/json |
| errors.NotFound | 404 | application/json |
| errors.Conflict | 409 | application/json |
| errors.InviteExpired | 410 | application/json |
| errors.UnprocessableEntity | 422 | application/json |
| errors.RateLimitExceeded | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Retrieve a customer by ID for the authenticated workspace. To retrieve a customer by external ID, prefix the ID with ext_.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.customers.get(request={
"id": "<id>",
})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetCustomerRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GetCustomerResponseBody
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequest | 400 | application/json |
| errors.Unauthorized | 401 | application/json |
| errors.Forbidden | 403 | application/json |
| errors.NotFound | 404 | application/json |
| errors.Conflict | 409 | application/json |
| errors.InviteExpired | 410 | application/json |
| errors.UnprocessableEntity | 422 | application/json |
| errors.RateLimitExceeded | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Delete a customer from a workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.customers.delete(id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
id |
str | ✔️ | 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). |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.DeleteCustomerResponseBody
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequest | 400 | application/json |
| errors.Unauthorized | 401 | application/json |
| errors.Forbidden | 403 | application/json |
| errors.NotFound | 404 | application/json |
| errors.Conflict | 409 | application/json |
| errors.InviteExpired | 410 | application/json |
| errors.UnprocessableEntity | 422 | application/json |
| errors.RateLimitExceeded | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Update a customer for the authenticated workspace.
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)| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.UpdateCustomerRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.UpdateCustomerResponseBody
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequest | 400 | application/json |
| errors.Unauthorized | 401 | application/json |
| errors.Forbidden | 403 | application/json |
| errors.NotFound | 404 | application/json |
| errors.Conflict | 409 | application/json |
| errors.InviteExpired | 410 | application/json |
| errors.UnprocessableEntity | 422 | application/json |
| errors.RateLimitExceeded | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.SDKError | 4XX, 5XX | */* |