API for Travelpayouts partner links

The Travelpayouts partner links API allows users to convert direct links to travel brand websites into partner links quickly without needing to use the Travelpayouts personal account.

Requirements

  1. Sign up for Travelpayouts
  2. Connect to any brands, which links you want to get using the given API.
  3. API token. It is available after signing up on the Travelpayouts platform. You can find the API token in the Profile tab on the API token tab.
    The token is submitted to the Header of the request in the X-Access-Token parameter.

Limits

  • Maximum 100 requests per minute per marker.
  • A single request can contain no more than 10 links.
  • For proper API functionality, do not use short brand links, use full-length links instead.
  • You can’t use API for the links of brand from the list below:
    • Kiwi.com
    • Expedia UK
    • HolidayTaxis
    • Ticketmaster
    • Priority Pass
    • Indrive

Request

POST https://api.travelpayouts.com/links/v1/create

Example request:

{
  "trs": 197987,
  "marker": 339296,
  "shorten": true,
  "links": [
      {
          "url": "https://yesim.app/country/turkey/3days-500mb-esim-data-plan/",
          "sub_id": "example"
      }
  ]
}
Example request with multiple links
{
  "trs": 197987,
  "marker": 339296,
  "shorten": false,
  "links": [
      { "url": "https://www.aviasales.ge/search/TBS1803PAR1" },
      { "url": "https://booking.com/hotels/paris/aqueduc" }
  ]
}

Request parameters

  • trs – Project ID subscribed to the brand program (can be found in the project list).
  • marker – unique partner ID in Travelpayouts.
  • shorten – flag for generating a short link. Possible values: true/false. If true, a short link is generated; if false, a long link is returned.
  • Links – an array of links is to be converted.
  • url – the original brand link. Be sure to use long links instead of shortened ones.
  • sub_id (optional) – a text value that can be used to track statistics on partner links in you Travelpayouts account.

Response example

{
  "result": {
      "trs": 197987,
      "marker": 339296,
      "shorten": true,
      "links": [
          {
              "url": "https://yesim.app/country/turkey/3days-500mb-esim-data-plan/",
              "code": "success",
              "partner_url": "https://yesim.tp.st/kn3kv29H?erid=2VtzqwiKLkx"
          }
      ]
  },
  "code": "success",
  "status": 200
}

Response parameters

  • trs – Project ID subscribed to the brand program.
  • marker – Unique partner ID in Travelpayouts.
  • shorten – If true, a short link is returned; if false, a long link is returned.
  • links – The original links to be converted.
  • code – Indicates whether the link conversion was successful.
  • partner_url – The final partner link.
  • code – Indicates whether the request was successful.
  • status – The status of the request.

Possible errors

Invalid token

  • Code: 401 Unauthorized

Invalid trs

{
   "code": "incorrect_request_body",
   "error": "invalid traffic source",
   "status": 400
}

Invalid marker

{
   "code": "incorrect_request_body",
   "error": "incorrect marker in the request",
   "status": 400
}

Invalid url

{
   "result": {
       "trs": 197987,
       "marker": 339296,
       "shorten": true,
       "links": [
           {
               "url": "1https://www.trip.com/?SID=2209817&",
               "code": "failed",
               "message": "can't create partner link",
               "partner_url": ""
           }
       ]
   },
   "code": "success",
   "status": 200
}

Not subscribed to brand

{
   "result": {
       "trs": 197987,
       "marker": 339296,
       "shorten": true,
       "links": [
           {
               "url": "https://www.airalo.com/ru/georgia-esim/kargi-mobile-7days-1gb",
               "code": "failed",
               "message": "trs is not subscribed for brand",
               "partner_url": ""
           }
       ]
   },
   "code": "success",
   "status": 200
}

Brand not supported by Travelpayouts

{
   "result": {
       "trs": 197987,
       "marker": 339296,
       "shorten": true,
       "links": [
           {
               "url": "https://www.amazon.com/travel/?__rr=1",
               "code": "failed",
               "message": "can't create partner link",
               "partner_url": ""
           }
       ]
   },
   "code": "success",
   "status": 200
}