Jawg Matrix API

Valhalla sources_to_targets time-distance matrix service computing travel time and distance between every source and every target location for a given costing model.

OpenAPI Specification

jawg-maps-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Jawg Maps API
  description: >-
    Representative OpenAPI description of the public Jawg location platform:
    customizable vector and raster map tiles and hosted styles (tile.jawg.io),
    Places geocoding, Valhalla-based routing, matrix and isochrone services, and
    static maps (api.jawg.io). Every request is authenticated with a Jawg access
    token supplied as the `access-token` query parameter (a Bearer token in the
    Authorization header is also accepted on the api.jawg.io surfaces).
  termsOfService: https://www.jawg.io/en/terms/
  contact:
    name: Jawg Support
    url: https://www.jawg.io/en/contact/
  version: '1.0'
servers:
  - url: https://tile.jawg.io
    description: Map tiles, styles, and TileJSON
  - url: https://api.jawg.io
    description: Places, routing, matrix, isochrone, and static maps
security:
  - accessToken: []
tags:
  - name: Tiles
  - name: Styles
  - name: Places
  - name: Routing
  - name: Matrix
  - name: Isochrone
  - name: Static Maps
paths:
  /{styleId}/{z}/{x}/{y}.png:
    get:
      operationId: getRasterTile
      tags:
        - Tiles
      summary: Get a raster (PNG) map tile.
      description: >-
        Returns a raster map tile in the XYZ slippy-map scheme for the given
        hosted style. Append `@2x` before `.png` for retina tiles.
      servers:
        - url: https://tile.jawg.io
      parameters:
        - $ref: '#/components/parameters/StyleId'
        - $ref: '#/components/parameters/Z'
        - $ref: '#/components/parameters/X'
        - $ref: '#/components/parameters/Y'
        - $ref: '#/components/parameters/AccessTokenQuery'
        - $ref: '#/components/parameters/Lang'
        - $ref: '#/components/parameters/Worldview'
      responses:
        '200':
          description: A raster map tile.
          content:
            image/png:
              schema:
                type: string
                format: binary
        '401':
          $ref: '#/components/responses/Unauthorized'
  /{styleId}/{z}/{x}/{y}.pbf:
    get:
      operationId: getVectorTile
      tags:
        - Tiles
      summary: Get a vector (Mapbox Vector Tile) map tile.
      description: Returns a gzip-encoded Mapbox Vector Tile for the given hosted style.
      servers:
        - url: https://tile.jawg.io
      parameters:
        - $ref: '#/components/parameters/StyleId'
        - $ref: '#/components/parameters/Z'
        - $ref: '#/components/parameters/X'
        - $ref: '#/components/parameters/Y'
        - $ref: '#/components/parameters/AccessTokenQuery'
      responses:
        '200':
          description: A vector map tile.
          content:
            application/x-protobuf:
              schema:
                type: string
                format: binary
        '401':
          $ref: '#/components/responses/Unauthorized'
  /styles/{styleId}.json:
    get:
      operationId: getStyleJson
      tags:
        - Styles
      summary: Get the style JSON document for a hosted style.
      description: >-
        Returns the Mapbox GL style specification JSON for the hosted style,
        used to render vector maps in the browser.
      servers:
        - url: https://api.jawg.io
      parameters:
        - $ref: '#/components/parameters/StyleId'
        - $ref: '#/components/parameters/AccessTokenQuery'
        - $ref: '#/components/parameters/Lang'
        - name: extrude
          in: query
          description: Whether to enable 3D building extrusion in the returned style.
          schema:
            type: boolean
        - $ref: '#/components/parameters/Worldview'
      responses:
        '200':
          description: A Mapbox GL style JSON document.
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
  /styles/{styleId}/tilejson.json:
    get:
      operationId: getTileJson
      tags:
        - Styles
      summary: Get the TileJSON metadata for a hosted style.
      description: Returns a TileJSON 2.x metadata document describing the tileset.
      servers:
        - url: https://api.jawg.io
      parameters:
        - $ref: '#/components/parameters/StyleId'
        - $ref: '#/components/parameters/AccessTokenQuery'
      responses:
        '200':
          description: A TileJSON metadata document.
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
  /places/v1/search:
    get:
      operationId: geocodeSearch
      tags:
        - Places
      summary: Forward geocoding search.
      description: >-
        Searches for places, addresses, and points of interest matching a free
        text query and returns ranked results as a GeoJSON FeatureCollection.
      servers:
        - url: https://api.jawg.io
      parameters:
        - name: text
          in: query
          required: true
          description: The free-text query to geocode.
          schema:
            type: string
          example: 10 rue de la paix, Paris
        - $ref: '#/components/parameters/Size'
        - name: layers
          in: query
          description: Comma-separated feature layers to restrict the search to (e.g. address, venue, locality).
          schema:
            type: string
        - name: sources
          in: query
          description: Comma-separated data sources to restrict the search to (e.g. osm, oa, wof, gn).
          schema:
            type: string
        - name: boundary.country
          in: query
          description: ISO 3166-1 alpha-2/alpha-3 country code to restrict results.
          schema:
            type: string
        - name: focus.point.lat
          in: query
          description: Latitude used to bias results toward a location.
          schema:
            type: number
            format: double
        - name: focus.point.lon
          in: query
          description: Longitude used to bias results toward a location.
          schema:
            type: number
            format: double
        - $ref: '#/components/parameters/AccessTokenQuery'
      responses:
        '200':
          description: A GeoJSON FeatureCollection of geocoding results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeocodingResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /places/v1/autocomplete:
    get:
      operationId: geocodeAutocomplete
      tags:
        - Places
      summary: Autocomplete geocoding.
      description: Returns type-ahead suggestions for a partial text query.
      servers:
        - url: https://api.jawg.io
      parameters:
        - name: text
          in: query
          required: true
          description: The partial text to complete.
          schema:
            type: string
          example: 10 rue de la pa
        - name: focus.point.lat
          in: query
          schema:
            type: number
            format: double
        - name: focus.point.lon
          in: query
          schema:
            type: number
            format: double
        - $ref: '#/components/parameters/AccessTokenQuery'
      responses:
        '200':
          description: A GeoJSON FeatureCollection of autocomplete suggestions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeocodingResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /places/v1/reverse:
    get:
      operationId: geocodeReverse
      tags:
        - Places
      summary: Reverse geocoding.
      description: Returns the places nearest to a latitude/longitude coordinate.
      servers:
        - url: https://api.jawg.io
      parameters:
        - name: point.lat
          in: query
          required: true
          description: Latitude to reverse-geocode.
          schema:
            type: number
            format: double
          example: 48.8534
        - name: point.lon
          in: query
          required: true
          description: Longitude to reverse-geocode.
          schema:
            type: number
            format: double
          example: 2.3488
        - $ref: '#/components/parameters/Size'
        - name: layers
          in: query
          schema:
            type: string
        - $ref: '#/components/parameters/AccessTokenQuery'
      responses:
        '200':
          description: A GeoJSON FeatureCollection of reverse-geocoding results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeocodingResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /places/v1/place/{id}:
    get:
      operationId: getPlaceDetails
      tags:
        - Places
      summary: Get details for a place by its global identifier.
      description: Returns the full record for a place identified by its gid (source:layer:id).
      servers:
        - url: https://api.jawg.io
      parameters:
        - name: id
          in: path
          required: true
          description: The global identifier of the place (e.g. openstreetmap:venue:node/12345).
          schema:
            type: string
        - $ref: '#/components/parameters/AccessTokenQuery'
      responses:
        '200':
          description: A GeoJSON FeatureCollection containing the requested place.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeocodingResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /routing/route:
    post:
      operationId: computeRoute
      tags:
        - Routing
      summary: Compute a route between two or more locations.
      description: >-
        Valhalla turn-by-turn routing. Computes the best route across the
        supplied locations for the given costing model (auto, bicycle,
        pedestrian, ...).
      servers:
        - url: https://api.jawg.io
      parameters:
        - $ref: '#/components/parameters/AccessTokenQuery'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RouteRequest'
      responses:
        '200':
          description: A Valhalla route (trip) response.
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
  /routing/optimized_route:
    post:
      operationId: computeOptimizedRoute
      tags:
        - Routing
      summary: Compute an optimized (traveling-salesman) route.
      description: >-
        Valhalla optimized_route service that reorders the intermediate
        locations to minimize total cost between the fixed start and end.
      servers:
        - url: https://api.jawg.io
      parameters:
        - $ref: '#/components/parameters/AccessTokenQuery'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RouteRequest'
      responses:
        '200':
          description: An optimized Valhalla route response.
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
  /routing/sources_to_targets:
    post:
      operationId: computeMatrix
      tags:
        - Matrix
      summary: Compute a time-distance matrix.
      description: >-
        Valhalla sources_to_targets service computing travel time and distance
        from every source location to every target location.
      servers:
        - url: https://api.jawg.io
      parameters:
        - $ref: '#/components/parameters/AccessTokenQuery'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MatrixRequest'
      responses:
        '200':
          description: A Valhalla sources_to_targets matrix response.
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
  /routing/isochrone:
    post:
      operationId: computeIsochrone
      tags:
        - Isochrone
      summary: Compute isochrone / isodistance contours.
      description: >-
        Valhalla isochrone service returning GeoJSON contours of the area
        reachable within the requested time or distance intervals.
      servers:
        - url: https://api.jawg.io
      parameters:
        - $ref: '#/components/parameters/AccessTokenQuery'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IsochroneRequest'
      responses:
        '200':
          description: A GeoJSON FeatureCollection of isochrone contours.
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
  /static:
    get:
      operationId: getStaticMap
      tags:
        - Static Maps
      summary: Render a standalone static map image.
      description: >-
        Renders a static map image from a center, zoom, and size (or from an
        auto-fit set of features), optionally decorated with markers and paths.
      servers:
        - url: https://api.jawg.io
      parameters:
        - name: layer
          in: query
          description: The hosted style / layer to render (e.g. jawg-sunny).
          schema:
            type: string
          example: jawg-sunny
        - name: center
          in: query
          description: Map center as "lat,lon".
          schema:
            type: string
          example: 48.856,2.351
        - name: zoom
          in: query
          schema:
            type: integer
          example: 12
        - name: size
          in: query
          description: Image size as "widthxheight" in pixels.
          schema:
            type: string
          example: 400x300
        - name: format
          in: query
          schema:
            type: string
            enum:
              - png
              - jpg
            default: png
        - name: markers
          in: query
          description: Marker overlays to render on the image.
          schema:
            type: string
        - name: paths
          in: query
          description: Path (polyline/polygon) overlays to render on the image.
          schema:
            type: string
        - name: bearing
          in: query
          schema:
            type: number
            format: double
        - name: pitch
          in: query
          schema:
            type: number
            format: double
        - $ref: '#/components/parameters/AccessTokenQuery'
      responses:
        '200':
          description: A rendered static map image.
          content:
            image/png:
              schema:
                type: string
                format: binary
            image/jpeg:
              schema:
                type: string
                format: binary
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  securitySchemes:
    accessToken:
      type: apiKey
      in: query
      name: access-token
      description: Jawg access token, obtained from the Jawg App account.
    bearerAuth:
      type: http
      scheme: bearer
      description: Jawg access token supplied as a Bearer token on api.jawg.io surfaces.
  parameters:
    AccessTokenQuery:
      name: access-token
      in: query
      required: true
      description: Your Jawg access token.
      schema:
        type: string
    StyleId:
      name: styleId
      in: path
      required: true
      description: The hosted Jawg style identifier (e.g. jawg-sunny, jawg-streets, or a custom style ID).
      schema:
        type: string
      example: jawg-streets
    Z:
      name: z
      in: path
      required: true
      description: Tile zoom level.
      schema:
        type: integer
    X:
      name: x
      in: path
      required: true
      description: Tile column.
      schema:
        type: integer
    Y:
      name: y
      in: path
      required: true
      description: Tile row.
      schema:
        type: integer
    Lang:
      name: lang
      in: query
      description: Preferred label language (ISO 639-1).
      schema:
        type: string
    Worldview:
      name: worldview
      in: query
      description: Worldview used to render disputed borders.
      schema:
        type: string
    Size:
      name: size
      in: query
      description: Maximum number of results to return.
      schema:
        type: integer
        default: 10
  responses:
    Unauthorized:
      description: The access token is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
    Location:
      type: object
      required:
        - lat
        - lon
      properties:
        lat:
          type: number
          format: double
        lon:
          type: number
          format: double
        type:
          type: string
          enum:
            - break
            - through
            - via
            - break_through
    RouteRequest:
      type: object
      required:
        - locations
        - costing
      properties:
        locations:
          type: array
          minItems: 2
          items:
            $ref: '#/components/schemas/Location'
        costing:
          type: string
          enum:
            - auto
            - bicycle
            - pedestrian
            - bus
            - truck
            - motor_scooter
          example: auto
        costing_options:
          type: object
          description: Per-mode costing options.
        directions_options:
          type: object
          properties:
            units:
              type: string
              enum:
                - kilometers
                - miles
    MatrixRequest:
      type: object
      required:
        - sources
        - targets
        - costing
      properties:
        sources:
          type: array
          items:
            $ref: '#/components/schemas/Location'
        targets:
          type: array
          items:
            $ref: '#/components/schemas/Location'
        costing:
          type: string
          enum:
            - auto
            - bicycle
            - pedestrian
          example: auto
    IsochroneRequest:
      type: object
      required:
        - locations
        - costing
        - contours
      properties:
        locations:
          type: array
          items:
            $ref: '#/components/schemas/Location'
        costing:
          type: string
          enum:
            - auto
            - bicycle
            - pedestrian
          example: pedestrian
        contours:
          type: array
          items:
            type: object
            properties:
              time:
                type: number
                description: Contour time in minutes.
              distance:
                type: number
                description: Contour distance in kilometers.
              color:
                type: string
        polygons:
          type: boolean
          default: false
    GeocodingResponse:
      type: object
      description: A GeoJSON FeatureCollection returned by the Places API.
      properties:
        type:
          type: string
          example: FeatureCollection
        geocoding:
          type: object
          description: Query metadata (version, engine, query echo, timestamp).
        features:
          type: array
          items:
            $ref: '#/components/schemas/GeocodingFeature'
    GeocodingFeature:
      type: object
      properties:
        type:
          type: string
          example: Feature
        geometry:
          type: object
          properties:
            type:
              type: string
              example: Point
            coordinates:
              type: array
              items:
                type: number
                format: double
        properties:
          type: object
          properties:
            gid:
              type: string
            layer:
              type: string
            source:
              type: string
            name:
              type: string
            label:
              type: string
            confidence:
              type: number
              format: double
            country:
              type: string
            region:
              type: string
            locality:
              type: string