Skip to content

Aviasales Android SDK API documentation

tarlin1989 edited this page Mar 18, 2019 · 27 revisions

Aviasales SDK API is an .aar library which responsible for connection to Aviasales search engine.



Add gradle dependencies

To add dependencies in the project use the gradle:

repositories {
    maven { url '' }

dependencies {
    compile 'ru.aviasales:aviasalesSdk:2.1.15-sdk'


Before usage of sdk API it should be initialized

 AviasalesSDK.getInstance().init(this, new SdkConfig(215642, 86964a35ddb810815855fab1ca3e39f5, SDK_HOST));

Change TRAVEL_PAYOUTS_MARKER and TRAVEL_PAYOUTS_TOKEN to your marker and token params. You can get them at

SDK_HOST is a main endpoint of Aviasales SDK. You can set your default endpoint, but we strongly recommend to change it to your WhiteLabel host.

Specify permissions

Specify the permissions INTERNET and ACCESS_NETWORK_STATE by adding <uses-permission> elements as children of the <manifest> element.

	<uses-permission android:name="android.permission.INTERNET"/>
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>


Ticket search

To start ticket search create SearchParams:

		SearchParams params = new SearchParams();

		//originIata and destinationIata is Iatas of your current search 
		// dates are set in "yyyy-MM-dd" format (SearchParams.SEARCH_PARAMS_DATE_FORMAT)
		params.addSegment(originIata, destinationIata, departureDate);

		// this is return segment
		params.addSegment(destinationIata, originIata, returnDate);

		//set number of passengers
		params.setPassengers(new Passengers( 1, 0, 0 ); // number of adults, childrens, infants

		// trip class could be SearchParams.TRIP_CLASS_ECONOMY
		// or SearchParams.TRIP_CLASS_BUSINESS

		// pass application context
		// set currency

Aviasales SDK supports complex search with multiple segments. You can add up to 8 segments

		params.addSegment("MOW", "LED", "2018-09-06");
		params.addSegment("LED", "BER", "2018-09-08");
		params.addSegment("BER", "ROM", "2018-09-10");
		params.addSegment("ROM", "MOW", "2018-09-12");

Start ticket search:

                   searchParams, new SearchListener() {
		... // Listener for response 

Finding places

Create SearchByNameParams:

	SearchByNameParams params = new SearchByNameParams();
	//Set search text

	// Locale for searching . For now Aviasales supports ru, en, fr, de, it, es, th, pl, pt locales

Start places search

		AviasalesSDK.getInstance().startPlacesSearch(params, new OnSearchPlacesListener() {
		... // Listener for response 

Buying ticket

Start buy process:

	// proposal is ticket which user selected for purchase. List of proposals returns after successful search and stored in AviasalesSDK.getInstance.getSearchData().getProposals();
	// gateKey is gate ID of purchased proposal
	AviasalesSDK.getInstance().startBuyProcess(proposal, String gateKey,new BuyProcessListener() {
		... // Listener for response 

Search nearest airports

	AviasalesSDK.getInstance().getNearestPlaces(java.lang.String locale, new OnNearestPlacesListener() {
		... // Listener for response 

For more information see the demo project

Additional partner marker

In the app you can add additional affiliate marker. This is useful, for example, to monitor the actions of different users. To do this, initialize AviasalesSDK with IdentificationData constructor :

AviasalesSDK.getInstance().init(getApplicationContext(), new SdkConfig(TRAVEL_PAYOUTS_MARKER, YOUR_ADDITIONAL_MARKER, SDK_HOST, TRAVEL_PAYOUTS_TOKEN));


Main class of API library is

More information about API library you can get at Aviasales API javadoc.

Aviasales SDK Template project

Template project screens

You can’t perform that action at this time.