Moon-API Advanced API

The Advanced API from Moon-API — 1 operation(s) for advanced.

OpenAPI Specification

moon-api-advanced-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Moon-API.com Advanced API
  description: API for retrieving detailed moon phase data, sun data, calendars, and astronomical information
  version: 2.0.0
  contact:
    name: Moon-API.com
    url: https://moon-api.com
servers:
- url: https://moon-phase.p.rapidapi.com
  description: Production server (via RapidAPI)
security:
- RapidAPIKey: []
tags:
- name: Advanced
paths:
  /advanced:
    get:
      summary: Get detailed moon and sun data (MEGA plan)
      description: Returns comprehensive astronomical data. Lat/lon are optional and default to London coordinates. Backwards compatible.
      parameters:
      - $ref: '#/components/parameters/latitudeParam'
      - $ref: '#/components/parameters/longitudeParam'
      - $ref: '#/components/parameters/timestampParam'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MoonSunResponse'
              example:
                timestamp: 1768327440
                datestamp: Tue, 13 Jan 2026 18:04:00 +0000
                plan: MEGA
                sun:
                  sunrise: 1768291282
                  sunrise_timestamp: 08:01
                  sunset: 1768321044
                  sunset_timestamp: '16:17'
                  solar_noon: '12:09'
                  day_length: 08:16
                  position:
                    altitude: -15.787896
                    azimuth: 255.330169
                    distance: 147145019639.96698
                  next_solar_eclipse:
                    timestamp: 1771329600
                    datestamp: Tue, 17 Feb 2026 12:00:00 +0000
                    type: Annular Solar Eclipse
                    visibility_regions: 's Argentina & Chile, s Africa, Antarctica ; [Annular: Antarctica]'
                moon:
                  phase: 0.8294482328
                  phase_name: Waning crescent
                  major_phase: New Moon
                  stage: waning
                  illumination: 22%
                  age_days: 24
                  lunar_cycle: 22.49%
                  emoji: 🌒
                  zodiac:
                    sun_sign: Capricorn
                    moon_sign: Scorpio
                  moonrise: 02:27
                  moonrise_timestamp: 1768184871
                  moonset: '11:17'
                  moonset_timestamp: 1768216634
                  detailed:
                    position:
                      altitude: -55.204021
                      azimuth: 308.80069
                      distance: 405395288.669185
                      parallactic_angle: 29.033486
                      phase_angle: 123.39
                    visibility:
                      visible_hours: 0
                      best_viewing_time: 02:27
                      visibility_rating: Poor
                      illumination: 22.49%
                      viewing_conditions:
                        phase_quality: Good for observing surface detail along terminator line
                        recommended_equipment:
                          filters: No filters needed
                          telescope: 4-inch or larger recommended
                          best_magnification: High magnification (100-200x) for crater detail
                    upcoming_phases:
                      new_moon:
                        last:
                          timestamp: 1766024400
                          datestamp: Wed, 07 Jan 2026 00:00:00 +0000
                          days_ago: 6
                        next:
                          timestamp: 1768732800
                          datestamp: Fri, 06 Feb 2026 00:00:00 +0000
                          days_ahead: 24
                    illumination_details:
                      percentage: 22.49
                      visible_fraction: 0.2249
                      phase_angle: 123.39
        '400':
          description: Bad request
        '500':
          description: Server error
      tags:
      - Advanced
components:
  parameters:
    timestampParam:
      name: timestamp
      in: query
      description: Unix timestamp (optional, defaults to current time)
      required: false
      schema:
        type: integer
    longitudeParam:
      name: lon
      in: query
      description: Longitude coordinate (-180 to 180). Optional, defaults to -0.1278 (London, UK - west is negative)
      required: false
      schema:
        type: number
        minimum: -180
        maximum: 180
        default: -0.1278
    latitudeParam:
      name: lat
      in: query
      description: Latitude coordinate (-90 to 90). Optional, defaults to 51.5074 (London, UK)
      required: false
      schema:
        type: number
        minimum: -90
        maximum: 90
        default: 51.5074
  schemas:
    MoonSunResponse:
      type: object
      properties:
        timestamp:
          type: integer
          example: 1768327440
        datestamp:
          type: string
          example: Tue, 13 Jan 2026 18:04:00 +0000
        plan:
          type: string
          example: MEGA
        next_eclipse:
          type: object
          description: Present for ULTRA and MEGA plans. Next upcoming eclipse with countdown.
          properties:
            timestamp:
              type: integer
              example: 1771329600
            datestamp:
              type: string
              example: Tue, 17 Feb 2026 12:00:00 +0000
            type:
              type: string
              example: Annular Solar Eclipse
            visibility_regions:
              type: string
              example: s Argentina & Chile, s Africa, Antarctica
            category:
              type: string
              enum:
              - solar
              - lunar
              example: solar
            countdown:
              type: object
              properties:
                days:
                  type: integer
                  example: 28
                hours:
                  type: integer
                  example: 18
                minutes:
                  type: integer
                  example: 51
                seconds:
                  type: integer
                  example: 22
                total_seconds:
                  type: integer
                  example: 2487082
        sun:
          type: object
          properties:
            sunrise:
              type: integer
              example: 1768291282
            sunrise_timestamp:
              type: string
              example: 08:01
            sunset:
              type: integer
              example: 1768321044
            sunset_timestamp:
              type: string
              example: '16:17'
            solar_noon:
              type: string
              example: '12:09'
            day_length:
              type: string
              example: 08:16
            position:
              type: object
              properties:
                altitude:
                  type: number
                  example: -15.787896
                azimuth:
                  type: number
                  example: 255.330169
                distance:
                  type: number
                  example: 147145019639.96698
            next_solar_eclipse:
              type: object
              properties:
                timestamp:
                  type: integer
                  example: 1771329600
                datestamp:
                  type: string
                  example: Tue, 17 Feb 2026 12:00:00 +0000
                type:
                  type: string
                  example: Annular Solar Eclipse
                visibility_regions:
                  type: string
                  example: 's Argentina & Chile, s Africa, Antarctica ; [Annular: Antarctica]'
            next_transit:
              type: object
              properties:
                timestamp:
                  type: integer
                  example: 1983944460
                datestamp:
                  type: string
                  example: Sat, 13 Nov 2032 07:41:00 +0000
                planet:
                  type: string
                  example: Mercury
                type:
                  type: string
                  example: Mercury Transit
                visibility_regions:
                  type: string
                  example: Americas, Europe, Africa, Asia, Australia (visible where Sun is above horizon)
        moon:
          type: object
          properties:
            phase:
              type: number
              example: 0.8294482328
            phase_name:
              type: string
              example: Waning crescent
            major_phase:
              type: string
              example: New Moon
            stage:
              type: string
              example: waning
            illumination:
              type: string
              example: 22%
            age_days:
              type: integer
              example: 24
            lunar_cycle:
              type: string
              example: 22.49%
            emoji:
              type: string
              example: 🌒
            zodiac:
              type: object
              properties:
                sun_sign:
                  type: string
                  example: Capricorn
                moon_sign:
                  type: string
                  example: Scorpio
            moonrise:
              type: string
              example: 02:27
            moonrise_timestamp:
              type: integer
              example: 1768184871
            moonset:
              type: string
              example: '11:17'
            moonset_timestamp:
              type: integer
              example: 1768216634
            detailed:
              type: object
              properties:
                position:
                  type: object
                  properties:
                    altitude:
                      type: number
                      example: -55.204021
                    azimuth:
                      type: number
                      example: 308.80069
                    distance:
                      type: number
                      example: 405395288.669185
                    parallactic_angle:
                      type: number
                      example: 29.033486
                    phase_angle:
                      type: number
                      example: 123.39
                visibility:
                  type: object
                  properties:
                    visible_hours:
                      type: integer
                      example: 0
                    best_viewing_time:
                      type: string
                      example: 02:27
                    visibility_rating:
                      type: string
                      example: Poor
                    illumination:
                      type: string
                      example: 22.49%
                    viewing_conditions:
                      type: object
                      properties:
                        phase_quality:
                          type: string
                          example: Good for observing surface detail along terminator line
                        recommended_equipment:
                          type: object
                          properties:
                            filters:
                              type: string
                              example: No filters needed
                            telescope:
                              type: string
                              example: 4-inch or larger recommended
                            best_magnification:
                              type: string
                              example: High magnification (100-200x) for crater detail
                upcoming_phases:
                  type: object
                  properties:
                    new_moon:
                      type: object
                      properties:
                        last:
                          type: object
                          properties:
                            timestamp:
                              type: integer
                            datestamp:
                              type: string
                            days_ago:
                              type: integer
                        next:
                          type: object
                          properties:
                            timestamp:
                              type: integer
                            datestamp:
                              type: string
                            days_ahead:
                              type: integer
                    first_quarter:
                      type: object
                      properties:
                        last:
                          type: object
                          properties:
                            timestamp:
                              type: integer
                            datestamp:
                              type: string
                            days_ago:
                              type: integer
                        next:
                          type: object
                          properties:
                            timestamp:
                              type: integer
                            datestamp:
                              type: string
                            days_ahead:
                              type: integer
                    full_moon:
                      type: object
                      properties:
                        last:
                          type: object
                          properties:
                            timestamp:
                              type: integer
                            datestamp:
                              type: string
                            days_ago:
                              type: integer
                            name:
                              type: string
                            description:
                              type: string
                        next:
                          type: object
                          properties:
                            timestamp:
                              type: integer
                            datestamp:
                              type: string
                            days_ahead:
                              type: integer
                            name:
                              type: string
                            description:
                              type: string
                    last_quarter:
                      type: object
                      properties:
                        last:
                          type: object
                          properties:
                            timestamp:
                              type: integer
                            datestamp:
                              type: string
                            days_ago:
                              type: integer
                        next:
                          type: object
                          properties:
                            timestamp:
                              type: integer
                            datestamp:
                              type: string
                            days_ahead:
                              type: integer
                illumination_details:
                  type: object
                  properties:
                    percentage:
                      type: number
                      example: 22.49
                    visible_fraction:
                      type: number
                      example: 0.2249
                    phase_angle:
                      type: number
                      example: 123.39
            events:
              type: object
              properties:
                moonrise_visible:
                  type: boolean
                  example: true
                moonset_visible:
                  type: boolean
                  example: true
                optimal_viewing_period:
                  type: object
                  properties:
                    start_time:
                      type: string
                      example: 02:27
                    end_time:
                      type: string
                      example: '11:17'
                    duration_hours:
                      type: integer
                      example: 8
                    viewing_quality:
                      type: string
                      example: Good for crater observation along terminator
                    recommendations:
                      type: array
                      items:
                        type: string
                      example:
                      - Visible most of the night
                      - Good period for observing maria (dark areas) and mountain ranges
                      - Medium to high magnification recommended for detail
            next_lunar_eclipse:
              type: object
              properties:
                timestamp:
                  type: integer
                  example: 1772537640
                datestamp:
                  type: string
                  example: Tue, 03 Mar 2026 11:34:00 +0000
                  description: Maximum eclipse time
                type:
                  type: string
                  example: Total Lunar Eclipse
                visibility_regions:
                  type: string
                  example: eastern Asia, Australia, Pacific, Americas
  securitySchemes:
    RapidAPIKey:
      type: apiKey
      name: x-rapidapi-key
      in: header
      description: RapidAPI authentication key