{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/openephemeris-com/json-schema/openephemeris-com-moon-phases-response-schema.json",
  "title": "MoonPhasesResponse",
  "description": "Moon phases over a date range.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/openephemeris-com-calendar-api-openapi.yml#/components/schemas/MoonPhasesResponse",
  "properties": {
    "_meta": {
      "description": "Calculation metadata",
      "title": " Meta",
      "type": "object"
    },
    "data": {
      "allOf": [
        {
          "$ref": "#/$defs/LunarPhaseResult"
        }
      ],
      "description": "The matching phase events"
    },
    "range": {
      "additionalProperties": {
        "type": "string"
      },
      "description": "Start and end dates of the search",
      "title": "Range",
      "type": "object"
    }
  },
  "required": [
    "range",
    "data",
    "_meta"
  ],
  "type": "object",
  "$defs": {
    "LunarApsis": {
      "description": "One lunar perigee (closest approach) or apogee (farthest point): the instant the Moon's geocentric distance is at its minimum or maximum, found from DE440 to about a second.",
      "properties": {
        "distance_km": {
          "description": "Geometric Earth-Moon centre-to-centre distance at the apsis, km.",
          "format": "double",
          "type": "number"
        },
        "time": {
          "description": "Instant of the apsis, ISO-8601 with the UTC offset of the response's timezone.",
          "format": "date-time",
          "type": "string"
        },
        "type": {
          "description": "perigee or apogee (stable id).",
          "enum": [
            "perigee",
            "apogee"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "time",
        "distance_km"
      ],
      "title": "LunarApsis",
      "type": "object"
    },
    "LunarPhaseResult": {
      "properties": {
        "apsides": {
          "description": "Perigees and apogees in the same 30-day range, in time order (times in UTC).",
          "items": {
            "$ref": "#/$defs/LunarApsis"
          },
          "type": "array"
        },
        "current_phase": {
          "description": "The eight-bucket lunar phase the Moon is in at the query instant (new_moon, waxing_crescent, first_quarter, waxing_gibbous, full_moon, waning_gibbous, third_quarter, waning_crescent). This is a state at the requested date/jd, not a phase event, and it is never included in events.",
          "title": "Current Phase",
          "type": "string"
        },
        "events": {
          "description": "Principal phase events (new_moon, first_quarter, full_moon, third_quarter) occurring in the requested range, each timed to the exact moment the phase is reached. Sorted chronologically.",
          "items": {
            "$ref": "#/$defs/MoonPhaseEvent"
          },
          "title": "Events",
          "type": "array"
        },
        "supermoon_definition": {
          "description": "The supermoon_definition applied: orbit_90 or year_90.",
          "type": "string"
        }
      },
      "required": [
        "events"
      ],
      "title": "LunarPhaseResult",
      "type": "object"
    },
    "MoonPhaseEvent": {
      "properties": {
        "distance_class": {
          "description": "New and Full Moon only: supermoon (relative_distance >= 0.9), micromoon (<= 0.1) or regular.",
          "enum": [
            "supermoon",
            "micromoon",
            "regular"
          ],
          "type": "string"
        },
        "distance_km": {
          "description": "New and Full Moon only: geometric Earth-Moon centre-to-centre distance at the phase, km.",
          "format": "double",
          "type": "number"
        },
        "phase": {
          "description": "One of new_moon, first_quarter, full_moon, third_quarter",
          "title": "Phase",
          "type": "string"
        },
        "relative_distance": {
          "description": "New and Full Moon only: (Da - D) / (Da - Dp) under supermoon_definition; 1 at perigee distance, 0 at apogee distance.",
          "format": "double",
          "type": "number"
        },
        "time": {
          "description": "ISO 8601 UTC timestamp of exactly when the phase occurs",
          "title": "Time",
          "type": "string"
        }
      },
      "required": [
        "phase",
        "time"
      ],
      "title": "MoonPhaseEvent",
      "type": "object"
    }
  }
}