Overview
SDKs
- Overview
- Server-side SDKs
- Client-side SDK
- Embedded Dashboards
APIs
- Links API
- Analytics API
- Conversions API
- Partners API
- Customers API
- Tags API
- Domains API
Create a new referrals embed token
Create a new 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={
"program_id": "<id>",
"partner": {
"name": "<value>",
"email": "Florencio98@hotmail.com",
"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,
},
],
},
},
})
assert res is not None
# Handle response
print(res)
{
"publicToken": "<string>",
"expires": "<string>"
}
Referrals embed token endpoint require an Advanced plan subscription or higher.
Authorizations
Default authentication mechanism
Body
Full legal name of the partner.
1 - 100
Email for the partner in your system. Partners will be able to claim their profile by signing up to Dub Partners with this email.
1 - 190
A unique username for the partner 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.
100
Avatar image for the partner – if not provided, a default avatar will be used.
Country where the partner is based.
AF
, AL
, DZ
, AS
, AD
, AO
, AI
, AQ
, AG
, AR
, AM
, AW
, AU
, AT
, AZ
, BS
, BH
, BD
, BB
, BY
, BE
, BZ
, BJ
, BM
, BT
, BO
, BA
, BW
, BV
, BR
, IO
, BN
, BG
, BF
, BI
, KH
, CM
, CA
, CV
, KY
, CF
, TD
, CL
, CN
, CX
, CC
, CO
, KM
, CG
, CD
, CK
, CR
, CI
, HR
, CU
, CY
, CZ
, DK
, DJ
, DM
, DO
, EC
, EG
, SV
, GQ
, ER
, EE
, ET
, FK
, FO
, FJ
, FI
, FR
, GF
, PF
, TF
, GA
, GM
, GE
, DE
, GH
, GI
, GR
, GL
, GD
, GP
, GU
, GT
, GN
, GW
, GY
, HT
, HM
, VA
, HN
, HK
, HU
, IS
, IN
, ID
, IR
, IQ
, IE
, IL
, IT
, JM
, JP
, JO
, KZ
, KE
, KI
, KP
, KR
, KW
, KG
, LA
, LV
, LB
, LS
, LR
, LY
, LI
, LT
, LU
, MO
, MG
, MW
, MY
, MV
, ML
, MT
, MH
, MQ
, MR
, MU
, YT
, MX
, FM
, MD
, MC
, MN
, MS
, MA
, MZ
, MM
, NA
, NR
, NP
, NL
, NC
, NZ
, NI
, NE
, NG
, NU
, NF
, MK
, MP
, NO
, OM
, PK
, PW
, PS
, PA
, PG
, PY
, PE
, PH
, PN
, PL
, PT
, PR
, QA
, RE
, RO
, RU
, RW
, SH
, KN
, LC
, PM
, VC
, WS
, SM
, ST
, SA
, SN
, SC
, SL
, SG
, SK
, SI
, SB
, SO
, ZA
, GS
, ES
, LK
, SD
, SR
, SJ
, SZ
, SE
, CH
, SY
, TW
, TJ
, TZ
, TH
, TL
, TG
, TK
, TO
, TT
, TN
, TR
, TM
, TC
, TV
, UG
, UA
, AE
, GB
, US
, UM
, UY
, UZ
, VU
, VE
, VN
, VG
, VI
, WF
, EH
, YE
, ZM
, ZW
, AX
, BQ
, CW
, GG
, IM
, JE
, ME
, BL
, MF
, RS
, SX
, SS
, XK
A brief description of the partner and their background.
5000
The ID of the partner in your system.
Additional properties that you can pass to the partner's short link. Will be used to override the default link properties for this partner.
The 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.
255
The 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.
The password required to access the destination URL of the short link.
Whether the short link uses Custom Social Media Cards feature. Defaults to false
if not provided.
The custom link preview title (og:title). Will be used for Custom Social Media Cards if proxy
is true. Learn more: https://d.to/og
The custom link preview description (og:description). Will be used for Custom Social Media Cards if proxy
is true. Learn more: https://d.to/og
The custom link preview image (og:image). Will be used for Custom Social Media Cards if proxy
is true. Learn more: https://d.to/og
The custom link preview video (og:video). Will be used for Custom Social Media Cards 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.
The Android destination URL for the short link for Android device targeting.
Allow 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.
[
{
"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={
"program_id": "<id>",
"partner": {
"name": "<value>",
"email": "Florencio98@hotmail.com",
"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,
},
],
},
},
})
assert res is not None
# Handle response
print(res)
{
"publicToken": "<string>",
"expires": "<string>"
}