API documentation  POST /shortlinks

Create new shortlinks

POST https://demo.trafficmanager.com/api/v1/shortlinks

Authentication:

You have two options:

1. Pass the uid as a POST parameters.

2. Authentication with the following HTTP headers:
  • x-api-key: Your API key, found in the Security page
  • x-user-id: Your User ID, found in the Security page

GET Parameters:

  • none

POST Parameters:

Always required:
  • offers: one or more offer IDs. Multiple comma-separated values are allowed, e.g. offers=45,46,47
Optional:
  • subid
  • subid2
  • subid3
  • subid4
  • pubid
  • utm_source
  • utm_medium
  • utm_campaign
  • utm_term
  • utm_content
  • domain: domain to use for the shortlink. e.g. affiliate-domain.com
  • links_number: number of shortlinks to generate for each offer. Default=1
  • suffix: custom suffix for the shortlink. e.g. abcde, resulting shortlink will be https://affiliate-domain.com/abcde.
    This parameter is incompatible with the links_number parameter.
  • user_id: the user for which the shortlinks will be generated

Response codes:

  • 200: The shortlinks are generated successfully.
  • 400: Invalid request. One or more required fields are missing.
  • 403: Authentication failed.

Returned values:

  • code: see Response codes above
  • offer_id
  • shortlink

Request example

curl --location --request POST 'https://demo.trafficmanager.com/api/v1/shortlinks' \
--header 'x-user-id: 04120c02-0000-439f-9f0a-66624e66fc00' \
--header 'x-api-key: TM04dca746122da971e06665d496ebc450' \
--form 'offers=45' \
--form 'links_number=3' \
--form 'domain=affiliate-domain.com' \
--form 'subid=value1' \
--form 'subid2=value2' \
--form 'subid3=value3' \
--form 'subid4=value4' \
--form 'pubid=value5' \
--form 'utm_source=value6' \
--form 'utm_medium=value7' \
--form 'utm_campaign=value8' \
--form 'utm_term=value9' \
--form 'user_id=5' \
--form 'utm_content=value10'

Response example

Success:
[
    {
        "offer_id": "45",
        "shortlink": "https://affiliate-domain.com/5X4p2P",
        "user_id": "5"
    },
    {
        "offer_id": "45",
        "shortlink": "https://affiliate-domain.com/0YSf6a",
        "user_id": "5"
    },
    {
        "offer_id": "45",
        "shortlink": "https://affiliate-domain.com/26faux",
        "user_id": "5"
    }
]