API of affiliate statistics

The partners can receive the statistics without the need to enter into their personal account. A partner may request the following information using the API:

  • on the balance;
  • on payment of the partner remuneration;
  • on the requests and purchases.

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

 

Data Access

The partner security token shall be sent together with a request for data reception. It is available to all partners upon registration of their personal accounts.

Balance

Restores the partner’s current balance.

Request

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

The request parameters:

  • token – the partner’s security token.

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 a partner’s account;
  • curbrency – the account currency.

 

Payment of the Partner’s Remuneration

Returns a list of payments to a partner from the date of registration in the partner program.

Request

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

The request parameters

  • token - the partner’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 - 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, addittional marker and host

Returns the number of searches/clicks/bookings and profit from them, grouped by date, additional marker 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 additional marker.
  • 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 additional marker;
  • token – partner 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 – reporting date;
  • flights – plane ticket database/ hotels – hotel database
    • visitors – a number of people who followed a partner link and made at least one search;
    • searches – a number of visitors who used the search system (entered a query and pressed “find”);
    • clicks – a number of visitors who clicked a link in search results;
    • paid_clicks – a 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 – profit from paid clicks;
    • bookings – a number of visitors who booked tickets/rooms in hotels;
    • paid_bookings – a number of paid bookings;
    • paid_bookings_profit – the profit which the partner gained from the paid bookings;
    • pending_bookings_profit – the total profit from bookings in “pending” status is displayed.

 

Data according to date and additional marker

It 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 – way of grouping:
    • date_marker – according to date and marker.
  • month – month within which the account is formed;
  • host_filter – filter according to the stated host. If White Label is used in work, it’s possible to get the data of its effectiveness with help of this filter;
  • marker_filter – to filter according to the additional marker;
  • token – partner 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 – reporting date;
  • sales – data store in the context of dates (e.g. 2015-05-01);
  • flights – plane ticket database/ hotels – hotel database
    • visitors – a number of people who followed a partner link and made at least one search;
    • searches – a number of visitors who used the search system (entered a query and pressed “find”);
    • clicks – a number of visitors who clicked a link in search results;
    • paid_clicks – a 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 – profit from paid clicks;
    • bookings – a number of visitors who booked tickets/rooms in hotels;
    • paid_bookings – a number of paid bookings;
    • paid_bookings_profit – the profit which the partner 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