Frequently Asked Questions

Check out some general and technical frequently asked questions and answers about Cleartrip API.

Flights API Reference

Contents

Introduction

The Cleartrip Fligts API allows a user to search and book flights using a REST based service. XML is used for most (but not all) server/client communication. As an API consumer, you need an API key to use this service. You can read more about REST, XML and the API key in the Getting Started Guide.

Service URLs: The service is available at https://api.cleartrip.com/. Access to the staging (test) environment is available at http://api.staging.cleartrip.com/.

Schema files have been provided in two formats: RelaxNG Compact (RNC), and XML Schema Definition (XSD). Schema files have been defined wherever XML is required (either as request or response). All the schemas inherit from a common schema definition: air-common. The two schema files for air-common are air-common.rnc and air-common.xsd.


The search request is a simple HTTP GET request. The query parameters described below should be sent along with the search URL, the user’s API key and the Source Type in the HTTP headers. A successful response will always return the HTTP status code 200. (Note that a status code of 200 doesn’t necessarily mean that the search result will contain flights; there might not have been any flights found on that route). A successful search also returns an XML response with the root element as air-search-result .

Request Details

Production URL:
https://api.cleartrip.com/air/1.0/search
Staging URL:
http://api.staging.cleartrip.com/air/1.0/search
Request method:
HTTP GET
Sample request
http://api.cleartrip.com/air/1.0/search?from=BOM&to=DEL&depart-date=2015-02-15&return-date=2015-02-20&adults=1&country=IN&currency=INR

Header Details

API Key (Mandatory)
X-CT-API-KEY
Format : Alphanumeric provided by Cleartrip
Encoding (Mandatory)
Accept-encoding
Value : gzip
Source Type (Optional)
X-CT-SOURCETYPE
Allowed Values : B2C, API
Default Value : API
Note: If the Booking Request is sent to Cleartrip, then for Price Parity checks the Source type should be B2C

Search parameters

The various search parameters are described below:

Name Description Format Default Example Allowed values
from The origin city or the airport A valid IATA code (none) BOM
to The destination city or the airport A valid IATA code (none) DEL Cannot be the same as the from value
depart-date The departure date A valid ISO date (YYYY-MM-DD) (none) 2008-10-20 This should be the date within a year from the search date
return-date The return date. If you don't want to search for round-trip flights and instead just one-way flights, skip this parameter, or set it to null. A valid ISO date (YYYY-MM-DD) null 2008-10-30 This should be the date within a year from the search date
adults The number of adults Valid integer not greater than 9 1 2
children Number of children Valid integer not greater than 9 0 1
infants The number of infants Valid integer not greater than 9 0 1 Should not be greater than the number of adults.
carrier Airline preference Airline IATA code Any 9W
cabin-type Cabin type Economy or e, first or f, premium economy or p, business or b Economy Business
permitted-carriers Gets results with the specified carriers yes or no (none) AI-IT-G8
prohibited-carriers Results exclude the specified carriers yes or no (none) AI-IT-G8
sort Sorts the search results in ascending or descending order of prices. The parameter is case sensitive and should match exactly as described in the Allowed values column. A search without this parameter or the one, which does not satisfy the allowed values will not sort the result. String - asc or desc (none) asc asc, desc
country Source country String IN AE
currency Source currency String INR AED

Response details

If the search was successful, the response body returns an XML along with the HTTP status code 200. If any error is encountered during the search, the response body contains an XML with the root element error . See the schema and sample search result XML for more details.

Content type: application/xml
Schema: search-result.rnc, search-result.xsd
Sample XML: search-result.xml,search-result-international.xml
Note: If the segments are priced together, then pricing for those segments are shown together.

Error Messages obtained while Searching the Flights

The error messages that you might get for an invalid search request:

Description Error Message
CabinType invalid The Cabin type must be of length 1 and should be one of { E | P | B | F } or it must be passed as an exact keyword { Economy | Premium Economy | Business | First }
Departure and Arrival Airport are similar The Origin and the Destination codes must be different.
Airport Code Invalid Invalid IATA Code XXX - Please ensure that the destination and the origin airport codes are valid. Please use http://www.cleartrip.com/common/json/airports.json as a reference, if you are not sure.
Return Flight Invalid There must be a gap of atleast 3 hours between the arrival of last flight of onward journey and departure of first flight of return journey.
Flight Number Invalid The Flight Number is invalid. It is a required field and should have a length of atleast 1 character.
Airline Code Invalid Invalid carrier codes: Please use valid carrier codes. Please use http://www.cleartrip.com/common/json/airlines.json as a reference, if you are not sure.
Departure Date format Invalid Invalid departure date format. Please provide all dates in the format YYYY-MM-DD.
Departure Date Invalid Provide a valid departure date in the next 365 days.
Return Date Invalid Provide a valid return date, which is AFTER the departure date.
Number Of Passengers Exceeded Invalid number of passengers. Provide a valid integer between 1 and 9.
Infant Count Invalid The number of adults MUST exceed the number of infants in a booking.
Child DOB Unavailable Date of birth is unavailable for the child passenger.
Infant DOB Unavailable Date of birth is unavailable for the infant passenger.
Child Age Invalid Age of the child must be between 2 to 12 years on the day of departure.
Infant Age Invalid Age of the infant must be between 0 to 2 years on the day of departure.
DOB format Invalid The date of birth for Child / Infant passenger is invalid. Please provide all the dates in the format YYYY-MM-DD.

Note:The HTTP status code 502 (Bad Request) will be sent along with the error messages.


How to avail special round trip discount?

Round Trip Discount fares are special domestic round trip fares. This can be identified by the Combo-Code. The following are the combinations that need to be matched to identify the fare as special round trip fare.

Note: Combo-Code match can be performed within the same airline. For eg: 6E(Indigo) can be combined with 6E(Indigo) only, it can't be combined with G8(GoAir).

Airlines Combination
GoAir Onward combo-code matches with the return combo-code.
Indigo Any onward fare can be combined with any return fare.
Spicejet Any onward fare can be combined with any return fare.
Air India Supplier should be AMADEUS_RT and onward combo-code should contain the return flight no. and return combo-code should contain the onward flight no.
Jet-Airways, Jet-Konnect Supplier should be AMADEUS_RT and onward combo-code should contain the return flight no. and return combo-code should contain the onward flight no.

Examples:

Case Sample XML Description
Combinable roundtrip fare special_rt_combinable.xml Combo-code for the onward solution matches the return flight number and combo-code for the return solution matches the onward flight number. So, the fares can be combined to get a special roundtrip fare.
Non-combinable roundtrip fare, as airlines are different special_rt_non_combinable_airline.xml Airline of the onward solution doesn't match with the airline of the return solution. So, the fares cannot be combined.
Non-combinable roundtrip fare, as combo-code match fails special_rt_non_combinable_combo_code.xml Combo-code for the onward solution doesn't match with the return flight number. So, the fares cannot be combined.

Note: Only for Air-India, Jet-Airways and Jet-Konnect

1) If an onward solution is combinable with multiple return solutions, the combo-code node of the onward solution might contain multiple return airline-codes, separated by comma. For eg: If an AI-101 onward solution is combinable with 3 return solutions AI-201, AI-301 and AI-401 respectively, then the onward combo-code value should be '201,301,401'.
But, it's not always necessary. There are cases, where the response does not contain comma separated combo-code for multiple combinations, rather it does have separate solution for each combo-code.

2) If an onward solution is combinable with a return solution, which is routed, the combo-code node of the onward solution contains all the airline-code of the return solution, separated by '$'. For eg: If an AI-101 onward solution is combinable with a return solution containing AI-201, AI-301 and AI-401 respectively, then the onward combo-code value should be '201$301$401'.


Booking a Flight

Using the flights booking service requires the creation of an itinerary. An itinerary contains complete details about a flight booking, pricing, passenger, contact and payment details. The following actions can be performed on an itinerary:

Booking a flight(s) basically involves creating an itinerary and booking it. The view itinerary service can be used to view the itinerary details at any point. A detailed description of each of these services is provided below.


Create Itinerary

The user sends an itinerary request (see the sample request XML and the schema) to create an itinerary on the cleartrip servers. All the relevant booking details are collected from the user. This includes:

Flight details:
This specifies about every segment that the user wants to book. Segment details are provided using the segment-spec element, which is under flight/flight-spec/segments in the itinerary request. A flight-spec corresponds to a flight in the search result response, while a segment-spec corresponds to a segment .
Fare Key:
While creating an itinerary, the API user can pass the fare-key for each flight that he wishes to book(optional). The fare-key is used to identify and check the pricing information for that particular flight. If the fare-key is passed, then the price check will be performed by the Cleartrip API, which verifies the price seen during the search. If the fare-key is not passed, then the API user is responsible for doing the price check at their end and verify the flight being booked for any price change.
Cabin type:
The cabin type that the user wants to book (e.g. Economy, Business, etc). This is provided under the cabin-type element.
Passenger (pax) details:
This specifies the passenger details. For an adult passenger, just specify the pax name and type (ADT) . But, for child and infant pax, the date of birth is required. The details about each pax are provided under the pax-info tag under pax-info-list.
Note : date-of-birth for adult and pax-nationality for all paxType (under pax-info tag) is made mandatory by Air Asia for both Domestic and International. If not passed, bookings will fail.
Frequent flier number:
The details about the frequent flier number should be provided under the frequent-flier-numbers tag under frequent-flier-number. This should be provided under parent tag pax-info.
Contact details:
User contact details such as name, address, email-id, mobile, landline, city, state, country and pin-code. These are provided under the contact-detail element.
Payment details:
Only deposit account payments are accepted at this time. Under special circumstances, credit card payments are accepted. Please email api.support@cleartrip.com for details. Payment details are provided under the payment-detail element and is optional. However, payment details are required on Book Itinerary.

The user is not required to send the pricing information and is calculated by the server itself, after processing the itinerary request. The itinerary response provides all the relevant pricing details. The API user should check the pricing details (see payment-detail/amount ) in the response, to confirm whether the pricing has remained the same as appeared on the search.

Once an itinerary has been created, an itinerary-id is assigned. Itinerary details can be fetched using the itinerary-id. However, an itinerary is available only for an hour after it has been created. At the end of one hour, an itinerary is expired and it is not possible to fetch the details (unless the itinerary was booked, and at this point it becomes a trip, and its details can be fetched using the retrieve trip service).

Request Details

Production URL:
https://api.cleartrip.com/air/1.0/itinerary/create?country=IN&currency=INR
Staging URL:
http://api.staging.cleartrip.com/air/1.0/itinerary/create?country=IN&currency=INR
Request method:
HTTP POST
Schema:
itinerary-request.rnc, itinerary-request.xsd
Sample XML:
itinerary-request.xml,itinerary-request-international.xml
Note: If the specific country/currency code is passed in a search request, then the same country/currency code has to be passed in createItinerary call as request params along side the url.

Input Restrictions

(Note: Please go through the schema to know about basic input restrictions. This section details argument restrictions, which cannot be provided by the schema.)

  1. The departure and the arrival airport should not be the same.
  2. The date value cannot exceed 364 days from today’s date.
  3. While booking a return ticket, the departure date for the return cannot be less than the departure of the onward journey.
  4. Mobile and Landline numbers should include the country and the area code.
  5. Debit cards and International credit cards are not supported.
  6. The total number of passengers(adults and children) in a booking cannot exceed 9.
  7. The total number of infants should not exceed the total number of adults.
  8. All the passengers information must be provided.
  9. Child passengers DOB must be provided, and the age restriction for the child is 2-11 years.
  10. Infants DOB must be provided, and the age restriction for the infant is 0-23 months.

Server Side Validation

While creating an itinerary, following xml validations are being done on the server side. Please note that many of these might not be validated at the xsd schema level:

Field Validation Reference
X-CT-API-KEY
  • The cleartrip APIs are accessible with the given API key. It must be ensured to use the right key for the right environment.
cabin-type
  • Cabin type must be of length 1 and should be one of { E | P | B | F } or it must be passed as the exact keyword { Economy | Premium Economy | Business | First }.
air-common.xsd
payment-type
  • Payment type is invalid in the payment detail section. Payment must be made using a Deposit Account and the code DA should be passed.
  • Note: Following the RBI regulation in Aug 2009, Credit Card payments ( code CC ) are allowed ONLY for mobile based transactions. Please send an email to api.support@cleartrip.com for details.
air-common.xsd
credit-card-expiry-date
  • This is a required field in case payment is made through a credit card. Card should be active and the expiration date should be passed in the format YYYY-MM.
  • The value should be equal or after to the current month and year.
air-common.xsd
departure-and-arrival-airports (title)
  • The Origin and the destination airport codes should be different.
air-common.xsd
airport-code
  • The Origin and the destination airport codes must be valid IATA codes. Refer to http://www.cleartrip.com/common/json/airports.json as a reference.
air-common.xsd
return-flight
  • There must be a gap of atleast 3 hours between the arrival of the last flight of the onward journey and departure of the first flight of the return journey.
air-common.xsd
flight-number
  • The flight number should have a length of atleast 1 character.
air-common.xsd
airline-code
  • Invalid carrier codes. Please use http://www.cleartrip.com/common/json/airlines.json as a reference.
air-common.xsd
departure-date
  • Invalid departure date. Please use YYYY-MM-DD format. For validity, ensure that the departure date is in the next 365 days.
  • Note: For some domestic flights a minimum of 3 hours is required between the booking and the flight departure time. For international flights, you will not get ANY results if you search for flights within 48 hours.
air-common.xsd
return-date
  • Invalid return date. Please use YYYY-MM-DD format. For validity, ensure that the return date is greater than the departure date.
air-common.xsd
pax-count
  • Invalid number of passengers. Provide a valid integer between 1 and 9. Some airlines restrict the number of passengers, we request availability for. This will, in turn, restrict the number of results you get back from the Cleartrip API.
air-common.xsd
infant-count
  • The number of adults MUST be greater than or equal to the number of infants in a booking.
air-common.xsd
date-of-birth
  • If you are booking for children and or infants, a valid date of birth in the format YYYY-MM-DD must be provided. The age of the child must be between 2 and 11 years and the age of the infant must be between 0 and 23 months at the time of departure.

  • For International flights :

    Adult's date of birth must be passed to the following airlines: SG,RQ,XY,TR,G9,AK,FR,I5,3O,D7,QZ,LS,J9,4U,TT,B6,EI,FD,WW,5J,XR,VC,JE,E3,7H, WS,8J,JQ,3K,ZL,VY,AB,PC,DE,X5,5W,L9,LZ,BE,F7,RE,I9,ML,AP,SZ,L9,KF,BV,WX, T3,FC,FZ,TCX,F9,NM,8N,O6,JZ,BY,HV,IV,WJ,AF,MT,X3,JW,IG,SI,FL,VB,3L,2L,FY,BN, U2,SA,XC,W6,3J,RI,VF,BL,2P,DG,OD,BA,SQ,DL,EK,PK,TK,UA,KL,AA,US,LH,AC,BD,EY,AI, QR,AZ,KU,CI,GF,MU,MS,MH,QF,UL,LX,AY,TO

  • For Domestic flights :

    Adult's date of birth must be passed only for I5(Air-Asia) airline.
air-common.xsd
address
  • Length of the address must not exceed 200 characters.
air-common.xsd
city-name, state-name, country-name
  • City name is a required field and should not exceed 50 characters.
  • State name is a required field and should not exceed 50 characters.
  • Country name is a required field.
air-common.xsd
pin-code
  • Pin Code is a required field and should be between 1 and 12 characters in length.
air-common.xsd
title
  • Title for adults, children and infants should be a valid value from one of the following { ( ADT : Mr , Ms , Mrs ), ( CHD, INF : Mstr, Miss ) }.
air-common.xsd
first-name
  • First name must match the regular expression [a-zA-Z ]+. Its a required field and must not exceed 25 characters.
air-common.xsd
last-name
  • Last name must match the regular expression [a-zA-Z ]+. Its a required field and must not exceed 25 characters.
air-common.xsd
name
  • Name for adults, children, and infants should be a valid value, not exceeding 27 characters including the title and should not contain any special characters or numbers.
air-common.xsd
phone-number
  • It is a required field.
  • Mobile number must be greater than or equal to 10 and less than or equal to 30.
  • Landline number must be greater than or equal to 8 and less than or equal to 30.
air-common.xsd
insurance
  • The insured tag should contain a valid value - one of { true | false , t | f , yes | no , y | f }.
  • The number of days for insurance is a mandatory field for international trips. It should be 90 days or the duration of the trip in case of round trips, whichever is smaller.
  • The maximum insurance allowed for domestic trips is 30 days.
air-common.xsd
number-of-days
  • The insured tag should contain a valid value - one of { true | false }.
  • The number of days for insurance is a mandatory field for international trips. It should be 90 days or the duration of the trip in case of round trips, whichever is smaller.
  • The maximum insurance days allowed for international trips is 30 days.
air-common.xsd
id-type
  • The id-type tag should contain a valid value - one of {DRLC | PSPT | VOTE | PANC | GOVT}.
air-common.xsd
id-number
  • This value is alpha numeric and cannot contain spaces or special characters.
  • The Length should not exceed 15 characters.
air-common.xsd
passport-number
  • For international journey, the following airlines SG,TR,G9,AK,IX,3O,D7,QZ,TT,5J,0B,FY,FL,RQ,XC,W6,3J,RI,VF,BL,DG,XY,OD require Passport Number
air-common.xsd
passport-issue-date
  • For international journey, the following airlines XY requires Passport Issue Date.
air-common.xsd
passport-expiry-date
  • For international journey, the following airlines SG,TR,AK,D7,FD,TT,5J,0B,FY,FL,RQ,XC,W6,3J,RI,VF,BL,DG,XY,OD require Passport Expiry Date
air-common.xsd
passport-issuing-country
  • For international journey, the following airlines SG,TR,TT,5J,0B,FY,FL,RQ,XC,W6,3J,RI,VF,BL,DG,XY,OD require Passport Issuing Country.
air-common.xsd
payment-type
  • Payment type must be Deposit Account or Credit Card and one of the codes - { DA | CC } must be passed.
air-common.xsd
deposit-account-id
  • Deposit Account id is required.
air-common.xsd
card-number
  • A valid card number should be provided.
air-common.xsd
source-type
  • If the Booking Request is sent to Cleartrip, then for price parity checks source type should be B2C.
air-common.xsd
email
  • The value must match regular expression ".+@.+\\.[a-z]+"
  • The length should not exceed 254 characters.
air-common.xsd

NOTE:
Optional elements:
While creating an itinerary, the following elements are optional:
  • pax-info
  • frequent-flier-number
  • contact-detail
  • payment-detail
If these parameters not provided at create itinerary, then it must be provided during the book itinerary. Refer the XSD given in the Book Itinerary section.

The user will have to provide the number of adults, children, and infants in the request as parameters, while calling the create itinerary.
Eg. https://api.cleartrip.com/air/1.0/itinerary/create?adults=2&children=1&infants=1

AirIndia Express Bookings:
  • For a domestic booking that contains AirIndia Express in any of the segment, the API user must pass the identification type and number for one of the adult passengers travelling (Identification is required for only one of the adult passenger referred to as the master passenger, who will need to carry this identification while travelling).
  • For an international booking that contains AirIndia Express in any of the segment, the API user must pass the passport number for all the travelling passengers.
Passport Required Airlines: Only for International bookings
  • If the booking contains any of the following airlines, the passport information is required.
  • Airlines namely: SG,TR,G9,AK,IX,3O,D7,QZ,TT,5J,0B,FY,FL,RQ,XC,W6,3J,RI,VF,BL,DG,XY,OD

Response Details

Upon successful creation of an itinerary, the server responds back with the itinerary details, along with the HTTP status code 201 (Created). The itinerary response contains the details provided by the user along with the pricing details. If any problem occurs while creating the itinerary, the body contains the error as its top-level element and the description of the error is included.

The response also contains the itinerary-id in the X-CT-ITINERARY-ID HTTP header. This id is used to identify the itinerary on the server. All further operations on the itinerary should be performed using this itinerary-id.

Content type:
application/xml
Schema:
itinerary-response.rnc, itinerary-response.xsd
Sample XML:
itinerary-response.xml,itinerary-response-international.xml

NOTE: Additional elements that we pass as part of create itinerary response.
Field Validation Reference
baggage-allowances
  • Free cabin and check-in baggage allowance will be populated under this tag, if provided by the airline.
    '*_*' segment implies all/remaining segments.
baggage-allowance.xml
transit-visa-details
  • For International stop-over flights, if the connecting country requires Transit Visa, then the details will appear under this tag.
transit-visa-details.xml

Error Messages

Apart from schema validation errors, you may encounter one of the following errors.

Error message Description
API key invalid Please ensure that you use the right key allocated to you for the right environment. Please do not publish your key on the support forums. Please contact api.support@cleartrip.com with your api key and user-id and we will investigate further.
Insurance not enabled Insurance is turned off on the Cleartrip system. Please retry your booking without insurance.
Seat sell / Pre-payment - failed If the message contains the following - “Internal server error”, please contact api.support@cleartrip.com
Seat sell / Pre-payment - flight not available The itinerary you selected (the combination of the booking class and the flight) is no longer available, which means it is sold out - atleast temporarily. It is possible that this may become available after some time.
Seat sell / Pre-payment - price changed The itinerary you selected (the combination of the booking class and the flight) is no longer available, which means the particular class that you choose to book is sold out - atleast temporarily. It is possible that this may become available after some time.
Deposit Account invalid Please use the proper deposit account number allocated to you.
Partial Booking One or more of the flights you chose to book could not be booked with our suppliers. Please contact our customer support. Details @ http://www.cleartrip.com/support/. In case you would like to try booking again, please ensure that you cancel the successful portion of the booking before you book again. Please be aware that cancellation charges are applicable.

View Itinerary

This service is used to view the details of any itinerary created on the server. The request URL is

Production URL:
https://api.cleartrip.com/air/1.0/itinerary/view/{itinerary-id}
Staging URL:
http://api.staging.cleartrip.com/air/1.0/itinerary/view/{itinerary-id}

If the itinerary is found, the itinerary XML is returned in the response body, along with the HTTP status code of 200. If the itinerary is not found, the status code 404 (Not Found) is returned, along with an error XML in the response body.


Book Itinerary

This service is used to book an itinerary already created on the server. The user’s payment details are also required at this point (see the sample request XML). If the itinerary is booked successfully, the response body returns the itinerary XML along with an HTTP status code of 200. This itinerary XML includes the trip-id (which is the permanent id for the booked itinerary, also known as a trip once it is booked). If the booking fails for any reason, an error XML is returned (although it is possible that the HTTP status code returned is still 200).

For a successful booking, the value of the booking-status element under each booking-info should be P . Along with this, the airline-pnr should also be available in the booking-info (although it is possible that the airline PNR could not be retrieved at the time the booking was confirmed, for which the API user should use the Retrieve Trip service to retrieve the PNR at a later time).

If the booking is failed, this service will return an error block in the response body. However, the View Itinerary service will still return the complete itinerary XML. In this case, the value of each booking-status element should be H , which indicates failure.

The request body requires a booking XML with the payment details in it.

Production URL:
https://api.cleartrip.com/air/1.0/itinerary/book/{itinerary-id}
Staging:
http://api.staging.cleartrip.com/air/1.0/itinerary/book/{itinerary-id}
Method:
POST
Content type:
application/xml
Schema:
booking-request.rnc, booking-request.xsd
Sample XML:
booking-request.xml, booking-request-deposit-accounts.xml

Server Side Validation

While booking an itinerary, following xml validations are being done on the server side besides the xsd validation:

Field Validation Reference
contact-detail (mobile and landline)
  • One of mobile and landline is mandatory.
  • Non-numeric and special characters are allowed in mobile and landline, but they will be stripped out. Minimum and maximum length of landline must be 8 and 30 respectively. For mobile, minimum and maximum length must be 10 and 30 respectively.
air-common.xsd
card-expiry-date
  • card-expiry-date must not be the past date.
air-common.xsd

Error Messages

Similar to create itinerary.

Book request changes on few of the airlines

Airline Airline Code Mandatory fields XML for Mandatory fields Sector
Air India Express IX Paasport detail & Visa type sample-IX-book-change.xml MAA-KUL
Air Asia AK "Date of birth, Passport number, Passport expiry date, and Visa type" sample-IX-book-change.xml MAA-KUL
Tiger Airways TR sample-IX-book-change.xml BLR-SIN

Retrieve Trip

This service is used to retrieve the details of a trip. A trip is nothing but an itinerary that has been booked on the server. A trip-id is required to retrieve the trip details. For a successful booking, this trip-id is available in the trip-id tag in the itinerary response.

The request is a simple HTTP GET containing the trip-id in the URL.

Production URL:
https://api.cleartrip.com/trips/air/view/{trip-id}
Staging URL:
http://api.staging.cleartrip.com/trips/air/view/{trip-id}
Method:
GET
Response Content type:
application/xml
Response Schema:
trip-response.rnc, trip-response.xsd
Response Sample XML:
trip-response.xml

Error Messages

Error message Description
Trip for trip id xxx is not found. Trip-ID XXX doesn’t exist. The HTTP status code sent will be 404 (Not Found), returned with this error.

Get Fare Rules

This service is used to get fare rules in search results page using a given set of parameters.

Production URL:
http://api.cleartrip.com/air/1.0/domestic-fare-rules
Staging URL:
http://api.staging.cleartrip.com/air/1.0/domestic-fare-rules
Method:
GET
Request Params
Params Description
airline Airline for which fare-rule call is made. Eg : AI, 9W
fare_basis_code fare-basis-code for the solution inside pricing-info tag.
booking_class booking-class for the solution inside booking-info tag.
ts Timestamp, the time when the call is made.
domain The domain from which the call is made. In this case, the domain is always going to be api.cleartrip.com
air_booking_type Supports only 2 values. I (International) and D (Domestic).
Sample Request:
http://api.cleartrip.com/air/1.0/domestic-fare-rules?airline=AI&fare_basis_code=SAP90&booking_class=S&ts=13-01-2015&domain=api.cleartrip.com&air_booking_type=D
Response Content type:
application/xml
Response Schema:
fare-rules.rnc, fare-rules.xsd
Response Sample XML:
fare-rules-response.xml
NOTE: All the parameters mentioned for get fare-rules call are mandatory.

Retrieve Fare Rules

This service is used to retrieve fare rules for a pricing-info using fare-key. This fare-key is available in the fare-key tag in search result.

The request is a simple HTTP GET containing the fare-key in the URL.

Production URL:
https://api.cleartrip.com/air/1.0/itinerary/rules/{itinerary-id}
Staging URL:
http://api.staging.cleartrip.com/air/1.0/itinerary/rules/{itinerary-id}
Method:
GET
Sample Request:
https://api.cleartrip.com/air/1.0/itinerary/rules/ZG9tZXN0aWMtRzgtSy1LR09TQVZF
Response Content type:
application/xml
Response Schema:
fare-rules.rnc, fare-rules.xsd
Response Sample XML:
fare-rules-response.xml

Partial Failures

  • For RoundTrip scenarios, if there is an onward failure, the booking of return is discontinued.

Cancel Trip

This service is used to cancel flights or the entire air booking from a trip. The cancellation can be a partial cancellation or a full cancellation.

The request is an HTTP DELETE containing the comma separated booking-info-ids of the booking-info in the URL. Refer the response of the Retrieve Trip API to get the index of each booking-info.

Production URL:
https://api.cleartrip.com/trips/air/cancel/{trip-id}
Staging URL:
http://api.staging.cleartrip.com/trips/air/cancel/{trip-id}
Request Method:
DELETE
Sample Request:
Full Cancellation Request -
  • Production: https://api.cleartrip.com/trips/air/cancel/{trip-id}
  • Staging: http://api.staging.cleartrip.com/trips/air/cancel/{trip-id}
Partial Cancellation Request -
  • Production: https://api.cleartrip.com/trips/air/cancel/{trip-id}?booking-info-ids=1,2
  • Staging: https://api.staging.cleartrip.com/trips/air/cancel/{trip-id}?booking-info-ids=1,2
Response Content type:
application/xml
Response XML Schema:
cancellation.xsd
Response Headers:
Headers -
  • X-CT-TRANSACTION-ID - Transaction ID of the cancellation
  • LOCATION - Location of the cancelled resource
Response Code Description Response Content
200 (OK) Cancellation successful application/xml with root element cancellations
400 (Bad Request) Requested URL is invalid or incomplete -
401 (Unauthorized) Incorrect or no API key is found in header application/xml with root element faults
403 (Forbidden) Cancellation is not allowed due to violation of business rules or transaction rules application/xml with root element faults
404 (Not Found) Requested resource not found application/xml with root element faults
405 (Method Not Allowed) Method is Not Allowed -
500 (Internal Server Error) Server encountered an internal error while attempting to process the request -
501 (Not Implemented) Cancellation for this type of resource is not supported -

Sample code

Combined script (for ruby code):
ruby script

Go to top