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, in test this API only contains data from the United States, Spain, United Kingdom, Germany and India. 
  title: Airport & City Search
  version: 1.2.3
  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/AirportCitySearch_v1_swagger_specification.json
      version: "2.0"
  x-providerName: amadeus.com
  x-release-note:
    "1.0":
      - Initial Version
    "1.1":
      - AFD-1091 - change from "traveller" to "traveler"
      - change default value of view indicator to FULL
      - Change search algorithm
      - Addition of "id" for location
      - New operation GET Airport or City by id
      - Traveler score become interger (PTR 14827552)
      - Change the option parameter into view and onlyMajor parameter
      - add a characters restriction on keyword parameter
    "1.2":
      - Remove parameter onlyMajor
      - Correct example
  x-serviceName: amadeus-airport-&-city-search
  x-status: validated
  x-tags:
    - "#ama-for-dev"
consumes:
  - application/vnd.amadeus+json
produces:
  - application/vnd.amadeus+json
parameters:
  locationId:
    description: identifier of the location
    in: path
    name: locationId
    required: true
    type: string
    x-example: CMUC
  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: analytics.travelers.score
    description: |
      defines on which attribute the sorting will be done:
      * analytics.travelers.score - sort by the number of travelers by airport or city, the airports and cities with the highest traffic are on top of the results
    enum:
      - analytics.travelers.score
    in: query
    name: sort
    required: false
    type: string
  view:
    default: FULL
    description: |
      select the level of information of the reply:
      * LIGHT - Gives only the IATACode, name, detailedName, cityName and countryName
      * FULL - Adds on top of the LIGHT information the timeZoneOffset, geocode, detailed address and travelers.score
      default option is FULL
    enum:
      - LIGHT
      - FULL
    in: query
    name: view
    required: false
    type: string
responses:
  "400":
    description: |
      code    | title                                 
      ------- | ------------------------------------- 
      477     | INVALID FORMAT
      572     | INVALID OPTION 
      2781    | INVALID LENGTH
      4926    | INVALID DATA RECEIVED               
      32171   | MANDATORY DATA MISSING 	     
    schema:
      $ref: "#/definitions/Error_400"
  "404":
    description: Not Found
    schema:
      $ref: "#/definitions/Error_404"
  "500":
    description: Unexpected Error
    schema:
      $ref: "#/definitions/Error_500"
  400_GET-Id:
    description: |
      code    | title                                 
      ------- | ------------------------------------- 
      572     | INVALID OPTION    
    schema:
      $ref: "#/definitions/Error_400"
  airport-city:
    description: Successful Operation
    schema:
      example:
        data:
          address:
            cityCode: MUC
            cityName: MUNICH
            countryCode: DE
            countryName: GERMANY
            regionCode: EUROP
          analytics:
            travelers:
              score: 27
          detailedName: MUNICH/DE:MUNICH INTERNATIONAL
          geoCode:
            latitude: 48.35378
            longitude: 11.78609
          iataCode: MUC
          id: CMUC
          name: MUNICH INTERNATIONAL
          self:
            href: https://test.api.amadeus.com/v1/reference-data/locations/CMUC
            methods:
              - GET
          subType: CITY
          timeZoneOffset: +02:00
          type: location
        meta:
          links:
            self: https://test.api.amadeus.com/v1/reference-data/locations/CMUC
      properties:
        data:
          $ref: "#/definitions/Location"
        meta:
          $ref: "#/definitions/Collection_Meta"
      required:
        - data
      title: Success
  airport-city-autocomplete:
    description: Successful Operation
    schema:
      example:
        data:
          - address:
              cityCode: MUC
              cityName: MUNICH
              countryCode: DE
              countryName: GERMANY
              regionCode: EUROP
            analytics:
              travelers:
                score: 27
            detailedName: MUNICH/DE:MUNICH INTERNATIONAL
            geoCode:
              latitude: 48.35378
              longitude: 11.78609
            iataCode: MUC
            id: CMUC
            name: MUNICH INTERNATIONAL
            self:
              href: https://test.api.amadeus.com/v1/reference-data/locations/CMUC
              methods:
                - GET
            subType: CITY
            timeZoneOffset: +02:00
            type: location
          - address:
              cityCode: MUC
              cityName: MUNICH
              countryCode: DE
              countryName: GERMANY
              regionCode: EUROP
            analytics:
              travelers:
                score: 27
            detailedName: MUNICH/DE:MUNICH INTERNATIONAL
            geoCode:
              latitude: 48.35378
              longitude: 11.78609
            iataCode: MUC
            id: AMUC
            name: MUNICH INTERNATIONAL
            self:
              href: https://test.api.amadeus.com/v1/reference-data/locations/AMUC
              methods:
                - GET
            subType: AIRPORT
            timeZoneOffset: +02:00
            type: location
        meta:
          count: 2
          links:
            self: https://test.api.amadeus.com/v1/reference-data/locations?subType=CITY,AIRPORT&keyword=MUC&countryCode=DE
      properties:
        data:
          items:
            $ref: "#/definitions/Location"
          type: array
        meta:
          $ref: "#/definitions/Collection_Meta"
      required:
        - data
      title: Success
paths:
  /reference-data/locations:
    get:
      description: ""
      operationId: getAirportCitySearch
      parameters:
        - collectionFormat: csv
          description: sub type of the location (AIRPORT and/or CITY)
          in: query
          items:
            enum:
              - AIRPORT
              - CITY
            type: string
          name: subType
          required: true
          type: array
          x-example: CITY
        - description: |-
            keyword that should represent the start of a word in a city or airport name or code. 
             Supported charaters are: A-Za-z0-9./:-'()"
          in: query
          name: keyword
          pattern: "[A-Za-z0-9./:()'\"-]"
          required: true
          type: string
          x-example: MUC
        - description: Country code of the location using [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code format (e.g. US).
          in: query
          name: countryCode
          required: false
          type: string
        - $ref: "#/parameters/pageLimit"
        - $ref: "#/parameters/pageOffset"
        - $ref: "#/parameters/sort"
        - $ref: "#/parameters/view"
      responses:
        "200":
          $ref: "#/responses/airport-city-autocomplete"
        "400":
          $ref: "#/responses/400"
        default:
          $ref: "#/responses/500"
      summary: Returns a list of airports and cities matching a given keyword.
      tags:
        - location
  "/reference-data/locations/{locationId}":
    get:
      description: ""
      operationId: getAirportCity
      parameters:
        - $ref: "#/parameters/locationId"
      responses:
        "200":
          $ref: "#/responses/airport-city"
        "400":
          $ref: "#/responses/400_GET-Id"
        "404":
          $ref: "#/responses/404"
        default:
          $ref: "#/responses/500"
      summary: Returns a specific airports or cities based on its id.
      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:
      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_404:
    example:
      errors:
        - code: 1797
          detail: no response found for this query parameter
          source:
            parameter: airport
          status: 404
          title: NOT FOUND
    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
  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
  Links:
    example:
      href: string
    properties:
      count:
        type: integer
      href:
        format: uri
        type: string
      methods:
        items:
          enum:
            - GET
            - PUT
            - DELETE
            - POST
            - PATCH
          type: string
        type: array
    required:
      - href
  Location:
    properties:
      address:
        $ref: "#/definitions/Address"
      analytics:
        $ref: "#/definitions/Analytics"
      category:
        description: category of the location
        enum:
          - SIGHTS
          - BEACH_PARK
          - HISTORICAL
          - NIGHTLIFE
          - RESTAURANT
          - SHOPPING
        example: HISTORICAL
        type: string
      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
      id:
        description: id of the ressource
        type: string
      name:
        description: short name of the location
        example: Paris CDG
        type: string
      rank:
        description: the rank is the position compared to other locations based on how famous is a place. 1 being the highest.
        example: 1
        type: string
      relevance:
        description: score value calculated based on distance and analytics
        example: 9.6584
        format: double
        type: number
      self:
        $ref: "#/definitions/Links"
      subType:
        description: location sub type
        enum:
          - AIRPORT
          - CITY
          - POINT_OF_INTEREST
          - DISTRICT
        example: AIRPORT
        type: string
      tags:
        description: list of tags related to the location
        items:
          example:
            - grocery
            - japanese
            - cafe
          type: string
        type: array
      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-24T09:50:53.074Z
