Trip Ninja's API

Trip Ninja uses a REST API with requests and responses in JSON format. For development and testing, the pre-production servers are to be used.

Once ready for live use, access to the production servers will be provided. All search endpoints have both production and pre-production endpoints - these correspond to the GDS’s production and pre-production services, and can be used as desired.

Trip Ninja API URLs

For security, Trip Ninja’s servers are only accessible from whitelisted IPs. Please contact your account manager to whitelist IPs you will be using.

Before you start ensure that:
- IP addresses have been provided to be whitelisted for our servers.
- PCC / OfficeID emulation via Trip Ninja’s PCC/OfficeID has been set up.
- API username and password have been provided by Trip Ninja.

Workflow

The following diagram shows the typical data flow of API calls to Trip Ninja for a FareStructure integration with both a partner website and metasearch as sources.

Workflow diagram

Note: the following three endpoints (Price Confirmation, PNR Creation, Ticket Issuance) are simply to report to us that you have done these API calls to your GDS. Price Confirmation, PNR creation, and Ticket Issuance should follow your existing process (as per the following diagram).

Workflow diagram

Authentication

Trip Ninja uses Basic Authentication standards. Simply encode your username and password string using base64 and pass it in the authorization headers. See the python example below on how this is done. In the example, the payload and API endpoint url are not shown.

Python Example:

import base64
auth = base64.b64encode("USERNAME:PASSWORD")
headers = {
'authorization': "Basic "+ auth,
}
response = requests.post(url, headers=headers, data=json.dumps(payload))