OpenStreetMap Map Data API

Bulk map data retrieval by bounding box

OpenAPI Specification

openstreetmap-map-data-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: OpenStreetMap API v0.6 Capabilities Map Data API
  description: The OpenStreetMap main API v0.6 provides CRUD operations for map data editing including nodes, ways, relations, changesets, and notes. Requires OAuth 2.0 authentication for write operations. Maximum bounding box query area is 0.25 square degrees. Returns XML or JSON. Intended for editing, not high-volume read access.
  version: 0.6.0
  contact:
    name: OpenStreetMap Foundation
    url: https://osmfoundation.org/
  license:
    name: ODbL 1.0 (map data) / CC BY-SA 2.0 (tiles)
    url: https://www.openstreetmap.org/copyright
servers:
- url: https://api.openstreetmap.org/api/0.6
  description: OpenStreetMap production API
- url: https://master.apis.dev.openstreetmap.org/api/0.6
  description: OSM development/sandbox API
security:
- {}
- OAuth2:
  - read_prefs
  - write_api
  - write_notes
tags:
- name: Map Data
  description: Bulk map data retrieval by bounding box
paths:
  /map:
    get:
      operationId: getMapData
      summary: Get map data for a bounding box
      description: 'Retrieve all OSM nodes, ways, and relations within a bounding box. Maximum area: 0.25 square degrees. Returns all objects with their current attributes and tags. High-volume use should use Overpass API instead.'
      tags:
      - Map Data
      parameters:
      - name: bbox
        in: query
        required: true
        schema:
          type: string
        description: Bounding box as min_lon,min_lat,max_lon,max_lat (e.g., -0.489,51.28,0.236,51.686)
      responses:
        '200':
          description: OSM map data
          content:
            application/xml:
              schema:
                type: string
                description: OSM XML document
            application/json:
              schema:
                $ref: '#/components/schemas/OSMData'
        '400':
          description: Area too large or invalid bounding box
          content:
            text/plain:
              schema:
                type: string
        '509':
          description: User throttled for excessive use
components:
  schemas:
    Relation:
      type: object
      description: An OSM relation (groups nodes, ways, or other relations)
      properties:
        type:
          type: string
          enum:
          - relation
        id:
          type: integer
          format: int64
        members:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                - node
                - way
                - relation
              ref:
                type: integer
                format: int64
              role:
                type: string
        tags:
          type: object
          additionalProperties:
            type: string
        version:
          type: integer
        changeset:
          type: integer
          format: int64
        timestamp:
          type: string
          format: date-time
    Way:
      type: object
      description: An OSM way (an ordered list of nodes forming a line or polygon)
      properties:
        type:
          type: string
          enum:
          - way
        id:
          type: integer
          format: int64
        nodes:
          type: array
          items:
            type: integer
            format: int64
          description: Ordered list of node IDs
        tags:
          type: object
          additionalProperties:
            type: string
        version:
          type: integer
        changeset:
          type: integer
          format: int64
        timestamp:
          type: string
          format: date-time
        user:
          type: string
        uid:
          type: integer
        visible:
          type: boolean
    Node:
      type: object
      description: An OSM node (a single geographic point)
      properties:
        type:
          type: string
          enum:
          - node
        id:
          type: integer
          format: int64
        lat:
          type: number
          format: double
          minimum: -90
          maximum: 90
        lon:
          type: number
          format: double
          minimum: -180
          maximum: 180
        tags:
          type: object
          additionalProperties:
            type: string
          description: Key-value metadata tags
        version:
          type: integer
        changeset:
          type: integer
          format: int64
        timestamp:
          type: string
          format: date-time
        user:
          type: string
        uid:
          type: integer
        visible:
          type: boolean
    OSMData:
      type: object
      description: OSM data response containing nodes, ways, and relations
      properties:
        version:
          type: string
        generator:
          type: string
        copyright:
          type: string
        attribution:
          type: string
        license:
          type: string
        bounds:
          type: object
          properties:
            minlat:
              type: number
            minlon:
              type: number
            maxlat:
              type: number
            maxlon:
              type: number
        nodes:
          type: array
          items:
            $ref: '#/components/schemas/Node'
        ways:
          type: array
          items:
            $ref: '#/components/schemas/Way'
        relations:
          type: array
          items:
            $ref: '#/components/schemas/Relation'
  securitySchemes:
    OAuth2:
      type: oauth2
      description: OAuth 2.0 — required for write operations
      flows:
        authorizationCode:
          authorizationUrl: https://www.openstreetmap.org/oauth2/authorize
          tokenUrl: https://www.openstreetmap.org/oauth2/token
          scopes:
            read_prefs: Read user preferences
            write_prefs: Modify user preferences
            write_diary: Create diary entries
            write_api: Modify the map (nodes, ways, relations, changesets)
            read_gpx: Read private GPS traces
            write_gpx: Upload GPS traces
            write_notes: Create, comment on, and close notes
externalDocs:
  description: OSM API v0.6 Wiki
  url: https://wiki.openstreetmap.org/wiki/API_v0.6