WeatherAPI Marine API

Marine and sailing weather

OpenAPI Specification

weatherapi-marine-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: WeatherAPI.com Alerts Marine API
  description: 'WeatherAPI.com provides real-time, forecast, historical, marine, future, astronomy, air quality, pollen, sports, IP lookup, timezone, and geolocation data via a JSON/XML REST API. Trusted by 850,000+ developers worldwide. Average response time ~200ms.


    ## Authentication

    All endpoints require an API key passed as the `key` query parameter.


    ## Base URL

    `https://api.weatherapi.com/v1`


    ## Location Query (`q` parameter)

    Accepts: city name, lat/lon decimal, US zip, UK postcode, Canada postal code, METAR code (`metar:EGLL`), IATA airport code (`iata:DXB`), IP lookup (`auto:ip`), IPv4/IPv6 address, or location ID (`id:2801268`).


    ## Plans

    - **Free**: 100K calls/month, 3-day forecast, 1-day history

    - **Starter**: $7/mo — 3M calls, 7-day forecast, 7-day history

    - **Pro+**: $25/mo — 5M calls, 300-day future, 365-day history

    - **Business**: $65/mo — 10M calls, evapotranspiration

    - **Enterprise**: Custom — 15-min interval, pollen history, wind@100m, SLA'
  version: 1.0.2
  contact:
    name: WeatherAPI.com Support
    url: https://www.weatherapi.com/contact.aspx
  license:
    name: Commercial / Non-Commercial
    url: https://www.weatherapi.com/terms.aspx
  x-logo:
    url: https://cdn.weatherapi.com/v4/images/weatherapi_logo.png
  x-last-validated: '2026-05-28'
  x-generated-from: provider-openapi
servers:
- url: https://api.weatherapi.com/v1
  description: Production (HTTPS)
- url: http://api.weatherapi.com/v1
  description: Production (HTTP)
security:
- ApiKeyAuth: []
tags:
- name: Marine
  description: Marine and sailing weather
paths:
  /marine.json:
    get:
      tags:
      - Marine
      summary: WeatherAPI Marine Weather
      description: Returns marine and sailing weather forecast (up to 7 days depending on plan) including tide data (Pro+ and above), wave height, swell, and water temperature.
      operationId: getMarine
      parameters:
      - $ref: '#/components/parameters/key'
      - $ref: '#/components/parameters/q'
      - name: days
        in: query
        required: true
        description: Number of forecast days (1–7 depending on plan).
        schema:
          type: integer
          minimum: 1
          maximum: 7
        example: 1
      - $ref: '#/components/parameters/dt'
      - $ref: '#/components/parameters/hour'
      - name: tides
        in: query
        required: false
        description: Enable/disable tide data (Pro+ and above).
        schema:
          type: string
          enum:
          - 'yes'
          - 'no'
        example: 'yes'
      responses:
        '200':
          description: Marine weather data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarineWeatherResponse'
              examples:
                GetMarine200Example:
                  summary: Default getMarine 200 response
                  x-microcks-default: true
                  value:
                    location:
                      name: London
                      region: City of London, Greater London
                      country: United Kingdom
                      lat: 51.5074
                      lon: -0.1278
                      tz_id: Europe/London
                      localtime_epoch: 1748441400
                      localtime: 2026-05-28 15:30
                    forecast:
                      forecastday:
                      - date: '2026-05-28'
                        date_epoch: 1748441400
                        tides: []
                        hour: []
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  parameters:
    hour:
      name: hour
      in: query
      required: false
      description: Restrict output to a specific hour (0–23) in 24-hour format.
      schema:
        type: integer
        minimum: 0
        maximum: 23
    q:
      name: q
      in: query
      required: true
      description: 'Location query. Accepts: city name, lat/lon, US zip, UK postcode, Canada postal code, METAR code (metar:EGLL), IATA (iata:DXB), auto:ip, IPv4/IPv6, or location ID (id:2801268).'
      schema:
        type: string
        example: London
    key:
      name: key
      in: query
      required: true
      description: Your WeatherAPI.com API key.
      schema:
        type: string
        example: YOUR_API_KEY
    dt:
      name: dt
      in: query
      required: false
      description: Restrict date output in yyyy-MM-dd format.
      schema:
        type: string
        format: date
  schemas:
    ForecastDay:
      type: object
      properties:
        maxtemp_c:
          type: number
          example: 18.5
        maxtemp_f:
          type: number
          example: 65.3
        mintemp_c:
          type: number
          example: 18.5
        mintemp_f:
          type: number
          example: 65.3
        avgtemp_c:
          type: number
          example: 18.5
        avgtemp_f:
          type: number
          example: 65.3
        maxwind_mph:
          type: number
          example: 12.4
        maxwind_kph:
          type: number
          example: 12.4
        totalprecip_mm:
          type: number
          example: 0.5
        totalprecip_in:
          type: number
          example: 0.5
        totalsnow_cm:
          type: number
          example: 1.0
        avgvis_km:
          type: number
          example: 10.0
        avgvis_miles:
          type: number
          example: 10.0
        avghumidity:
          type: integer
          example: 65
        daily_will_it_rain:
          type: integer
          example: 1
        daily_chance_of_rain:
          type: integer
          example: 1
        daily_will_it_snow:
          type: integer
          example: 1
        daily_chance_of_snow:
          type: integer
          example: 1
        condition:
          $ref: '#/components/schemas/Condition'
        uv:
          type: number
          example: 4.0
        air_quality:
          $ref: '#/components/schemas/AirQuality'
    HourForecast:
      type: object
      properties:
        time_epoch:
          type: integer
          example: 1748441400
        time:
          type: string
          example: sample value
        temp_c:
          type: number
          example: 18.5
        temp_f:
          type: number
          example: 65.3
        is_day:
          type: integer
          example: 1
        condition:
          $ref: '#/components/schemas/Condition'
        wind_mph:
          type: number
          example: 12.4
        wind_kph:
          type: number
          example: 12.4
        wind_degree:
          type: integer
          example: 1
        wind_dir:
          type: string
          example: WSW
        pressure_mb:
          type: number
          example: 1013.0
        pressure_in:
          type: number
          example: 1013.0
        precip_mm:
          type: number
          example: 0.5
        precip_in:
          type: number
          example: 0.5
        snow_cm:
          type: number
          example: 1.0
        humidity:
          type: integer
          example: 65
        cloud:
          type: integer
          example: 40
        feelslike_c:
          type: number
          example: 17.8
        feelslike_f:
          type: number
          example: 17.8
        windchill_c:
          type: number
          example: 12.4
        windchill_f:
          type: number
          example: 12.4
        heatindex_c:
          type: number
          example: 1.0
        heatindex_f:
          type: number
          example: 1.0
        dewpoint_c:
          type: number
          example: 1.0
        dewpoint_f:
          type: number
          example: 1.0
        will_it_rain:
          type: integer
          example: 1
        chance_of_rain:
          type: integer
          example: 1
        will_it_snow:
          type: integer
          example: 1
        chance_of_snow:
          type: integer
          example: 1
        vis_km:
          type: number
          example: 10.0
        vis_miles:
          type: number
          example: 10.0
        gust_mph:
          type: number
          example: 22.1
        gust_kph:
          type: number
          example: 22.1
        uv:
          type: number
          example: 4.0
        short_rad:
          type: number
          example: 1.0
        diff_rad:
          type: number
          example: 1.0
        et0:
          type: number
          description: Evapotranspiration (Business+)
          example: 1.0
        air_quality:
          $ref: '#/components/schemas/AirQuality'
        pollen:
          $ref: '#/components/schemas/Pollen'
    AstroElement:
      type: object
      properties:
        sunrise:
          type: string
          example: 05:30 AM
        sunset:
          type: string
          example: 08:45 PM
        moonrise:
          type: string
          example: 10:15 PM
        moonset:
          type: string
          example: 06:42 AM
        moon_phase:
          type: string
          example: Waxing Crescent
        moon_illumination:
          type: number
          example: 35.0
        is_moon_up:
          type: integer
          example: 1
        is_sun_up:
          type: integer
          example: 1
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: WeatherAPI error code
            message:
              type: string
      example:
        error:
          code: 1006
          message: No location found matching parameter 'q'
    MarineWeatherResponse:
      type: object
      properties:
        location:
          $ref: '#/components/schemas/Location'
        forecast:
          type: object
          properties:
            forecastday:
              type: array
              items:
                $ref: '#/components/schemas/MarineForecastDay'
    AirQuality:
      type: object
      description: Air quality data. Returned when aqi=yes.
      properties:
        co:
          type: number
          description: Carbon monoxide µg/m³
          example: 1.0
        o3:
          type: number
          description: Ozone µg/m³
          example: 1.0
        no2:
          type: number
          description: Nitrogen dioxide µg/m³
          example: 1.0
        so2:
          type: number
          description: Sulphur dioxide µg/m³
          example: 1.0
        pm2_5:
          type: number
          description: PM2.5 µg/m³
          example: 1.0
        pm10:
          type: number
          description: PM10 µg/m³
          example: 1.0
        us-epa-index:
          type: integer
          description: US EPA index 1–6 (1=Good, 6=Hazardous)
          example: 1
        gb-defra-index:
          type: integer
          description: UK DEFRA index 1–10
          example: 1
    MarineHour:
      type: object
      allOf:
      - $ref: '#/components/schemas/HourForecast'
      properties:
        sig_ht_mt:
          type: number
          description: Significant wave height in metres
          example: 1.0
        swell_ht_mt:
          type: number
          example: 0.8
        swell_ht_ft:
          type: number
          example: 0.8
        swell_dir:
          type: number
          example: 0.8
        swell_dir_16_point:
          type: string
          example: sample value
        swell_period_secs:
          type: number
          example: 0.8
        water_temp_c:
          type: number
          description: Water temp °C (Pro+ and above)
          example: 18.5
        water_temp_f:
          type: number
          example: 65.3
    Condition:
      type: object
      properties:
        text:
          type: string
          description: Weather condition description
          example: Partly Cloudy
        icon:
          type: string
          description: URL to condition icon
          example: //cdn.weatherapi.com/weather/64x64/day/116.png
        code:
          type: integer
          description: Condition code (see conditions.json)
          example: 1003
    Pollen:
      type: object
      description: Pollen data in grains/m³. Returned when pollen=yes (Pro+ and above).
      properties:
        Hazel:
          type: number
          example: 1.0
        Alder:
          type: number
          example: 1.0
        Birch:
          type: number
          example: 1.0
        Oak:
          type: number
          example: 1.0
        Grass:
          type: number
          example: 1.0
        Mugwort:
          type: number
          example: 1.0
        Ragweed:
          type: number
          example: 1.0
    Tide:
      type: object
      properties:
        tide_time:
          type: string
          example: 2026-05-28 04:30
        tide_height_mt:
          type: number
          example: 1.0
        tide_type:
          type: string
          enum:
          - High
          - Low
          example: High
    MarineForecastDay:
      type: object
      properties:
        date:
          type: string
          format: date
          example: '2026-05-28'
        date_epoch:
          type: integer
          example: 1748441400
        day:
          $ref: '#/components/schemas/ForecastDay'
        astro:
          $ref: '#/components/schemas/AstroElement'
        tides:
          type: array
          items:
            type: object
            properties:
              tide:
                type: array
                items:
                  $ref: '#/components/schemas/Tide'
        hour:
          type: array
          items:
            $ref: '#/components/schemas/MarineHour'
    Location:
      type: object
      description: Location metadata returned with every weather response.
      properties:
        name:
          type: string
          description: Location name
          example: London
        region:
          type: string
          description: Region or state
          example: City of London, Greater London
        country:
          type: string
          description: Country name
          example: United Kingdom
        lat:
          type: number
          format: float
          description: Latitude
          example: 51.5074
        lon:
          type: number
          format: float
          description: Longitude
          example: -0.1278
        tz_id:
          type: string
          description: IANA timezone ID, e.g. Europe/London
          example: Europe/London
        localtime_epoch:
          type: integer
          description: Local time as Unix epoch
          example: 1748441400
        localtime:
          type: string
          description: Local date and time string
          example: 2026-05-28 15:30
  responses:
    Forbidden:
      description: Forbidden — API key quota exceeded, disabled, or plan does not include this resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized — API key missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    BadRequest:
      description: Bad request — invalid parameter or location not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: query
      name: key
      description: API key obtained from https://www.weatherapi.com/my/. Pass as `?key=YOUR_API_KEY` query parameter.
externalDocs:
  description: Official WeatherAPI.com Documentation
  url: https://www.weatherapi.com/docs/