Register Affiliate API

Registers a new affiliate using your own registration page.

POST https://{base_url}/api/register_affiliate

Request Headers

Header Value Required
Content-Type application/json Yes
Accept application/json Yes
x-api-key {your-api-key} Yes

Request Body

The request body should contain a JSON object with the affiliate's registration details.

{
  "app_id": "your_app_id",
  "first_name": "John",
  "last_name": "Doe",
  "password": "securePass1",
  "email": "john@example.com",
  "username": "johndoe",
  "website_url": "https://john.example.com",
  "phone_number": "+441234455",
  "skype": "john1234",
  "telegram": "john1234",
  "youtube": "@johnchannel",
  "facebook": "john1234",
  "whatsapp": "john1234"
}

Attributes

Attribute Type Required Description
app_id String Yes Unique identifier for your application provided by your Account Manager
first_name String Yes Affiliate's first name
last_name String Yes Affiliate's last name
password String Yes Account password. Must be at least 8 characters
email String Yes Affiliate's email address. Must be a valid email format and unique per application
username String Yes Desired username. Must be unique per application
website_url String No Affiliate's website URL. Must start with http:// or https://
phone_number String No Phone number in international format
skype String No Skype handle
telegram String No Telegram handle
youtube String No YouTube channel. Accepts a full URL (e.g. https://www.youtube.com/@handle) or just the handle (e.g. @handle)
facebook String No Facebook handle
whatsapp String No WhatsApp contact
Note: Optional fields that are sent as null or an empty string will be ignored and not stored.

Validation Rules

Field Rule
app_id, first_name, last_name, password, email, username Required. Cannot be null or empty
password Minimum 8 characters
email Must be a valid email format. Must be unique within the application
username Must be unique within the application
website_url If provided, must be a valid URL starting with http:// or https://
phone_number If provided, must be in international format starting with + followed by 7–20 digits. Spaces, dashes, and parentheses are allowed (e.g. +441234455 or +1 (234) 567-8900)
skype If provided, must be 6–32 characters, start with a letter, and contain only letters, numbers, periods, commas, dashes, or underscores
telegram If provided, must be 5–32 characters and contain only letters, numbers, or underscores
youtube If provided, must be a full YouTube URL (e.g. https://www.youtube.com/@handle) or a handle (e.g. @handle)
facebook If provided, must be 5–50 characters and contain only letters, numbers, or periods
whatsapp If provided, must be in international phone format starting with + followed by 7–20 digits. Spaces, dashes, and parentheses are allowed (e.g. +441234455)

Code Snippet

curl -X POST "https://{base_url}/api/register_affiliate" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "x-api-key: your_api_key" \
  -d '{
    "app_id": "your_app_id",
    "first_name": "John",
    "last_name": "Doe",
    "password": "securePass1",
    "email": "john@example.com",
    "username": "johndoe",
    "website_url": "https://john.example.com",
    "phone_number": "+441234455",
    "skype": "john1234",
    "telegram": "john1234",
    "youtube": "@johnchannel",
    "facebook": "john1234",
    "whatsapp": "john1234"
  }'
 

Response

Success Response (200 OK)

{
  "login_url": "https://affiliate.yourdomain.com",
  "affiliate_id": "aff_abc123"
}
Field Type Description
login_url String The URL where the newly registered affiliate can log in to their portal
affiliate_id String The unique identifier assigned to the newly created affiliate

Validation Error Response (400 Bad Request)

{
  "errors": [
    "email is required and cannot be empty",
    "password must be at least 8 characters"
  ]
}

Duplicate Email Error (400 Bad Request)

{
  "errors": [
    "email is invalid"
  ]
}

Duplicate Username Error (400 Bad Request)

{
  "errors": [
    "username is invalid"
  ]
}

Invalid Body (400 Bad Request)

{
  "errors": [
    "body is invalid"
  ]
}

Server Error (500 Internal Server Error)

{
  "errors": [
    "error message"
  ]
}

Forbidden (403 Forbidden)

{
  "message": "Forbidden"
}
Note: A 403 Forbidden response indicates that the provided x-api-key is invalid or missing.
 
Close Modal