API of affiliate booking, balance and payment (deprecated)

Note! The APIs from this article are deprecated. For financial statistics, use the information from the article "API of affiliates balance and payment".

 

Travelpayouts affiliates can receive statistics by Aviasales 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

Please note, API methods use limits, which are described in the article API rate limits.

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 dashboard.

mceclip1.png

Balance (deprecated)

Restores the affiliate’s current balance.

Request

https://api.travelpayouts.com/v2/statistics/balance?token=api_token

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 (deprecated)

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

Request

https://api.travelpayouts.com/v2/statistics/payments?token=api_token

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 (deprecated)

The v2/statistics/sales and v2/statistics/detailed-sales methods are deprecated. We recommend switch to the new API of affiliate programs statistics.

Data on date, SubID and host (deprecated)
Returns the number of searches/clicks/bookings and profit from them, grouped by date, SubID or host. One month’s figures both for hotels and plane tickets.

Request

https://api.travelpayouts.com/v2/statistics/sales?group_by=date&month=2020-05-14&host_filter=null&marker_filter=null&token=api_token

Request parameters

  • group_by — the way of grouping
    • date — by date
    • host — by host
    • marker — by SubID
  • 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 SubID
  • currency — the currency of response
  • token — affiliate token

Response

{
	"success":true,
	"data":{
		"sales":[
		{
			"key":"2020-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 SubID (deprecated)

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

Request

https://api.travelpayouts.com/v2/statistics/sales?group_by=date&month=2020-05-14&host_filter=null&marker_filter=null&token=api_token

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 SubID
  • currency — the currency of response
  • token — the affiliate token

Response

{
	"success":true,
	"data":{
		"sales":{
			"2020-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