openapi: "3.0.0" info: version: 4.15.0 title: Trip Ninja API Documentation description: |
import base64
auth = base64.b64encode("USERNAME:PASSWORD")
headers = {
'authorization': "Basic "+ auth,
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
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
paths:
/search/hotels/{endpoint}:
post:
parameters:
- in: path
name: endpoint
required: true
schema:
type: string
enum: [ preprod, prod ]
description: Parameter toggles data source production and pre-production endpoints
summary: "Hotel Search"
description: |
This endpoint initiates a hotel search for one location (city), and returns a list of available options. A separate endpoint needs to be called to obtain information about room types, etc.
operationId: Search
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/HotelSearchRequest'
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/HotelSearchResponse'
400:
description: Invalid Input
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Error code and 0 for success response
example: IE23
message:
type: string
description: Contains the error message
example: Not a valid city.
401:
description: Unauthorized
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Error code and 0 for success response
example: IE44
message:
type: string
description: Contains the error message
example: "User is not authorized"
206:
description: Partial Content (no Hotel found)
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Error code and 0 for success response
example: IE23
message:
type: string
description: Contains the error message
example: "No availability found: Try changing dates"
500:
description: Server Error
/details/hotels/{endpoint}/:
post:
parameters:
- in: path
name: endpoint
required: true
schema:
type: string
enum: [ preprod, prod ]
description: Parameter toggles data source production and pre-production endpoints.
summary: "Hotel Details"
description: Get the room details of one of the hotels returned in the search response.
operationId: Details
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/HotelDetailsRequest'
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/HotelDetailsResponse'
400:
description: Invalid Input
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Error code and 0 for success response
example: IE23
message:
type: string
description: Contains the error message
example: Not a valid city.
401:
description: Unauthorized
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Error code and 0 for success response
example: IE44
message:
type: string
description: Contains the error message
example: "User is not authorized"
206:
description: Partial Content (no Hotel found)
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Error code and 0 for success response
example: IE23
message:
type: string
description: Contains the error message
example: "No availability found: Try changing dates"
500:
description: Server Error
/rules/hotels/{endpoint}/:
post:
parameters:
- in: path
name: endpoint
required: true
schema:
type: string
enum: [ preprod, prod ]
description: Parameter toggles data source production and pre-production endpoints.
summary: "Hotel Rules"
description: Get the rules details of the selected hotel_code, hotel_chain, and rate_plan_type. This is a required operation prior to booking as elements of this are saved in the cache and reused in booking.
operationId: Rules
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/HotelRulesRequest'
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/HotelRulesResponse'
400:
description: Invalid Input
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Error code and 0 for success response
example: IE23
message:
type: string
description: Contains the error message
example: Not a valid rate_plan_type.
401:
description: Unauthorized
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Error code and 0 for success response
example: IE44
message:
type: string
description: Contains the error message
example: "User is not authorized"
206:
description: Partial Content (no Hotel found)
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: Error code and 0 for success response
example: IE23
message:
type: string
description: Contains the error message
example: "No availability found: Try changing dates"
500:
description: Server Error
/price/hotels/{endpoint}/:
post:
parameters:
- in: path
name: endpoint
required: true
schema:
type: string
enum: [ preprod, prod ]
description: Parameter toggles data source production and pre-production endpoints
summary: "Hotel Price Confirmation"
description: Once the desired hotel have been selected, call the price confirm endpoint to confirm availability and prices.
operationId: PriceConfirm
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/HotelPriceConfirmRequest'
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/HotelPriceConfirmResponse'
400:
description: Unable to confirm trip pricing
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: IE45
message:
type: string
example: 'Unsuccessful. reason Invalid date.'
delete:
summary: "Remove Price Confirmed Hotel"
description: "This allows for a user to remove a single hotel from the super trip."
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/HotelRemovePriceConfirm'
responses:
200:
description: Success
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "Success"
400:
description: Unable to remove priced hotel
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: IE45
message:
type: string
example: 'super_trip_id required for price confirm delete'
components:
schemas:
HotelSearchResponse:
properties:
hotel_trace_id:
type: string
example: 'ndsf6sjf6sdf7sdf6'
description: An identifier to refer to the hotel for searching room availability
hotels:
type: array
description: A list of hotels available based on the search request details.
items:
type: object
properties:
location_iata:
type: string
description: The location of the hotel.
example: 'LON'
location_full:
type: string
description: The full location name as provided by the GDS.
example: "London, England"
rating:
type: object
properties:
rating:
type: int
description: The hotel rating
example: 4
rating_provider:
type: string
description: The provider of the rating.
example: Giata
rating_maximum:
type: int
description: The best possible rating.
example: 10
rating_minimum:
type: int
description: The worst possible rating.
example: 0
hotel_chain:
type: string
description: The refence for the hotel chain.
example: 'GI'
hotel_code:
type: string
description: The reference for the hotel code
example: '35573'
hotel_name:
type: string
description: The name of the hotel
example: 'Cambridge Suites Hotel Halifax'
minimum_charge:
type: float
description: The minimun total for the requested search available (in the currency provided in the search request)
example: 400.32
maximum_charge:
type: float
description: The maximum total priced room option available (in the currency provided in the search request)
example: 780.65
address:
type: object
properties:
street_address:
type: string
description: The street address of the hotel. This is more details than the one returned at search.
example: '1583 Brunswick St, Halifax, NS B3J 3P5'
city:
type: string
description: References the city of the hotel.
example: "Halifax"
region:
type: string
description: References the region of the hotel.
example: ""
country:
type: string
description: The 2-letter code that represents the country of the hotel.
example: "FR"
longitude:
type: float
description: The longitude of the hotel.
example: 44.64511447836071
lattitude:
type: float
description: The lattitude of the hotel.
example: -63.575245615440565
distance_from_reference_point_km:
type: float
description: The distance that the hotel is from the reference submitted in the search.
example: 7.5
phone_number:
type: str
description: The contact phone number for the hotel.
example: '+1 902-420-0555'
amenities:
type: array
description: A list of the amenities provided at this hotel.
items:
type: object
properties:
amenity_type:
type: string
description: The amenity type, can be either HA (Hotel Amenity) or RA (Room amenity)
example: "HA"
amenity_title:
type: string
description: A title or descriptor of the amenity provided.
example: High speed internet connection
credential_info:
type: object
properties:
pcc:
description: PCC/OfficeID to emulate transactions under. Must have emulation enabled for the relevant Service Bureau PCC used by Trip Ninja to conduct queries.
type: string
example: 2G3C
provider:
description: Fare provider to use.