Getting StartedAPI Reference
Getting StartedAPI Reference
Help Center
Login
  1. Affiliate Links
  • Campaigns
    • Get All Campaigns
      GET
    • Get Campaign By ID
      GET
    • Create campaign
      POST
    • Update campaign
      PUT
    • Delete campaign
      DELETE
  • Affiliates
    • List affiliates
      GET
    • Get Affiliate By ID
      GET
    • Create Affiliate
      POST
    • Update Affiliate
      PUT
    • Delete Affiliate
      DELETE
  • Affiliate Links
    • Get Affiliate Link By Affiliate ID
      GET
    • Create Affiliate Link
      POST
    • Delete Affiliate Link
      DELETE
  • Comissions
    • Get All Commissions
      GET
    • Get Commission By ID
      GET
    • Create Commision
      POST
    • Update Commision
      PUT
    • Delete Commision
      DELETE
  • Referred Users
    • Get All Referred Users
      GET
    • Get Referred User by Email
      GET
    • Create Referred User
      POST
    • Update Referred User
      PUT
    • Delete Referred User
      DELETE
Getting StartedAPI Reference
Getting StartedAPI Reference
Help Center
Login
  1. Affiliate Links

Create Affiliate Link

POST
/links
Last modified:2025-12-29 19:13:27
Creates a new referral link for an affiliate using a unique referral code.
This endpoint generates a trackable link that attributes traffic, signups, and commissions to the specified affiliate.

Request

Header Params

Body Params application/json

Example
{
  "affiliateId": "05ddfd92-1abe-41e6-8bad-467256954bc6",
  "referralCode": "sand",
  "urlParameter": "via"
}

Request Code Samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/links' \
--header 'x-auth-referralstack: rs_live_e6761c15744c9be53be18802278fd3da751d03ce' \
--header 'Content-Type: application/json' \
--data-raw '{
  "affiliateId": "05ddfd92-1abe-41e6-8bad-467256954bc6",
  "referralCode": "sand",
  "urlParameter": "via"
}'

Responses

🟢200Success
application/json
Body

Example
{
    "status": 201,
    "message": "Link created successfully",
    "data": {
        "id": "c5c3a8be-8ff1-432f-9a6f-71f50e221775",
        "referralCode": "sand",
        "url": "https://example.com?via=sand",
        "urlParameter": "via",
        "userId": "2d4c2004-5dcc-4251-947c-05caf702eff6",
        "affiliateId": "5cb1b6bd-6500-4282-a67b-e96a8f34b321",
        "campaignId": "9112d17b-0c77-45ab-a82f-f963f135b63d",
        "totalOpens": 0,
        "totalClicks": 0,
        "totalSignups": 0,
        "totalEarnings": 0,
        "createdAt": "2025-12-29T07:56:49.290Z",
        "updatedAt": "2025-12-29T07:56:49.290Z"
    }
}
🟠400Bad request (Missing AffiliateId)
🟠400Bad request (Wrong UrlParameter)
🟠401Unauthorized (Missing API Key)
Modified at 2025-12-29 19:13:27
Previous
Get Affiliate Link By Affiliate ID
Next
Delete Affiliate Link
Built with