API of affiliate statistics

Travelpayouts affiliates can receive statistics by Aviasales/Jetradar and Hotellook without needing to enter their personal dashboard. An affiliate may request the following information using the API:

  • the balance
  • payment of the affiliate revenue
  • requests and purchases

This article contains examples of work with the API in the form of http requests. The examples and descriptions of the PHP, Ruby, Python and URL requests are given below "TravelPayouts API".

Data Access

The affiliate security token shall be sent along with a request for data reception. It is available to all affiliates upon registration on your personal dashboards.

mceclip0.png

Balance

Restores the affiliate’s current balance.

Request

http://api.travelpayouts.com/v2/statistics/balance?token=YourApiToken

The request parameters:

  • token — the affiliate’s security token
  • currency — the currency of response

Response

{
	"success":true,
	"data":{
		"balance":1416.07,
		"currency":"RUB"
	}
}

The response parameters

  • success — the response completed successfully (true) or failed (false)
  • balance — the balance of an affiliate’s account

Payment of the affiliate revenue

Returns a list of payments to an affiliate from the date of registration in the Aviasales/Jetradar and Hotellook affiliate programs.

Request

http://api.travelpayouts.com/v2/statistics/payments?token=YourApiToken

The request parameters

  • token — the affiliate’s security token

Response

{
	"success":true,
	"data":{
		"payments":[
			{
				"timestamp":"2015-05-11 05:47:18",
				"status":"paid",
				"currency":"rub",
				"amount":3399.07,
				"comment":"TravelPayouts"
			}
		]
	}
}

The response parameters

  • success — whether the response completed successfully (true) or failed (false)
  • timestamp — the date of payment
  • status — the status of operation (paid — payment of the remuneration)
  • currency — the payment currency
  • amount — the amount of operation
  • comment — the payment comments

Following and purchasing data

Data on date, sub ID and host

Returns the number of searches/clicks/bookings and profit from them, grouped by date, sub ID or host. One month’s figures both for hotels and plane tickets.

Request

http://api.travelpayouts.com/v2/statistics/sales?group_by=date&month=2016-05-14&host_filter=null&marker_filter=null&token=YouApiToken

Request parameters

  • group_by — the way of grouping
    • date — by date
    • host — by host
    • marker — by sub ID
  • month — the month under report
  • host_filter — to filter by the set host. If White Label is used, you can get the data on its performance with this filter
  • marker_filter — to filter by sub ID
  • currency — the currency of response
  • token — affiliate token

Response

{
	"success":true,
	"data":{
		"sales":[
		{
			"key":"2015-05-14",
			"flights":{
				"visitors":1,
				"searches":17,
				"clicks":0,
				"paid_clicks":0,
				"paid_clicks_profit":0,
				"bookings":0,
				"paid_bookings":0,
				"paid_bookings_profit":0,
				"pending_bookings_profit":0
			},
			"hotels":{
				"visitors":0,
				"searches":0,
				"clicks":0,
				"paid_clicks":0,
				"paid_clicks_profit":0,
				"bookings":0,
				"paid_bookings":0,
				"paid_bookings_profit":0,
				"pending_bookings_profit":0
			}
		}
		]
	}
}


Response parameters

  • success — the query has ended true or false
  • key — the reporting date
  • flights — planes ticket database/ hotels — hotel database
    • visitors — the number of people who followed an affiliate link and made at least one search
    • searches — the number of visitors who used the search system (entered a query and pressed "find")
    • clicks — the number of visitors who clicked a link in the search results
    • paid_clicks — the number of paid clicks (several agencies connected to the system pay a charge not for a reservation but for a click on their agency’s link in the search results)
    • paid_clicks_profit — the profit from paid clicks
    • bookings — the number of visitors who booked tickets/rooms in hotels
    • paid_bookings — the number of paid bookings
    • paid_bookings_profit — the profit which the affiliate gained from the paid bookings
    • pending_bookings_profit — the total profit from bookings in "pending" status is displayed

Data according to date and sub ID

This restores the number of searches/clicks/bookings and the benefit received from them grouped by date and additional token.

Request

http://api.travelpayouts.com/v2/statistics/detailed-sales?group_by=date_marker&month=2016-05-14&host_filter=null&marker_filter=null&token=YourApiToken

Request parameters

  • group_by — a way of grouping:
    • date_marker — according to a date and marker
  • month — the month within which the account is formed
  • host_filter — to filter according to the stated host. If White Label is used, it’s possible to get data about its effectiveness with help of this filter
  • marker_filter — to filter according to the sub ID
  • currency — the currency of response
  • token — the affiliate token

Response

{
	"success":true,
	"data":{
		"sales":{
			"2015-05-01":{
				"16886":{
					"flights":{
						"visitors":2,
						"searches":394,
						"clicks":0,
						"paid_clicks":0,
						"paid_clicks_profit":0,
						"bookings":0,
						"paid_bookings":0,
						"paid_bookings_profit":0,
						"pending_bookings_profit":0
					},
					"hotels":{
						"visitors":9,
						"searches":9,
						"clicks":0,
						"paid_clicks":0,
						"paid_clicks_profit":0,
						"bookings":0,
						"paid_bookings":0,
						"paid_bookings_profit":0,
						"pending_bookings_profit":0
					}
				},
				"test":{
						"flights":{
						"visitors":1,
						"searches":1,
						"clicks":0,
						"paid_clicks":0,
						"paid_clicks_profit":0,
						"bookings":0,
						"paid_bookings":0,
						"paid_bookings_profit":0,
						"pending_bookings_profit":0
					},
					"hotels":{
						"visitors":0,
						"searches":0,
						"clicks":0,
						"paid_clicks":0,
						"paid_clicks_profit":0,
						"bookings":0,
						"paid_bookings":0,
						"paid_bookings_profit":0,
						"pending_bookings_profit":0
					}
				}
			}
		}
	}
}


Response parameters

  • success — the query has ended true or false
  • key — the reporting date
  • sales — data store in the context of dates (e.g. 2015-05-01)
  • flights — plane ticket database/ hotels — hotel database
    • visitors — the number of people who followed a affiliate link and made at least one search
    • searches — the number of visitors who used the search system (entered a query and pressed "find")
    • clicks — the number of visitors who clicked a link in search results
    • paid_clicks — the number of paid clicks (several agencies connected to the system pay charge not for a reservation but for a click their agencies’ link in search results)
    • paid_clicks_profit — the profit from paid clicks
    • bookings — the number of visitors who booked tickets/rooms in hotels
    • paid_bookings — the number of paid bookings
    • paid_bookings_profit — the profit which the affiliate gained from the paid bookings
    • pending_bookings_profit — the total profit from bookings in "pending" status is displayed

Was this article helpful?

Have more questions? Submit a request