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)declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$response = $sdk->customers->get(
id: '<id>'
);
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.Get(ctx, operations.GetCustomerRequest{
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::GetCustomerRequest.new(
id: '<id>',
)
res = s.customers.get(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.get({
id: "<id>",
});
console.log(result);
}
run();curl --request GET \
--url https://api.dub.co/customers/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
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.get("https://api.dub.co/customers/{id}")
.header("Authorization", "Bearer <token>")
.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,
"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"
}
}Retrieve a customer
Retrieve a customer by ID for the authenticated workspace.
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)declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$response = $sdk->customers->get(
id: '<id>'
);
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.Get(ctx, operations.GetCustomerRequest{
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::GetCustomerRequest.new(
id: '<id>',
)
res = s.customers.get(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.get({
id: "<id>",
});
console.log(result);
}
run();curl --request GET \
--url https://api.dub.co/customers/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
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.get("https://api.dub.co/customers/{id}")
.header("Authorization", "Bearer <token>")
.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,
"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).
Response
The customer object.
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