POST
/
partners
from dub import Dub


with Dub(
    token="DUB_API_KEY",
) as d_client:

    res = d_client.partners.create(request={
        "program_id": "<id>",
        "name": "<value>",
        "email": "Loyal79@yahoo.com",
        "link_props": {
            "external_id": "123456",
            "tag_ids": [
                "clux0rgak00011...",
            ],
        },
    })

    assert res is not None

    # Handle response
    print(res)
{
  "id": "<string>",
  "name": "<string>",
  "email": "<string>",
  "image": "<string>",
  "description": "<string>",
  "country": "<string>",
  "payoutsEnabledAt": "<string>",
  "createdAt": "<string>",
  "status": "pending",
  "programId": "<string>",
  "tenantId": "<string>",
  "links": [
    {
      "id": "<string>",
      "domain": "<string>",
      "key": "<string>",
      "shortLink": "<string>",
      "url": "<string>",
      "clicks": 0,
      "leads": 0,
      "sales": 0,
      "saleAmount": 0
    }
  ],
  "clicks": 0,
  "leads": 0,
  "sales": 0,
  "saleAmount": 0,
  "earnings": 0,
  "applicationId": "<string>"
}

Partners endpoints require an Advanced plan subscription or higher.

Authorizations

Authorization
string
header
required

Default authentication mechanism

Body

application/json
programId
string
required

The ID of the program to create a partner for.

name
string
required

Full legal name of the partner.

Required string length: 1 - 100
email
string
required

Email for the partner in your system. Partners will be able to claim their profile by signing up to Dub Partners with this email.

Required string length: 1 - 190
username
string | null

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.

Maximum length: 100
image
string | null

Avatar image for the partner – if not provided, a default avatar will be used.

country
enum<string> | null

Country where the partner is based.

Available options:
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
description
string | null

A brief description of the partner and their background.

Maximum length: 5000
tenantId
string

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.

Response

201
application/json
The created partner
id
string
required
name
string
required
email
string | null
required
image
string | null
required
country
string | null
required
payoutsEnabledAt
string | null
required
createdAt
string
required
status
enum<string>
required
Available options:
pending,
approved,
rejected,
invited,
declined,
banned
programId
string
required
tenantId
string | null
required
clicks
number
default:0
required
leads
number
default:0
required
sales
number
default:0
required
saleAmount
number
default:0
required
earnings
number
default:0
required
description
string | null
applicationId
string | null