(customers)
create- Create a customer⚠️ Deprecated- delete - Delete a customer
- get - Retrieve a customer
- list - Retrieve a list of customers
- update - Update a customer
[Deprecated]: Customer creation can only be done via tracking a lead event. Use the /track/lead endpoint instead.
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
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\CreateCustomerRequestBody(
externalId: '<id>',
);
$response = $sdk->customers->create(
request: $request
);
if ($response->object !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CreateCustomerRequestBody | ✔️ | The request object to use for the request. |
?Operations\CreateCustomerResponse
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\SDKException | 4XX, 5XX | */* |
Delete a customer from a workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$response = $sdk->customers->delete(
id: '<id>'
);
if ($response->object !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The unique identifier of the customer in Dub. |
?Operations\DeleteCustomerResponse
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\SDKException | 4XX, 5XX | */* |
Retrieve a customer by ID for the authenticated workspace.
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>',
includeExpandedFields: false
);
if ($response->object !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The unique identifier of the customer in Dub. |
includeExpandedFields |
?bool | ➖ | Whether to include expanded fields on the customer (link , partner , discount ). |
?Operations\GetCustomerResponse
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\SDKException | 4XX, 5XX | */* |
Retrieve a list of customers for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$response = $sdk->customers->list(
email: '[email protected]',
externalId: '<id>',
includeExpandedFields: false
);
if ($response->responseBodies !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
email |
?string | ➖ | A case-sensitive filter on the list based on the customer's email field. The value must be a string. |
externalId |
?string | ➖ | A case-sensitive filter on the list based on the customer's externalId field. The value must be a string. |
includeExpandedFields |
?bool | ➖ | Whether to include expanded fields on the customer (link , partner , discount ). |
?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\SDKException | 4XX, 5XX | */* |
Update a customer for the authenticated workspace.
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
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\UpdateCustomerRequest | ✔️ | The request object to use for the request. |
?Operations\UpdateCustomerResponse
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\SDKException | 4XX, 5XX | */* |