openapi: 3.2.0 info: version: 4.15.0 title: Trip Ninja API Documentation Booking API description: "

Introduction

\nTrip Ninja uses a REST API with requests and responses in JSON format. For development and testing, the pre-production servers\nare to be used. Once ready for live use, access to the production servers will be provided. All search endpoints have both production\nand pre-production endpoints - these correspond to the GDS’s production and pre-production services, and can be used as desired.
\n

Trip Ninja API URLs

\n\nPre-Production: https://preprodapi.tripninja.io\n\nFor security, Trip Ninja’s servers are only accessible from whitelisted IPs. Please contact your account manager to whitelist IPs you\nwill be using.\n\nBefore you start ensure that:
\n - IP addresses have been provided to be whitelisted for our servers.
\n - PCC / OfficeID emulation via Trip Ninja’s PCC/OfficeID has been set up.
\n - API username and password have been provided by Trip Ninja.
\n\n

FareStructure

\nThe FareStructure product returns the set of best GDS responses that create the specified route. It finds the best fare structure via\nsplit ticketing and does not reorder the destinations. Each of the returned segments must be ticketed in its own PNR.

The “structure” seen in the\nFareStructure response determines how you will carry out price confirmation as well as PNR creation. We start counting flights at 0. \nFor example if structure is [[0, 2] , 1], this implies flight 0 and flight 2 are to be priced/ticketed together as one openjaw.\nFlight 1 should be priced as a oneway. [1, 2, 3] would be 3 separate oneways to be priced/ticketed individually.\n[[0, 1], [2, 3]] would be two openjaws, flight 0 and flight 1 priced/ticketed together as one openjaw and flights\n2 and 3 ticketed together as one openjaw.\n\n

Workflow

\nThe following diagram shows the typical data flow of API calls to Trip Ninja for a FareStructure integration with both a partner website\nand metasearch as sources.\n\n![Workflow diagram](https://s3.amazonaws.com/tn-api-docs/FlowChart1-01.png)\n\nNote: 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.\nPrice Confirmation, PNR creation, and Ticket Issuance should follow your existing process (as per the following diagram).\n\n![Workflow diagram](https://s3.amazonaws.com/tn-api-docs/FlowChart1-02.png)\n\n

Authentication

\nTrip Ninja uses Basic Authentication standards. Simply encode your username and password string using base64 and pass it in the\nauthorization headers. See the python example below on how this is done. In the example, the payload and API endpoint url are not\nshown.\n\nPython Example:\n\n
\nimport base64\nauth = base64.b64encode(\"USERNAME:PASSWORD\")\nheaders = {\n    'authorization': \"Basic \"+ auth,\n}\nresponse = requests.post(url, headers=headers, data=json.dumps(payload))\n
\n\n# Error Codes\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
IE01Need minimum 2 destinations
IE02Duplicate city in list
IE09Can't run any queries for flight dates in the past
IE10Incorrect city_type, expected one of ['C', 'A']
IE16Please provide a PCC
IE17Invalid carrier
IE19Incorrect region, expected one of 'emea', 'apac', 'americas', 'edge'
IE20Incorrect provider, expected one of '1V','1G','1P','1A'
IE21Wrong currency
IE22Not a valid cabin option. expected one of 'E' , 'PE', 'SE', 'BC','FC', 'PFC'
IE23Not a valid alliance. Expected one of *A, *S, *O
IE24Travellers Type does not meet expected criteria. Should be a list having between 0 and 10 values
IE26Exclude_carriers, alliance and permitted_carriers are mutually exclusive - please choose one
IE27Num_results should be an integer between 50 and 5000
IE28Refundable parameter must be boolean value true or false
IE29Invalid Traveller type
IE30Incorrect value for single_pnr, must be boolean
IE31LCC token not associated with user
IE32Incorrect value for include_itineraries, must be boolean
IE33Stops must be one of 'any', 'direct', '1', '2'
IE34Incorrect value for no_overnight_layovers, must be boolean
IE36Invalid LCC name
\n" x-logo: url: https://s3.amazonaws.com/tn-api-docs/trip_ninja_logo.png altText: Trip Ninja logo href: https://www.tripninja.io/ servers: - url: https://preprodapi.tripninja.io description: Pre-Production server tags: - name: Booking paths: /booking/: post: summary: Booking Report description: When a booking is completed from a trip generated by Trip Ninja, report the booking to Trip Ninja via the booking endpoint. operationId: BookingReport requestBody: content: application/json: schema: $ref: '#/components/schemas/BookingReportRequest' responses: 200: description: Success content: application/json: schema: type: object properties: status: type: string example: success 400: description: Invalid Input content: application/json: schema: type: object properties: status: type: string description: States whether request to book was successful. example: Not booked tags: - Booking components: schemas: BookingReportRequest: title: Request type: object required: trip_id segment_ids properties: trip_id: type: string description: Trip ID returned in search response example: 6be6e72c60102bd489ac46434d4ac6c11e047ee8 segment_ids: $ref: '#/components/schemas/segment_ids' customer_booking_reference_id: type: string description: Customer booking reference ID from the client. example: cust-book-1234aa94d segment_ids: type: Array of strings and/or Array of arrays description: "Array of segment_id's for the booked segments - These will be strings for one-ways, arrays of strings for open-jaws and joined strings for VI flights.\n\nFor the booking of oneway virtually interlined tickets there will be two segment_id's. For example segment_id_0_1 and segment_id_0_2. \nWhen being booked the segment_id's should be joined together by two underscores **segment_id_0_1__segment_id_0_2** and the resulting string should be sent in the position of the original search.\n\ne.g. `18fd1992fd90e6e2cf44d49308a1482b2ecd7f67__59e15240be759a023c950e66379dca775fd8aaf1`\n\nThis is the example structure but should be generalized for all combinations as Trip Ninja's technology handles more than just 3-segment trips.\n1) structure: [0, 1]\n - `segment_ids: [\"segment_id_0\", \"segment_id_1\"]`\n2) structure: [(0, 1)]\n - `segment_ids: [[\"segment_id_0\", \"segment_id_1\"]]`\n3) VI structure: [0, 1.1, 1.2]\n - `segment_ids: [[\"segment_id_0\", \"segment_id_1_1__segment_id_1_2\"]]`\n4) structure: [0, 1, 2]\n - `segment_ids: [\"segment_id_0\", \"segment_id_1\", \"segment_id_2\"]`\n5) structure: [(0, 1), 2]\n - `segment_ids: [[\"segment_id_0\", \"segment_id_1\"], \"segment_id_2\"]`\n6) structure: [(0, 2), 1]\n - `segment_ids: [[\"segment_id_0\", \"segment_id_2\"], \"segment_id_1\"]`\n7) structure: [0, (1, 2)]\n - `segment_ids: [\"segment_id_0\", [\"segment_id_1\", \"segment_id_2\"]]`\n8) structure: [0.1, 0.2, (1, 2), 3.1. 3.2]\n - `segment_ids: [\"segment_id_0_1__segment_id_0_2\", [\"segment_id_1\", \"segment_id_2\"]], \"segment_id_3_1__segment_id_3_2]\"`\n" example: - 18fd1992fd90e6e2cf44d49308a1482b2ecd7f67 - 59e15240be759a023c950e66379dca775fd8aaf1