{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/openephemeris-com/json-schema/openephemeris-com-lunar-phase-response-schema.json",
  "title": "LunarPhaseResponse",
  "description": "High-precision lunar phase calculation, indicating the exact illumination percentage, phase angle, and the time remaining until the next key phase.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/openephemeris-com-lunar-api-openapi.yml#/components/schemas/LunarPhaseResponse",
  "additionalProperties": false,
  "properties": {
    "apsides": {
      "$ref": "#/$defs/LunarApsides"
    },
    "days_to_full": {
      "anyOf": [
        {
          "type": "number"
        }
      ],
      "description": "Days until next Full Moon",
      "title": "Days To Full"
    },
    "days_to_new": {
      "anyOf": [
        {
          "type": "number"
        }
      ],
      "description": "Days until next New Moon",
      "title": "Days To New"
    },
    "illumination": {
      "description": "Moon illumination percentage (0-100)",
      "title": "Illumination",
      "type": "number"
    },
    "metadata": {
      "description": "Calculation metadata",
      "title": "Metadata",
      "type": "object"
    },
    "moon_degree": {
      "description": "The Moon's degree within its sign (0-30).",
      "title": "Moon Degree",
      "type": "number"
    },
    "moon_longitude": {
      "description": "The Moon's ecliptic longitude in degrees (0-360).",
      "title": "Moon Longitude",
      "type": "number"
    },
    "moon_sign": {
      "description": "Zodiac sign the Moon occupies at this instant (e.g. 'Capricorn'). Also present in metadata.moon_sign for backwards compatibility.",
      "title": "Moon Sign",
      "type": "string"
    },
    "next_full_moon": {
      "$ref": "#/$defs/LunarSyzygy"
    },
    "next_micromoon": {
      "allOf": [
        {
          "$ref": "#/$defs/LunarSyzygy"
        }
      ],
      "description": "The next Full Moon classed micromoon under supermoon_definition (within the next 16 lunations)."
    },
    "next_new_moon": {
      "$ref": "#/$defs/LunarSyzygy"
    },
    "next_supermoon": {
      "allOf": [
        {
          "$ref": "#/$defs/LunarSyzygy"
        }
      ],
      "description": "The next Full Moon classed supermoon under supermoon_definition (within the next 16 lunations)."
    },
    "phase_angle": {
      "description": "Sun-Moon angle in degrees (0-360)",
      "title": "Phase Angle",
      "type": "number"
    },
    "phase_name": {
      "description": "Phase name (New Moon, Waxing Crescent, First Quarter, Waxing Gibbous, Full Moon, Waning Gibbous, Last Quarter, Waning Crescent)",
      "title": "Phase Name",
      "type": "string"
    },
    "success": {
      "default": true,
      "description": "Calculation success status",
      "title": "Success",
      "type": "boolean"
    },
    "supermoon_definition": {
      "description": "The supermoon_definition applied: orbit_90 or year_90.",
      "type": "string"
    },
    "timezone": {
      "description": "IANA zone the apsis and New/Full Moon times are written in (UTC unless timezone was sent).",
      "type": "string"
    },
    "waxing": {
      "description": "True if Moon is waxing",
      "title": "Waxing",
      "type": "boolean"
    }
  },
  "required": [
    "phase_name",
    "illumination",
    "phase_angle",
    "waxing",
    "metadata"
  ],
  "type": "object",
  "$defs": {
    "LunarApsides": {
      "description": "The perigee and apogee passages either side of the requested instant, and where the Moon stands between them.",
      "properties": {
        "distance_km": {
          "description": "Geometric Earth-Moon centre-to-centre distance at the requested instant, km.",
          "format": "double",
          "type": "number"
        },
        "next_apogee": {
          "$ref": "#/$defs/LunarApsis"
        },
        "next_perigee": {
          "$ref": "#/$defs/LunarApsis"
        },
        "previous_apogee": {
          "$ref": "#/$defs/LunarApsis"
        },
        "previous_perigee": {
          "$ref": "#/$defs/LunarApsis"
        },
        "relative_distance": {
          "description": "(Da - D) / (Da - Dp) for the Moon now, against the perigee and apogee nearest in time: 1 at perigee, 0 at apogee.",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "previous_perigee",
        "next_perigee",
        "previous_apogee",
        "next_apogee",
        "distance_km",
        "relative_distance"
      ],
      "title": "LunarApsides",
      "type": "object"
    },
    "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"
    },
    "LunarSyzygy": {
      "description": "A New or Full Moon with the Moon's distance and its supermoon / micromoon class under the requested supermoon_definition.",
      "properties": {
        "distance_class": {
          "description": "supermoon (relative_distance >= 0.9), micromoon (<= 0.1) or regular.",
          "enum": [
            "supermoon",
            "micromoon",
            "regular"
          ],
          "type": "string"
        },
        "distance_km": {
          "description": "Geometric Earth-Moon centre-to-centre distance at that instant, km.",
          "format": "double",
          "type": "number"
        },
        "phase": {
          "description": "new_moon or full_moon (stable id).",
          "enum": [
            "new_moon",
            "full_moon"
          ],
          "type": "string"
        },
        "reference_apogee": {
          "$ref": "#/$defs/LunarApsis"
        },
        "reference_perigee": {
          "$ref": "#/$defs/LunarApsis"
        },
        "relative_distance": {
          "description": "(Da - D) / (Da - Dp): 1 at perigee distance, 0 at apogee distance, against reference_apogee and reference_perigee.",
          "format": "double",
          "type": "number"
        },
        "time": {
          "description": "Instant of the New or Full Moon (geocentric, apparent longitudes), ISO-8601 with the UTC offset of the response's timezone.",
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "phase",
        "time",
        "distance_km",
        "relative_distance",
        "distance_class",
        "reference_perigee",
        "reference_apogee"
      ],
      "title": "LunarSyzygy",
      "type": "object"
    }
  }
}