{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ipgeolocation/json-schema/ipgeolocation-astronomy-lookup-response-schema.json",
  "title": "AstronomyLookupResponse",
  "description": "Response returned by the single-date Astronomy Lookup API.\n\nContains a `location` object with geolocation details for the\nresolved location, and an `astronomy` object with astronomical\nevent times and positional data for the requested date.\n\nThe `location` object structure varies based on the lookup method:\n- Coordinate or location-based lookups return basic geographic fields.\n- IP-based lookups return extended geolocation fields including\n  continent, country codes, district, and zipcode.\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ipgeolocation-astronomy-api-openapi.yml#/components/schemas/AstronomyLookupResponse",
  "type": "object",
  "properties": {
    "ip": {
      "type": "string",
      "description": "The IP address used for the astronomy lookup. Returned only when\nthe lookup is performed using the `ip` parameter or when the API\nresolves the caller's IP automatically (no parameters provided).\n"
    },
    "location": {
      "$ref": "#/$defs/Location"
    },
    "astronomy": {
      "$ref": "#/$defs/AstronomyData"
    }
  },
  "$defs": {
    "AstronomyData": {
      "type": "object",
      "description": "Astronomical data for the resolved location and requested date.\n\nIncludes event times for sunrise, sunset, moonrise, moonset,\ntwilight phases, golden hour, blue hour, solar noon, and\nastronomical midnight, as well as real-time positional data\nfor the Sun and Moon at the current time of day.\n\nAll timestamp fields (except `current_time` and `day_length`) are\nin `HH:mm` format by default. When the `time_zone` parameter is\nprovided, they are returned as full date-time values in\n`yyyy-MM-dd HH:mm` format.\n",
      "properties": {
        "time_zone": {
          "type": "string",
          "description": "The IANA timezone identifier used for timestamp conversion.\nThis field appears only when the `time_zone` query parameter\nwas provided in the request.\n"
        },
        "date": {
          "type": "string",
          "description": "The date for which astronomical data is returned, in `yyyy-MM-dd` format."
        },
        "current_time": {
          "type": "string",
          "description": "Current local time at the resolved location in `HH:mm:ss.SSS` format.\nUsed as the reference time for real-time positional calculations\n(altitude, azimuth, distance).\n"
        },
        "mid_night": {
          "type": "string",
          "description": "Astronomical midnight (nadir) for the given date, in `HH:mm` format.\n"
        },
        "night_end": {
          "type": "string",
          "description": "End of night / start of astronomical twilight in the morning,\nin `HH:mm` format.\n"
        },
        "morning": {
          "$ref": "#/$defs/TwilightPhase"
        },
        "sunrise": {
          "type": "string",
          "description": "Time at which the sun rises at the resolved location, in `HH:mm` format.\n"
        },
        "sunset": {
          "type": "string",
          "description": "Time at which the sun sets at the resolved location, in `HH:mm` format.\n"
        },
        "evening": {
          "$ref": "#/$defs/TwilightPhase"
        },
        "night_begin": {
          "type": "string",
          "description": "Start of night / end of astronomical twilight in the evening,\nin `HH:mm` format.\n"
        },
        "sun_status": {
          "type": "string",
          "description": "Represents the current state of the sun relative to the horizon:\n\n- `\"-\"` — Normal day with both sunrise and sunset occurring.\n- `\"Always above the twilight angle\"` — The sun does not set\n  (perpetual daylight, e.g. polar summer).\n- `\"Always below the twilight angle\"` — The sun does not rise\n  within the current 24-hour period (e.g. polar night).\n"
        },
        "solar_noon": {
          "type": "string",
          "description": "The time when the sun is at its highest point in the sky,\nin `HH:mm` format.\n"
        },
        "day_length": {
          "type": "string",
          "description": "Total length of daylight for the date, from sunrise to sunset,\nin `HH:mm` format.\n"
        },
        "sun_altitude": {
          "type": "number",
          "format": "float",
          "description": "The sun's altitude angle above the horizon at `current_time`,\nmeasured in degrees. Negative values indicate the sun is below\nthe horizon.\n"
        },
        "sun_distance": {
          "type": "number",
          "format": "float",
          "description": "Distance from Earth to the sun at `current_time`, in kilometers.\n"
        },
        "sun_azimuth": {
          "type": "number",
          "format": "float",
          "description": "The azimuth angle of the sun at `current_time`, indicating its\ncompass direction in degrees (0° = North, 90° = East, etc.).\n"
        },
        "moon_phase": {
          "type": "string",
          "description": "The current phase of the moon, indicating its position in the\nlunar cycle.\n",
          "enum": [
            "NEW_MOON",
            "WAXING_CRESCENT",
            "FIRST_QUARTER",
            "WAXING_GIBBOUS",
            "FULL_MOON",
            "WANING_GIBBOUS",
            "LAST_QUARTER",
            "WANING_CRESCENT"
          ]
        },
        "moonrise": {
          "type": "string",
          "description": "Time at which the moon rises at the resolved location, in `HH:mm`\nformat. Returns `\"-:-\"` if the moon does not rise on this date.\n"
        },
        "moonset": {
          "type": "string",
          "description": "Time at which the moon sets at the resolved location, in `HH:mm`\nformat. Returns `\"-:-\"` if the moon does not set on this date.\n"
        },
        "moon_status": {
          "type": "string",
          "description": "Represents the current state of the moon relative to the horizon:\n\n- `\"-\"` — Normal day with both moonrise and moonset occurring.\n- `\"Always above the horizon\"` — The moon does not set within\n  the current 24-hour period.\n- `\"Always below the horizon\"` — The moon does not rise within\n  the current 24-hour period.\n"
        },
        "moon_altitude": {
          "type": "number",
          "format": "float",
          "description": "The moon's altitude angle above the horizon at `current_time`,\nmeasured in degrees. Negative values indicate the moon is below\nthe horizon.\n"
        },
        "moon_distance": {
          "type": "number",
          "format": "float",
          "description": "Distance from Earth to the moon at `current_time`, in kilometers.\n"
        },
        "moon_azimuth": {
          "type": "number",
          "format": "float",
          "description": "The azimuth angle of the moon at `current_time`, indicating its\ncompass direction in degrees.\n"
        },
        "moon_parallactic_angle": {
          "type": "number",
          "format": "float",
          "description": "The angle between the celestial pole and the moon's position\nrelative to the observer's location, measured in degrees.\n"
        },
        "moon_illumination_percentage": {
          "type": "string",
          "description": "The percentage of the moon's surface illuminated by sunlight\nas viewed from Earth. Returned as a string with two decimal\nplaces. Negative values indicate a waning phase.\n"
        },
        "moon_angle": {
          "type": "number",
          "format": "float",
          "description": "The angular diameter of the moon as observed from Earth,\nmeasured in degrees.\n"
        }
      }
    },
    "Location": {
      "type": "object",
      "description": "Geolocation information associated with the resolved location.\n\nFor coordinate-based or location-string lookups, only basic geographic\nfields are returned (latitude, longitude, country, state, city, locality,\nelevation).\n\nFor IP-based lookups, extended fields are also returned including\ncontinent codes, country codes, district, zipcode, and other metadata.\n",
      "properties": {
        "location_string": {
          "type": "string",
          "description": "The location string provided in the request. Only present when the\n`location` query parameter was used.\n"
        },
        "continent_code": {
          "type": "string",
          "description": "Two-letter continent code. Returned for IP-based lookups only."
        },
        "continent_name": {
          "type": "string",
          "description": "Full name of the continent. Returned for IP-based lookups only."
        },
        "country_code2": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2 country code. Returned for IP-based lookups only.\n"
        },
        "country_code3": {
          "type": "string",
          "description": "ISO 3166-1 alpha-3 country code. Returned for IP-based lookups only.\n"
        },
        "country_name": {
          "type": "string",
          "description": "Common name of the country."
        },
        "country_name_official": {
          "type": "string",
          "description": "Official name of the country. Returned for IP-based lookups only.\n"
        },
        "is_eu": {
          "type": "boolean",
          "description": "Indicates whether the country is a member of the European Union.\nReturned for IP-based lookups only.\n"
        },
        "state_prov": {
          "type": "string",
          "description": "State, province, or region name."
        },
        "state_code": {
          "type": "string",
          "description": "Standardized state or region code. Returned for IP-based lookups only.\n"
        },
        "district": {
          "type": "string",
          "description": "District or administrative subdivision. Returned for IP-based\nlookups only.\n"
        },
        "city": {
          "type": "string",
          "description": "City name of the location."
        },
        "locality": {
          "type": "string",
          "description": "Smaller locality or neighborhood within the city."
        },
        "zipcode": {
          "type": "string",
          "description": "ZIP or postal code of the location. Returned for IP-based\nlookups only.\n"
        },
        "latitude": {
          "type": "string",
          "format": "float",
          "description": "Latitude coordinate of the resolved location."
        },
        "longitude": {
          "type": "string",
          "format": "float",
          "description": "Longitude coordinate of the resolved location."
        },
        "elevation": {
          "type": "string",
          "description": "Elevation above sea level at the location, in meters."
        }
      }
    },
    "TwilightPhase": {
      "type": "object",
      "description": "Twilight phase times for either the morning (pre-sunrise) or evening\n(post-sunset) period.\n\nIncludes astronomical, nautical, and civil twilight windows, as well\nas blue hour and golden hour windows commonly used in photography.\n\nAll times are in `HH:mm` format by default. When the `time_zone`\nparameter is provided, times are returned as full date-time values\nin `yyyy-MM-dd HH:mm` format.\n",
      "properties": {
        "astronomical_twilight_begin": {
          "type": "string",
          "description": "Start of astronomical twilight. In the morning, this marks the\nend of night; in the evening, this marks the start of night sky.\n"
        },
        "astronomical_twilight_end": {
          "type": "string",
          "description": "End of astronomical twilight."
        },
        "nautical_twilight_begin": {
          "type": "string",
          "description": "Start of nautical twilight, when the horizon first becomes visible.\n"
        },
        "nautical_twilight_end": {
          "type": "string",
          "description": "End of nautical twilight."
        },
        "civil_twilight_begin": {
          "type": "string",
          "description": "Start of civil twilight, when there is enough light for outdoor\nactivities without artificial lighting.\n"
        },
        "civil_twilight_end": {
          "type": "string",
          "description": "End of civil twilight."
        },
        "blue_hour_begin": {
          "type": "string",
          "description": "Start of the blue hour, a period of soft diffused light with a\nblue color tone.\n"
        },
        "blue_hour_end": {
          "type": "string",
          "description": "End of the blue hour."
        },
        "golden_hour_begin": {
          "type": "string",
          "description": "Start of the golden hour, a period of warm low-angle light\nfavored by photographers.\n"
        },
        "golden_hour_end": {
          "type": "string",
          "description": "End of the golden hour."
        }
      }
    }
  }
}