Ambee Air Quality API

Hyperlocal air quality and AQI data (PM2.5, PM10, NO2, O3, SO2, CO) by latitude/longitude, city, country code, or postal code, plus historical and forecast lookups.

OpenAPI Specification

ambee-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Ambee API
  description: >-
    Ambee's environmental-intelligence REST API delivers hyperlocal air quality,
    pollen, weather, wildfire, soil, and NDVI/vegetation data worldwide. All
    requests are authenticated with an API key sent in the `x-api-key` header and
    are scoped by latitude/longitude, postal code, city, country code, or place
    name. Responses are JSON envelopes containing a `message` and `data` payload.
  termsOfService: https://www.getambee.com/terms-and-conditions
  contact:
    name: Ambee Support
    url: https://www.getambee.com/contact-us
  version: '1.0'
servers:
  - url: https://api.ambeedata.com
security:
  - ApiKeyAuth: []
tags:
  - name: Air Quality
  - name: Pollen
  - name: Weather
  - name: Fire
  - name: Soil
  - name: NDVI
paths:
  /latest/by-lat-lng:
    get:
      operationId: getAirQualityLatestByLatLng
      tags:
        - Air Quality
      summary: Latest air quality by latitude and longitude
      description: Returns the most recent air quality reading (AQI and pollutant concentrations) for a coordinate.
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirQualityResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /latest/by-city:
    get:
      operationId: getAirQualityLatestByCity
      tags:
        - Air Quality
      summary: Latest air quality by city
      parameters:
        - name: city
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirQualityResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /latest/by-postal-code:
    get:
      operationId: getAirQualityLatestByPostalCode
      tags:
        - Air Quality
      summary: Latest air quality by postal code
      parameters:
        - name: postalCode
          in: query
          required: true
          schema:
            type: string
        - name: countryCode
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirQualityResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /history/by-lat-lng:
    get:
      operationId: getAirQualityHistoryByLatLng
      tags:
        - Air Quality
      summary: Historical air quality by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
        - name: from
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: to
          in: query
          required: false
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirQualityResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /forecast/aq/by-lat-lng:
    get:
      operationId: getAirQualityForecastByLatLng
      tags:
        - Air Quality
      summary: Air quality forecast by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirQualityResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /latest/pollen/by-lat-lng:
    get:
      operationId: getPollenLatestByLatLng
      tags:
        - Pollen
      summary: Latest pollen by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PollenResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /latest/pollen/by-place:
    get:
      operationId: getPollenLatestByPlace
      tags:
        - Pollen
      summary: Latest pollen by place
      parameters:
        - $ref: '#/components/parameters/place'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PollenResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /history/pollen/by-lat-lng:
    get:
      operationId: getPollenHistoryByLatLng
      tags:
        - Pollen
      summary: Historical pollen by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
        - name: from
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: to
          in: query
          required: false
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PollenResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /forecast/pollen/by-lat-lng:
    get:
      operationId: getPollenForecastByLatLng
      tags:
        - Pollen
      summary: Pollen forecast by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PollenResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /forecast/v2/pollen/120hr/by-lat-lng:
    get:
      operationId: getPollen120hrForecastByLatLng
      tags:
        - Pollen
      summary: 120-hour pollen forecast by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PollenResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /weather/latest/by-lat-lng:
    get:
      operationId: getWeatherLatestByLatLng
      tags:
        - Weather
      summary: Latest weather by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
        - name: units
          in: query
          required: false
          schema:
            type: string
            enum: [si, us]
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WeatherResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /weather/history/by-lat-lng:
    get:
      operationId: getWeatherHistoryByLatLng
      tags:
        - Weather
      summary: Historical weather by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
        - name: from
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: to
          in: query
          required: false
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WeatherResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /weather/forecast/by-lat-lng:
    get:
      operationId: getWeatherForecastByLatLng
      tags:
        - Weather
      summary: Weather forecast by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WeatherResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /fire/latest/by-lat-lng:
    get:
      operationId: getFireLatestByLatLng
      tags:
        - Fire
      summary: Active wildfires by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FireResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /fire/risk/by-lat-lng:
    get:
      operationId: getFireRiskByLatLng
      tags:
        - Fire
      summary: Fire risk by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FireResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /soil/latest/by-lat-lng:
    get:
      operationId: getSoilLatestByLatLng
      tags:
        - Soil
      summary: Latest soil data by latitude and longitude
      description: Returns soil temperature and soil moisture at standard depths for a coordinate.
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SoilResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /soil/history/by-lat-lng:
    get:
      operationId: getSoilHistoryByLatLng
      tags:
        - Soil
      summary: Historical soil data by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
        - name: from
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: to
          in: query
          required: false
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SoilResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /ndvi/latest/by-lat-lng:
    get:
      operationId: getNdviLatestByLatLng
      tags:
        - NDVI
      summary: Latest NDVI by latitude and longitude
      description: Returns the most recent Normalized Difference Vegetation Index (NDVI/EVI) value for a coordinate.
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NdviResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /ndvi/history/by-lat-lng:
    get:
      operationId: getNdviHistoryByLatLng
      tags:
        - NDVI
      summary: Historical NDVI by latitude and longitude
      parameters:
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lng'
        - name: from
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: to
          in: query
          required: false
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NdviResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
  parameters:
    lat:
      name: lat
      in: query
      required: true
      description: Latitude of the location.
      schema:
        type: number
        format: float
    lng:
      name: lng
      in: query
      required: true
      description: Longitude of the location.
      schema:
        type: number
        format: float
    place:
      name: place
      in: query
      required: true
      description: Place or location name to resolve.
      schema:
        type: string
  responses:
    Unauthorized:
      description: Invalid or missing API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        message:
          type: string
          example: Invalid API Key
    AirQualityReading:
      type: object
      properties:
        CO:
          type: number
        NO2:
          type: number
        OZONE:
          type: number
        PM10:
          type: number
        PM25:
          type: number
        SO2:
          type: number
        AQI:
          type: integer
        aqiInfo:
          type: object
          properties:
            pollutant:
              type: string
            concentration:
              type: number
            category:
              type: string
        lat:
          type: number
        lng:
          type: number
        updatedAt:
          type: string
          format: date-time
    AirQualityResponse:
      type: object
      properties:
        message:
          type: string
          example: success
        stations:
          type: array
          items:
            $ref: '#/components/schemas/AirQualityReading'
    PollenCount:
      type: object
      properties:
        grass_pollen:
          type: integer
        tree_pollen:
          type: integer
        weed_pollen:
          type: integer
    PollenRisk:
      type: object
      properties:
        grass_pollen:
          type: string
        tree_pollen:
          type: string
        weed_pollen:
          type: string
    PollenData:
      type: object
      properties:
        time:
          type: integer
        lat:
          type: number
        lng:
          type: number
        Count:
          $ref: '#/components/schemas/PollenCount'
        Risk:
          $ref: '#/components/schemas/PollenRisk'
        updatedAt:
          type: string
          format: date-time
    PollenResponse:
      type: object
      properties:
        message:
          type: string
          example: success
        lat:
          type: number
        lng:
          type: number
        data:
          type: array
          items:
            $ref: '#/components/schemas/PollenData'
    WeatherData:
      type: object
      properties:
        time:
          type: integer
        summary:
          type: string
        icon:
          type: string
        temperature:
          type: number
        apparentTemperature:
          type: number
        dewPoint:
          type: number
        humidity:
          type: number
        pressure:
          type: number
        windSpeed:
          type: number
        windGust:
          type: number
        windBearing:
          type: number
        cloudCover:
          type: number
        uvIndex:
          type: number
        visibility:
          type: number
        ozone:
          type: number
        precipIntensity:
          type: number
        precipProbability:
          type: number
        precipType:
          type: string
    WeatherResponse:
      type: object
      properties:
        message:
          type: string
          example: success
        lat:
          type: number
        lng:
          type: number
        data:
          $ref: '#/components/schemas/WeatherData'
    FireEvent:
      type: object
      properties:
        lat:
          type: number
        lng:
          type: number
        confidence:
          type: number
        brightness:
          type: number
        frp:
          type: number
        detectedAt:
          type: string
          format: date-time
        satellite:
          type: string
    FireResponse:
      type: object
      properties:
        message:
          type: string
          example: success
        data:
          type: array
          items:
            $ref: '#/components/schemas/FireEvent'
    SoilData:
      type: object
      properties:
        time:
          type: integer
        soilTemperature:
          type: number
        soilMoisture:
          type: number
        depth:
          type: string
        unit:
          type: string
    SoilResponse:
      type: object
      properties:
        message:
          type: string
          example: success
        lat:
          type: number
        lng:
          type: number
        data:
          type: array
          items:
            $ref: '#/components/schemas/SoilData'
    NdviData:
      type: object
      properties:
        time:
          type: integer
        ndvi:
          type: number
        evi:
          type: number
    NdviResponse:
      type: object
      properties:
        message:
          type: string
          example: success
        lat:
          type: number
        lng:
          type: number
        data:
          type: array
          items:
            $ref: '#/components/schemas/NdviData'