swagger: "2.0"
schemes:
  - https
host: api.faretrotter.com
basePath: /v2.0/{apikey}
info:
  contact:
    x-twitter: faretrotter
  description: Multimodal travel API to return modes of transportation between cities and points of interest.
  title: Faretrotter Travel API
  version: "2.0"
  x-apisguru-categories:
    - transport
  x-logo:
    url: https://twitter.com/faretrotter/profile_image?size=original
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Faretrotter/api/master/docs/oas20.yaml
      version: "2.0"
  x-providerName: faretrotter.com
securityDefinitions:
  ApiKeyAuth:
    in: header
    name: ApiKeyAuth
    type: apiKey
paths:
  /places:
    get:
      operationId: GET_places
      produces:
        - application/json
      responses:
        "200":
          description: Everything worked as expected.
          schema:
            $ref: "#/definitions/PlaceResponse"
        "400":
          description: Parameters did not match the endpoint requirements. Check that all required fields are present and spelt correctly.
        "401":
          description: Authentication Failed.
        "402":
          description: All parameters are correct but the request failed.
        "403":
          description: Request IP does not match IP address registered with key.
        "404":
          description: The endpoint doesn't exist.
        "429":
          description: Too many requests hit the API too quickly.
        "501":
          description: Server error
        "502":
          description: Server error
      summary: Returns possible modes of transportation between two cities.
  /routes:
    get:
      consumes:
        - text/html
      operationId: GET_routes
      parameters:
        - in: query
          name: origin_lat
          required: true
          type: number
        - in: query
          name: origin_lng
          required: true
          type: number
        - in: query
          name: destination_lat
          required: true
          type: number
        - in: query
          name: destination_lng
          required: true
          type: number
      produces:
        - application/json
      responses:
        "200":
          description: Everything worked as expected.
          schema:
            $ref: "#/definitions/RoutesResponse"
        "400":
          description: Parameters did not match the endpoint requirements. Check that all required fields are present and spelt correctly.
        "401":
          description: Authentication Failed.
        "402":
          description: All parameters are correct but the request failed.
        "403":
          description: Request IP does not match IP address registered with key.
        "404":
          description: The endpoint doesn't exist.
        "429":
          description: Too many requests hit the API too quickly.
        "501":
          description: Server error
        "502":
          description: Server error
definitions:
  PlaceResponse:
    properties:
      city:
        type: string
      country:
        type: string
      geoname_id:
        type: string
      id:
        type: string
      lat:
        type: number
      lng:
        type: number
      name:
        type: string
      name_long:
        type: string
      region:
        type: string
      slug:
        type: string
      type:
        type: string
    required:
      - id
      - name
      - name_long
      - city
      - region
      - country
      - type
      - slug
      - lat
      - lng
      - geoname_id
    title: Place response
    type: object
  PlacesResponse:
    properties:
      places:
        items:
          $ref: "#/definitions/PlaceResponse"
        type: array
      request:
        properties:
          distance_miles:
            type: number
          endpoint:
            type: string
          environment:
            type: string
          fields:
            properties:
              destination_lat:
                type: number
              destination_lng:
                type: number
              origin_lat:
                type: number
              origin_lng:
                type: number
            required:
              - origin_lat
              - origin_lng
              - destination_lat
              - destination_lng
            type: object
          version:
            type: string
        required:
          - environment
          - version
          - endpoint
          - fields
          - distance_miles
        type: object
      status:
        properties:
          code:
            type: number
          message:
            type: string
        required:
          - code
          - message
        type: object
    required:
      - status
      - request
      - places
    title: Places response
    type: object
  RoutesResponse:
    properties:
      data:
        properties:
          operators:
            items:
              properties:
                attributes:
                  items:
                    type: string
                  type: array
                code:
                  type: string
                id:
                  type: string
                logo_img:
                  type: string
                mode:
                  type: string
                name:
                  type: string
              required:
                - id
                - name
                - logo_img
                - mode
                - code
                - attributes
              type: object
            type: array
          places:
            items:
              $ref: "#/definitions/PlaceResponse"
            type: array
          routes:
            items:
              properties:
                co2:
                  type: number
                destination_id:
                  type: string
                duration:
                  type: number
                fare:
                  type: number
                mode:
                  type: string
                origin_id:
                  type: string
              required:
                - origin_id
                - destination_id
                - mode
                - fare
                - duration
                - co2
              type: object
            type: array
        required:
          - routes
          - places
          - operators
        type: object
      request:
        properties:
          distance_miles:
            type: number
          endpoint:
            type: string
          environment:
            type: string
          fields:
            properties:
              destination_lat:
                type: number
              destination_lng:
                type: number
              origin_lat:
                type: number
              origin_lng:
                type: number
            required:
              - origin_lat
              - origin_lng
              - destination_lat
              - destination_lng
            type: object
          version:
            type: string
        required:
          - environment
          - version
          - endpoint
          - fields
          - distance_miles
        type: object
      response:
        properties:
          time:
            type: number
          url:
            type: string
        required:
          - url
          - time
        type: object
      status:
        properties:
          code:
            type: number
          message:
            type: string
        required:
          - code
          - message
        type: object
    required:
      - status
      - request
      - data
      - response
    title: Routes response
    type: object
