1. Affiliates
Salla Platform Docs
  • Get Started
  • Create Your First App
  • Authorization
  • App Events
  • Handling Add-On Subscriptions
  • Server-Created Checkouts (Checkout SDK)
  • Root
  • App Snippets
    • Intro to App Snippets
    • HTML to JavaScript Snippet Migration
  • App Details Builder
    • Get Started
    • App Information
    • App Features
    • App Reviews
    • App Brands
    • App FAQ
    • App Statistics
  • Settings
    • App Setting Details
      GET
    • Update App Settings
      POST
  • Subscriptions
    • App Subscription Details
      GET
    • Subscription Renew
      POST
    • Update Subscription Balance
      POST
  • Affiliates
    • List Affiliate Links
      GET
    • Get Affiliate Link
      GET
    • Get Insights
      GET
    • Create Affiliate Link
      POST
Merchant
Merchant
  • Merchant API
  • Embedded SDK
  • Salla OAuth 2.0
Storefront
Storefront
  • Twilight (React)
  • Twilight SDK
  • Web Components (Deprecated)
  • Ecommerce Events
  • Component Bundle
  • Checkout APIs
  • Twilight Engine (Deprecated)
  • Change Log
App Functions
Partner APIs
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • Billing System Salla partners
  • Communication Apps
Dev Tools
Dev Tools
  • Partners Agent Kit
  • Salla Apps Playbook
  • Salla CLI
Merchant
Merchant
  • Merchant API
  • Embedded SDK
  • Salla OAuth 2.0
Storefront
Storefront
  • Twilight (React)
  • Twilight SDK
  • Web Components (Deprecated)
  • Ecommerce Events
  • Component Bundle
  • Checkout APIs
  • Twilight Engine (Deprecated)
  • Change Log
App Functions
Partner APIs
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • Billing System Salla partners
  • Communication Apps
Dev Tools
Dev Tools
  • Partners Agent Kit
  • Salla Apps Playbook
  • Salla CLI
Salla - Opensource
Salla - Developers Community
  1. Affiliates

Create Affiliate Link

Production
https://api.salla.dev/admin/v2
Production
https://api.salla.dev/admin/v2
POST
https://api.salla.dev/partners/v1/affiliates/opportunities/links
Last modified:2026-12-03 09:48:09
Create an affiliate link for an opportunity: your main link, or a sub-link (sub-affiliate) under one of your main links. Same checks as the Partners Portal.
Scope
affiliates.read_write
Main link: send opportunity_id (the opportunity.id from the links responses) and omit parent_link_id. Returns 201 with your new main link for the opportunity, or 200 with it if you already have one. name and email are ignored.
Sub-link: send parent_link_id (one of your main links, from List Affiliate Links) with name and email. opportunity_id is optional; if sent it must match the parent link's opportunity. Returns 201 for a new sub-link, or 200 with the existing one when a sub-link with the same name and email already exists under that main link.
The response is the created (or existing) link; parent_link_id, name and email are set for sub-links.
link.short can be null right after creation while it is generated; link.full is returned when the product has a URL template.
Bulk upload (CSV) is not supported through the API.
Rate limit: 4 requests per second per API client.
Errors:
403 insufficient_scope: the client doesn't have affiliates.read_write.
404 page_not_found: the opportunity isn't available to your company, or parent_link_id isn't one of your company's active main links.
422: validation_error (error.fields, e.g. opportunity_id missing without parent_link_id, opportunity_id not matching the parent link, or name/email missing for a sub-link), parent_link_inactive, company_not_verified, affiliate_link_restricted, or upstream_rejected.
429: rate_limited, or request_in_progress when the same link is being created right now.
502 upstream_error / 504 upstream_timeout: nothing was created; retry.

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Header Params

Body Params application/jsonRequired

Example
{
    "name": "Sara Ahmed",
    "email": "[email protected]",
    "opportunity_id": 483380186,
    "parent_link_id": 1634268187
}

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 'https://api.salla.dev/partners/v1/affiliates/opportunities/links' \
--header 'Accept-Language: en' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Sara Ahmed",
    "email": "[email protected]",
    "opportunity_id": 483380186,
    "parent_link_id": 1634268187
}'

Responses

🟢201Created
application/json
A new link was created.
Bodyapplication/json

Example
{
  "status": 201,
  "success": true,
  "data": {
    "id": 1634268201,
    "parent_link_id": 1634268187,
    "name": "Sara Ahmed",
    "email": "[email protected]",
    "link": {
      "short": null,
      "full": "https://apps.salla.sa/en/app/562001483?utm_source=affiliate&utm_campaign=SARA10"
    },
    "code": "SARA10",
    "status": { "slug": "active", "label": "Active" },
    "opportunity": {
      "id": 483380186,
      "visibility": "public",
      "product": {
        "id": 562001483,
        "type": { "slug": "app", "label": "App" },
        "name": "Reports App",
        "link": "https://apps.salla.sa/en/app/562001483"
      },
      "excluded_products": [],
      "platform": { "slug": "partner", "label": "Partner Products" }
    }
  }
}
🟢200Existing
🟠401Unauthorized
🟠403Insufficient scope
🟠404Not found
🟠422Unprocessable
🟠429Too many requests
🔴502Upstream error
🔴503Auth unavailable
🔴504Upstream timeout
Modified at 2026-12-03 09:48:09
Previous
Get Insights