POST
/
tokens
/
embed
/
referrals
PHP
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\CreateReferralsEmbedTokenRequestBody(
    partner: new Operations\Partner(
        email: 'Letha_Wuckert2@yahoo.com',
        linkProps: new Operations\CreateReferralsEmbedTokenLinkProps(
            externalId: '123456',
            tagIds: [
                'clux0rgak00011...',
            ],
            testVariants: [
                new Operations\CreateReferralsEmbedTokenTestVariants(
                    url: 'https://example.com/variant-1',
                    percentage: 50,
                ),
                new Operations\CreateReferralsEmbedTokenTestVariants(
                    url: 'https://example.com/variant-2',
                    percentage: 50,
                ),
            ],
        ),
    ),
);

$response = $sdk->embedTokens->referrals(
    request: $request
);

if ($response->object !== null) {
    // handle response
}
{
  "publicToken": "<string>",
  "expires": "<string>"
}
Referrals embed token endpoint require an Advanced plan subscription or higher.

Authorizations

Authorization
string
header
required

Default authentication mechanism

Body

application/json

Response

201
application/json

The created public embed token.

The response is of type object.