swagger: "2.0"
schemes:
  - https
host: test.api.amadeus.com
basePath: /v1
info:
  description: |-
    
    Before using this API, we recommend you read our **[Authorization Guide](https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262)** for more information on how to generate an access token.

    Please also be aware that our test environment is based on a subset of the production, this API in test only returns a few selected cities. You can find the list in our **[data collection](https://github.com/amadeus4dev/data-collection)**.
  title: Airport Nearest Relevant
  version: 1.1.2
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_amadeus.com_images_en_technology_mobile-tablet_mobile-woman-office-city.jpg.transform_medium_img.jpg
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/amadeus4dev/amadeus-open-api-specification/main/spec/json/AirportNearestRelevant_v1_swagger_specification.json
      version: "2.0"
  x-providerName: amadeus.com
  x-release-note:
    "1.0":
      - Initial Version
    1.0.1:
      - Improvement of relevance calculation
      - Remove flights and travelers figures
      - Flights and Travelers score become integer (PTR 14827552)
    1.0.2:
      - AFD-1091 - change from "traveller" to "traveler"
    1.1.0:
      - Add radius parameter
    1.1.1:
      - Correct example
  x-serviceName: amadeus-airport-nearest-relevant
  x-status: validated
  x-tags:
    - "#ama-for-dev"
consumes:
  - application/vnd.amadeus+json
produces:
  - application/vnd.amadeus+json
parameters:
  pageLimit:
    default: 10
    description: maximum items in one page
    in: query
    name: page[limit]
    required: false
    type: integer
  pageOffset:
    default: 0
    description: start index of the requested page
    in: query
    name: page[offset]
    required: false
    type: integer
  sort:
    default: relevance
    description: |
      defines on which attribute the sorting will be done from the best option to the worst one:
      * **relevance** - Score value calculated based on distance and traffic analytics
      * **distance** - Distance from the location to the geo-code given in API request parameters
      * **analytics.flights.score** - Approximate score for ranking purposes calculated based on estimated number of flights from/to airport in one reference year (last year)
      * **analytics.travelers.score** - Approximate score for ranking purposes calculated based on estimated number of travelers in the airport for one reference year (last year)
    enum:
      - relevance
      - distance
      - analytics.flights.score
      - analytics.travelers.score
    in: query
    name: sort
    required: false
    type: string
responses:
  "400":
    description: |
      code    | title                                 
      ------- | ------------------------------------- 
      477     | INVALID FORMAT
      572     | INVALID OPTION
      4926    | INVALID DATA RECEIVED               
      32171   | MANDATORY DATA MISSING 	     
    schema:
      $ref: "#/definitions/Error_400"
  "500":
    description: Unexpected Error
    schema:
      $ref: "#/definitions/Error_500"
  nearest-relevant-airports:
    description: Successful Operation
    schema:
      example:
        data:
          - address:
              cityCode: LON
              cityName: LONDON
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 39
              travelers:
                score: 45
            detailedName: LONDON/GB:HEATHROW
            distance:
              unit: KM
              value: 11
            geoCode:
              latitude: 51.47294
              longitude: -0.45061
            iataCode: LHR
            name: HEATHROW
            relevance: 350.54587
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
          - address:
              cityCode: LON
              cityName: LONDON
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 27
              travelers:
                score: 27
            detailedName: LONDON/GB:GATWICK
            distance:
              unit: KM
              value: 49
            geoCode:
              latitude: 51.15609
              longitude: -0.17818
            iataCode: LGW
            name: GATWICK
            relevance: 53.62667
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
          - address:
              cityCode: LON
              cityName: LONDON
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 11
              travelers:
                score: 10
            detailedName: LONDON/GB:LUTON
            distance:
              unit: KM
              value: 33
            geoCode:
              latitude: 51.87472
              longitude: -0.36833
            iataCode: LTN
            name: LUTON
            relevance: 33.10184
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
          - address:
              cityCode: LON
              cityName: LONDON
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 16
              travelers:
                score: 15
            detailedName: LONDON/GB:STANSTED
            distance:
              unit: KM
              value: 58
            geoCode:
              latitude: 51.885
              longitude: 0.235
            iataCode: STN
            name: STANSTED
            relevance: 27.50241
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
          - address:
              cityCode: LON
              cityName: LONDON
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 8
              travelers:
                score: 4
            detailedName: LONDON/GB:CITY AIRPORT
            distance:
              unit: KM
              value: 35
            geoCode:
              latitude: 51.50528
              longitude: 0.05528
            iataCode: LCY
            name: CITY AIRPORT
            relevance: 21.78754
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
          - address:
              cityCode: BHX
              cityName: BIRMINGHAM
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 10
              travelers:
                score: 8
            detailedName: BIRMINGHAM/GB:BIRMINGHAM
            distance:
              unit: KM
              value: 132
            geoCode:
              latitude: 52.45386
              longitude: -1.74803
            iataCode: BHX
            name: BIRMINGHAM
            relevance: 7.73356
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
          - address:
              cityCode: MAN
              cityName: MANCHESTER
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 18
              travelers:
                score: 17
            detailedName: MANCHESTER/GB:MANCHESTER AIRPO
            distance:
              unit: KM
              value: 233
            geoCode:
              latitude: 53.35374
              longitude: -2.27495
            iataCode: MAN
            name: MANCHESTER AIRPORT
            relevance: 7.71084
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
          - address:
              cityCode: SOU
              cityName: SOUTHAMPTON
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 4
              travelers:
                score: 2
            detailedName: SOUTHAMPTON/GB
            distance:
              unit: KM
              value: 94
            geoCode:
              latitude: 50.95026
              longitude: -1.3568
            iataCode: SOU
            name: SOUTHAMPTON
            relevance: 4.4788
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
          - address:
              cityCode: BRS
              cityName: BRISTOL
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 7
              travelers:
                score: 5
            detailedName: BRISTOL/GB:BRISTOL
            distance:
              unit: KM
              value: 159
            geoCode:
              latitude: 51.38267
              longitude: -2.71909
            iataCode: BRS
            name: BRISTOL
            relevance: 4.08617
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
          - address:
              cityCode: NQT
              cityName: NOTTINGHAM
              countryCode: GB
              countryName: UNITED KINGDOM
              regionCode: EUROP
            analytics:
              flights:
                score: 4
              travelers:
                score: 3
            detailedName: NOTTINGHAM/GB:EAST MIDLANDS
            distance:
              unit: KM
              value: 152
            geoCode:
              latitude: 52.83111
              longitude: -1.32806
            iataCode: EMA
            name: EAST MIDLANDS
            relevance: 2.66099
            subType: AIRPORT
            timeZoneOffset: +01:00
            type: location
        meta:
          count: 32
          links:
            last: https://test.api.amadeus.com/v1/reference-data/locations/airports?latitude=51.57285&longitude=-0.44161&page%5Boffset%5D=22
            next: https://test.api.amadeus.com/v1/reference-data/locations/airports?latitude=51.57285&longitude=-0.44161&page%5Boffset%5D=10
            self: https://test.api.amadeus.com/v1/reference-data/locations/airports?latitude=51.57285&longitude=-0.44161
      properties:
        data:
          items:
            $ref: "#/definitions/Location"
          type: array
        meta:
          $ref: "#/definitions/Collection_Meta"
      required:
        - data
      title: Success
paths:
  /reference-data/locations/airports:
    get:
      description: ""
      operationId: getNearestRelevantAirports
      parameters:
        - description: latitude location to be at the center of the search circle
          format: double
          in: query
          name: latitude
          required: true
          type: number
          x-example: 51.57285
        - description: longitude location to be at the center of the search circle
          format: double
          in: query
          name: longitude
          required: true
          type: number
          x-example: -0.44161
        - default: 500
          description: radius of the search in Kilometer. Can be from 0 to 500, default value is 500 Km.
          in: query
          maximum: 500
          minimum: 0
          name: radius
          required: false
          type: integer
        - $ref: "#/parameters/pageLimit"
        - $ref: "#/parameters/pageOffset"
        - $ref: "#/parameters/sort"
      responses:
        "200":
          $ref: "#/responses/nearest-relevant-airports"
        "400":
          $ref: "#/responses/400"
        default:
          $ref: "#/responses/500"
      summary: Returns a list of relevant airports near to a given point.
      tags:
        - location
definitions:
  Address:
    properties:
      cityCode:
        description: IATA code of the city of the location; equal to IATAcode if the location is a city
        example: PAR
        type: string
      cityName:
        description: name of the city of the location; equal to name if the location is a city
        example: Paris
        type: string
      countryCode:
        description: code of the country of the location in ISO standard
        example: FR
        type: string
      countryName:
        description: name of the country of the location
        example: France
        type: string
      regionCode:
        description: code of the region of the location in ISO standard
        example: EUROP
        type: string
      stateCode:
        description: code of the state of the location if any
        example: TO
        type: string
  Analytics:
    properties:
      flights:
        $ref: "#/definitions/Flights"
      travelers:
        $ref: "#/definitions/Travelers"
  Collection_Meta:
    properties:
      count:
        example: 1
        type: integer
      links:
        example:
          self: https://test.api.amadeus.com/v1/area/resources?param=value
        properties:
          first:
            example: https://test.api.amadeus.com/v1/area/resources?...
            format: uri
            type: string
          last:
            example: https://test.api.amadeus.com/v1/area/resources?...
            format: uri
            type: string
          next:
            example: https://test.api.amadeus.com/v1/area/resources?...
            format: uri
            type: string
          previous:
            example: https://test.api.amadeus.com/v1/area/resources?...
            format: uri
            type: string
          self:
            example: https://test.api.amadeus.com/v1/area/resources?...
            format: uri
            type: string
          up:
            example: https://test.api.amadeus.com/v1/area/resources?...
            format: uri
            type: string
        title: CollectionLinks
    title: Collection_Meta
  Distance:
    properties:
      unit:
        description: unit of the distance
        enum:
          - KM
          - MI
        example: KM
        type: string
      value:
        description: great-circle distance between two locations. This distance thus do not take into account traffic conditions; international boundaries; mountains; water; or other elements that might make the a nearby location hard to reach.
        example: 152
        type: integer
  Error_400:
    example:
      errors:
        - code: 477
          detail: invalid query parameter format
          source:
            example: CDG
            parameter: airport
          status: 400
          title: INVALID FORMAT
    properties:
      errors:
        items:
          $ref: "#/definitions/Issue"
        type: array
    required:
      - errors
  Error_500:
    example:
      errors:
        - code: 141
          status: 500
          title: SYSTEM ERROR HAS OCCURRED
    properties:
      errors:
        items:
          $ref: "#/definitions/Issue"
        type: array
    required:
      - errors
  Flights:
    properties:
      score:
        description: Approximate score for ranking purposes calculated based on number of flights from / to the airport or city
        example: 56
        format: integer
        type: number
  GeoCode:
    properties:
      latitude:
        description: latitude of the location
        example: 43.580418
        format: double
        type: number
      longitude:
        description: longitude of the location
        example: 7.125102
        format: double
        type: number
  Issue:
    properties:
      code:
        description: an application-specific error code
        format: int64
        type: integer
      detail:
        description: explanation of the error
        type: string
      source:
        description: an object containing references to the source of the error
        maxProperties: 1
        properties:
          example:
            description: a string indicating an example of the right value
            type: string
          parameter:
            description: a string indicating which URI query parameter caused the issue
            type: string
          pointer:
            description: a JSON Pointer [RFC6901] to the associated entity in the request document
            type: string
        title: Issue_Source
        type: object
      status:
        description: the HTTP status code applicable to this error
        type: integer
      title:
        description: a short summary of the error
        type: string
  Location:
    properties:
      address:
        $ref: "#/definitions/Address"
      analytics:
        $ref: "#/definitions/Analytics"
      detailedName:
        description: detailed name of the location. For a city location it contains city name and country code. For an airport location it contains city name; country code and airport full name
        example: "Paris/FR: Charles de Gaulle"
        type: string
      distance:
        $ref: "#/definitions/Distance"
      geoCode:
        $ref: "#/definitions/GeoCode"
      iataCode:
        description: IATA code of the location. ([IATA table codes](http://www.iata.org/publications/Pages/code-search.aspx) here)
        example: CDG
        type: string
      name:
        description: short name of the location
        example: Paris CDG
        type: string
      relevance:
        description: score value calculated based on distance and analytics
        example: 9.6584
        format: double
        type: number
      subType:
        description: location sub type
        enum:
          - AIRPORT
          - CITY
          - POINT_OF_INTEREST
          - DISTRICT
        example: AIRPORT
        type: string
      timeZoneOffset:
        description: timezone offset of the location at the date of the API call (including daylight saving time)
        example: +01:00
        type: string
      type:
        description: the resource name
        example: location
        type: string
  Travelers:
    properties:
      score:
        description: Approximate score for ranking purposes calculated based on number of travelers in the location.
        example: 68
        format: integer
        type: number
x-generatedAt: 2020-07-22T14:53:48.686Z
