Create a referrals embed token for the given partner/tenant.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.embed_tokens.referrals(request={
"partner": {
"email": "[email protected]",
"link_props": {
"external_id": "123456",
"tag_ids": [
"clux0rgak00011...",
],
"test_variants": [
{
"url": "https://example.com/variant-1",
"percentage": 50,
},
{
"url": "https://example.com/variant-2",
"percentage": 50,
},
],
},
},
})
# Handle response
print(res){
"publicToken": "<string>",
"expires": "<string>"
}Default authentication mechanism
Show child attributes
The partner's email address. Partners will be able to claim their profile by signing up at partners.dub.co with this email.
1 - 190The partner's full name. If undefined, the partner's email will be used in lieu of their name (e.g. [email protected])
100The partner's unique username in your system (max 100 characters). This will be used to create a short link for the partner using your program's default domain. If not provided, Dub will try to generate a username from the partner's name or email.
100The partner's avatar image. If not provided, a default avatar will be used.
The partner's unique ID in your system. Useful for retrieving the partner's links and stats later on. If not provided, the partner will be created as a standalone partner.
The group ID to add the partner to. If not provided, the partner will be added to the default group.
The partner's country of residence. Must be passed as a 2-letter ISO 3166-1 country code. See https://d.to/geo for more information.
A brief description of the partner and their background. Max 5,000 characters.
5000Additional properties that you can pass to the partner's short link. Will be used to override the default link properties for this partner.
Show child attributes
The length of the short link slug. Defaults to 7 if not provided. When used with prefix, the total length of the key will be prefix.length + keyLength.
3 <= x <= 190The ID of the link in your database. If set, it can be used to identify the link in future API requests (must be prefixed with 'ext_' when passed as a query parameter). This key is unique across your workspace.
1 - 255"123456"
The ID of the tenant that created the link inside your system. If set, it can be used to fetch all links for a tenant.
255The prefix of the short link slug for randomly-generated keys (e.g. if prefix is /c/, generated keys will be in the /c/:key format). Will be ignored if key is provided.
Whether the short link is archived. Defaults to false if not provided.
The unique IDs of the tags assigned to the short link.
["clux0rgak00011..."]The unique name of the tags assigned to the short link (case insensitive).
The unique ID existing folder to assign the short link to.
The comments for the short link.
The date and time when the short link will expire at.
The URL to redirect to when the short link has expired.
32000The password required to access the destination URL of the short link.
Whether the short link uses Custom Link Previews feature. Defaults to false if not provided.
The custom link preview title (og:title). Will be used for Custom Link Previews if proxy is true. Learn more: https://d.to/og
The custom link preview description (og:description). Will be used for Custom Link Previews if proxy is true. Learn more: https://d.to/og
The custom link preview image (og:image). Will be used for Custom Link Previews if proxy is true. Learn more: https://d.to/og
The custom link preview video (og:video). Will be used for Custom Link Previews if proxy is true. Learn more: https://d.to/og
Whether the short link uses link cloaking. Defaults to false if not provided.
The iOS destination URL for the short link for iOS device targeting.
32000The Android destination URL for the short link for Android device targeting.
32000Allow search engines to index your short link. Defaults to false if not provided. Learn more: https://d.to/noindex
The UTM source of the short link. If set, this will populate or override the UTM source in the destination URL.
The UTM medium of the short link. If set, this will populate or override the UTM medium in the destination URL.
The UTM campaign of the short link. If set, this will populate or override the UTM campaign in the destination URL.
The UTM term of the short link. If set, this will populate or override the UTM term in the destination URL.
The UTM content of the short link. If set, this will populate or override the UTM content in the destination URL.
The referral tag of the short link. If set, this will populate or override the ref query parameter in the destination URL.
An array of A/B test URLs and the percentage of traffic to send to each URL.
2 - 4 elements[
{
"url": "https://example.com/variant-1",
"percentage": 50
},
{
"url": "https://example.com/variant-2",
"percentage": 50
}
]The date and time when the tests started.
The date and time when the tests were or will be completed.
Was this page helpful?
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.embed_tokens.referrals(request={
"partner": {
"email": "[email protected]",
"link_props": {
"external_id": "123456",
"tag_ids": [
"clux0rgak00011...",
],
"test_variants": [
{
"url": "https://example.com/variant-1",
"percentage": 50,
},
{
"url": "https://example.com/variant-2",
"percentage": 50,
},
],
},
},
})
# Handle response
print(res){
"publicToken": "<string>",
"expires": "<string>"
}