OpenWeatherMap Geocoding API

Direct and reverse geocoding between location names and coordinates.

Documentation

Specifications

Schemas & Data

Other Resources

🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/current-weather-example.json
🔗
GraphQL
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/graphql/openweathermap-graphql.md
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/forecast-five-day-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/one-call-current-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/air-pollution-current-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/geocoding-direct-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/history-city-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/statistical-month-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/accumulated-temperature-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/solar-irradiance-interval-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/road-risk-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/weather-stations-create-example.json
🔗
Examples
https://raw.githubusercontent.com/api-evangelist/openweathermap/refs/heads/main/examples/weather-maps-tile-example.json

OpenAPI Specification

openweathermap-geocoding-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: OpenWeatherMap Accumulated Parameters Geocoding API
  version: 2.5.0
  description: Returns accumulated temperature and accumulated precipitation totals over a user-specified historical time window. Targeted at agricultural and energy-sector applications. Available on Professional and Expert plans.
  contact:
    name: OpenWeather
    url: https://openweathermap.org/api/accumulated-parameters
  license:
    name: Creative Commons Attribution-ShareAlike 4.0 International
    url: https://creativecommons.org/licenses/by-sa/4.0/
servers:
- url: https://history.openweathermap.org/data/2.5/history
  description: Accumulated Parameters API base URL
security:
- appid: []
tags:
- name: Geocoding
  description: Direct and reverse geocoding between location names and coordinates.
paths:
  /direct:
    get:
      operationId: getDirectGeocoding
      summary: Direct Geocoding By Location Name
      description: Returns geographic coordinates for a location specified by city name, optional state code (US only), and optional ISO 3166 country code.
      tags:
      - Geocoding
      parameters:
      - name: q
        in: query
        required: true
        description: City name, optional state and country codes, comma-separated.
        schema:
          type: string
      - name: limit
        in: query
        required: false
        description: Maximum number of locations to return. Up to 5.
        schema:
          type: integer
          minimum: 1
          maximum: 5
      - $ref: '#/components/parameters/Appid'
      responses:
        '200':
          description: Direct geocoding response.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GeocodingResult'
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized.
        '429':
          description: Too many requests.
  /zip:
    get:
      operationId: getZipGeocoding
      summary: Direct Geocoding By Zip Or Post Code
      description: Returns the coordinates for a zip or postal code, requires a country code suffix.
      tags:
      - Geocoding
      parameters:
      - name: zip
        in: query
        required: true
        description: Zip code and country code, comma-separated.
        schema:
          type: string
      - $ref: '#/components/parameters/Appid'
      responses:
        '200':
          description: Zip geocoding response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ZipGeocodingResult'
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized.
        '429':
          description: Too many requests.
  /reverse:
    get:
      operationId: getReverseGeocoding
      summary: Reverse Geocoding By Coordinate
      description: Returns the location name or names associated with the supplied latitude and longitude.
      tags:
      - Geocoding
      parameters:
      - name: lat
        in: query
        required: true
        description: Latitude in decimal degrees.
        schema:
          type: number
          format: float
      - name: lon
        in: query
        required: true
        description: Longitude in decimal degrees.
        schema:
          type: number
          format: float
      - name: limit
        in: query
        required: false
        description: Maximum number of locations to return.
        schema:
          type: integer
      - $ref: '#/components/parameters/Appid'
      responses:
        '200':
          description: Reverse geocoding response.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GeocodingResult'
        '400':
          description: Invalid request parameters.
        '401':
          description: Unauthorized.
        '429':
          description: Too many requests.
components:
  schemas:
    GeocodingResult:
      type: object
      properties:
        name:
          type: string
        local_names:
          type: object
          additionalProperties:
            type: string
        lat:
          type: number
          format: float
        lon:
          type: number
          format: float
        country:
          type: string
        state:
          type: string
    ZipGeocodingResult:
      type: object
      properties:
        zip:
          type: string
        name:
          type: string
        lat:
          type: number
          format: float
        lon:
          type: number
          format: float
        country:
          type: string
  parameters:
    Appid:
      name: appid
      in: query
      required: true
      description: OpenWeather API key.
      schema:
        type: string
  securitySchemes:
    appid:
      type: apiKey
      in: query
      name: appid