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)declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$request = new Operations\UpdateCustomerRequest(
id: '<id>',
);
$response = $sdk->customers->update(
request: $request
);
if ($response->object !== null) {
// handle response
}package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Customers.Update(ctx, operations.UpdateCustomerRequest{
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}require 'dub'
Models = ::OpenApiSDK::Models
s = ::OpenApiSDK::Dub.new(
security: Models::Shared::Security.new(
token: 'DUB_API_KEY',
),
)
req = Models::Operations::UpdateCustomerRequest.new(
id: '<id>',
)
res = s.customers.update(request: req)
unless res.nil?
# handle response
endimport { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.customers.update({
id: "<id>",
});
console.log(result);
}
run();curl --request PATCH \
--url https://api.dub.co/customers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jsmith@example.com",
"name": "<string>",
"avatar": "<string>",
"externalId": "<string>",
"stripeCustomerId": "<string>"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'jsmith@example.com',
name: '<string>',
avatar: '<string>',
externalId: '<string>',
stripeCustomerId: '<string>'
})
};
fetch('https://api.dub.co/customers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.patch("https://api.dub.co/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"avatar\": \"<string>\",\n \"externalId\": \"<string>\",\n \"stripeCustomerId\": \"<string>\"\n}")
.asString();{
"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
}
}{
"error": {
"code": "bad_request",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#bad-request"
}
}{
"error": {
"code": "unauthorized",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#unauthorized"
}
}{
"error": {
"code": "forbidden",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#forbidden"
}
}{
"error": {
"code": "not_found",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#not-found"
}
}{
"error": {
"code": "conflict",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#conflict"
}
}{
"error": {
"code": "invite_expired",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#invite-expired"
}
}{
"error": {
"code": "unprocessable_entity",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#unprocessable-entity"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#rate-limit_exceeded"
}
}{
"error": {
"code": "internal_server_error",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#internal-server_error"
}
}Update a customer
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)declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$request = new Operations\UpdateCustomerRequest(
id: '<id>',
);
$response = $sdk->customers->update(
request: $request
);
if ($response->object !== null) {
// handle response
}package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Customers.Update(ctx, operations.UpdateCustomerRequest{
ID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}require 'dub'
Models = ::OpenApiSDK::Models
s = ::OpenApiSDK::Dub.new(
security: Models::Shared::Security.new(
token: 'DUB_API_KEY',
),
)
req = Models::Operations::UpdateCustomerRequest.new(
id: '<id>',
)
res = s.customers.update(request: req)
unless res.nil?
# handle response
endimport { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.customers.update({
id: "<id>",
});
console.log(result);
}
run();curl --request PATCH \
--url https://api.dub.co/customers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jsmith@example.com",
"name": "<string>",
"avatar": "<string>",
"externalId": "<string>",
"stripeCustomerId": "<string>"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'jsmith@example.com',
name: '<string>',
avatar: '<string>',
externalId: '<string>',
stripeCustomerId: '<string>'
})
};
fetch('https://api.dub.co/customers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.patch("https://api.dub.co/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"avatar\": \"<string>\",\n \"externalId\": \"<string>\",\n \"stripeCustomerId\": \"<string>\"\n}")
.asString();{
"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
}
}{
"error": {
"code": "bad_request",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#bad-request"
}
}{
"error": {
"code": "unauthorized",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#unauthorized"
}
}{
"error": {
"code": "forbidden",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#forbidden"
}
}{
"error": {
"code": "not_found",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#not-found"
}
}{
"error": {
"code": "conflict",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#conflict"
}
}{
"error": {
"code": "invite_expired",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#invite-expired"
}
}{
"error": {
"code": "unprocessable_entity",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#unprocessable-entity"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#rate-limit_exceeded"
}
}{
"error": {
"code": "internal_server_error",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#internal-server_error"
}
}Authorizations
Default authentication mechanism
Path Parameters
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
Whether to include expanded fields on the customer (link, partner, discount).
Body
Email of the customer in the client's app.
Name of the customer in the client's app. If not provided, a random name will be generated.
Avatar URL of the customer in the client's app.
Unique identifier for the customer in the client's app.
The customer's Stripe customer ID. Useful for attribution recurring sale events to the partner who referred the customer.
Response
The customer was updated.
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).
Unique identifier for the customer in the client's app.
Name of the customer.
The date the customer was created.
Email of the customer.
Avatar URL of the customer.
Country of the customer.
Total number of sales for the customer.
Total amount of sales for the customer.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes