✈️Oneway Trip API

In this API you will get prices from multiple airlines and vendors for a oneway route. You can pass any airport IATA code, future date, currency, and pax.

API endpoint for this API is: https://api.flightapi.io/onewaytrip

Each request to this API will cost 2 credits.

Guide

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

You can generate an API key from your Dashboard at any time.

Here is the list of default parameters you have to use with this API:

ParametersDescriptionType

api_key

required

This is your personal API key. You can find this on your Dashboard.

String

departure_airport_code

required

This is the IATA code of departure airport.

String

arrival_airport_code

required

This is the IATA code of arrival airport.

String

departure_date

required

Date of deparure Format - YYYY-MM-DD

String

number_of_adults

required

This is the number of adults.

String

number_of_childrens required

This is the number of childrens.

String

number_of_infants required

This is the number of infants.

String

cabin_class required

This is the class of the seat in the plane. Possible Values- "Economy", "Business", "First" or "Premium_Economy"

String

currency required

You can use any currency code like USD, INR, EUR, etc

String

region required

Check local prices of any country by passing the ISO code of that country.

String

API Schema

You can follow this API schema to pass parameters.

https://api.flightapi.io/onewaytrip/<api-key>/<departure_airport_code>/<arrival_airport_code>/<departure_date>/<number_of_adults>/<number_of_childrens>/<number_of_infants>/<cabin_class>/<currency>

API Example

You have to send a GET request to https://api.flightapi.io/oneway along with all the parameters.

Take a look at how you might call this API using various different coding languages.

curl "https://api.flightapi.io/onewaytrip/5f8b1ec2a9d31578961b4109f4dfd8/HEL/OUL/2024-05-20/1/0/0/Economy/USD"

Response

The sample response of the API will look somewhat like this.

// Sample Response

"itineraries": [
        {
            "id": "12126-2405200600--32317-0-15130-2405200700",
            "leg_ids": [
                "12126-2405200600--32317-0-15130-2405200700"
            ],
            "pricing_options": [
                {
                    "id": "EgiHJ3q9CXVr",
                    "agent_ids": [
                        "finn"
                    ],
                    "price": {
                        "amount": 52.1,
                        "update_status": "current",
                        "last_updated": "2024-01-09T09:11:11",
                        "quote_age": 224
                    },
                    "unpriced_type": "",
                    "items": [
                        {
                            "agent_id": "finn",
                            "url": "/transport_deeplink/4.0/US/en-GB/USD/finn/1/12126.15130.2024-05-20/air/airli/flights?itinerary=flight|-32317|431|12126|2024-05-20T06:00|15130|2024-05-20T07:00|60|ZNY0T9BE|Z|ESLCAMP11&carriers=-32317&operators=-32317&passengers=1&channel=website&cabin_class=economy&fps_session_id=5e87d1e4-0b01-4009-a2cf-f29a19e81c96&ticket_price=52.10&is_npt=false&is_multipart=false&client_id=skyscanner_website&request_id=c087ce1e-3920-4547-8524-1628381be925&q_ids=H4sIAAAAAAAA_-OS4mJJy8zLE2LmuBcnxcwxq0yhYemqTWxGTAqMAHly0aAcAAAA|8623981251399725447|2&q_sources=JACQUARD&commercial_filters=false&q_datetime_utc=2024-01-09T09:11:11&pqid=false",
                            "segment_ids": [
                                "12126-15130-2405200600-2405200700--32317"
                            ],
                            "price": {
                                "amount": 52.1,
                                "update_status": "current",
                                "last_updated": "2024-01-09T09:11:11",
                                "quote_age": 224
                            },
                            "booking_proposition": "PBOOK",
                            "transfer_protection": "",
                            "max_redirect_age": 10,
                            "fares": [
                                {
                                    "segment_id": "12126-15130-2405200600-2405200700--32317",
                                    "fare_basis_code": "ZNY0T9BE",
                                    "booking_code": "Z",
                                    "fare_family": "ESLCAMP11"
                                }
                            ],
                            "opaque_id": "-1017400199",
                            "booking_metadata": {
                                "metadata_set": "",
                                "signature": ""
                            },
                            "ticket_attributes": [],
                            "flight_attributes": []
                        }
                    ],
                    "transfer_type": "MANAGED",
                    "score": 10,
                    "pricing_option_fare": {
                        "attribute_labels": [],
                        "leg_details": {},
                        "brand_names": []
                    }
                }
],
"legs": [
        {
            "id": "12126-2405200600--32317-0-15130-2405200700",
            "origin_place_id": 12126,
            "destination_place_id": 15130,
            "departure": "2024-05-20T06:00:00",
            "arrival": "2024-05-20T07:00:00",
            "segment_ids": [
                "12126-15130-2405200600-2405200700--32317"
            ],
            "duration": 60,
            "stop_count": 0,
            "marketing_carrier_ids": [
                -32317
            ],
            "operating_carrier_ids": [
                -32317
            ],
            "stop_ids": []
        }
],
"segments": [
        {
            "id": "12126-15130-2405200600-2405200700--32317",
            "origin_place_id": 12126,
            "destination_place_id": 15130,
            "arrival": "2024-05-20T07:00:00",
            "departure": "2024-05-20T06:00:00",
            "duration": 60,
            "marketing_flight_number": "431",
            "marketing_carrier_id": -32317,
            "operating_carrier_id": -32317,
            "mode": "flight"
        }
]
  

It is just a sample API response. Some objects will have more attributes. New arrays will also be there.

Understanding the Response

In the JSON response, you may observe that many objects include references (IDs or codes) to objects from other lists. This pattern is employed in our API to prevent redundant data and reduce the overall size by allowing multiple objects to reference the same data.

Field NameDescription

itineraries

A return trip will consist of 2 legs, while a one-way trip will consist of 1 leg. An itinerary will contain a deepLink field which takes the traveler to the booking page.

legs

Provides information about the flight leg from the destination to the origin. A leg comprises a single segment for a direct flight and may consist of multiple segments if there are several stopovers.

segments

Displays information about individual stops within a leg. For instance, if a leg includes one-stop, the segment will provide details about the stopover, including its duration and location.

places

Reveals specific stops within a leg. For instance, in the case of a leg with a single stop, the segment will present information about the stopover, including its duration and location.

carriers

Like places, the carriers section contains details about the airlines mentioned in the itineraries.

agents

Just like places, the agents section comprises details about the Online Travel Agencies (OTAs) mentioned in the itineraries.

Sometimes you might have to make more than one API call to get complete data. Since we compare a lot of airlines and vendors sometimes it becomes impossible to pull this much amount of data at once

Video Tutorial

Last updated