Space
Twilight & day-length geometry API
Returns solar declination, day length, and the sunrise/civil/nautical/astronomical twilight hour angles and band spans for a date and latitude (solar-depression geometry, returns null at polar day/night). Answers 'How long is twilight here?', 'Day length and twilight bands for this latitude?'.
Price$0.06per request
MethodPOST
Route/v1/space/twilight-times
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
spaceastronomytwilightcivil-twilightnautical-twilightastronomical-twilightday-lengthpositional-astronomy
API URL
Integration docshttps://x402.hexl.dev/v1/space/twilight-timesExample request
{
"date": "2024-06-21T00:00:00Z",
"latitude": 40
}Example response
{
"date": "2024-06-21",
"latitude": 40,
"solarDeclinationDeg": 23.435723,
"dayLengthHours": 15.01434,
"sunriseSunsetHourAngleDeg": 112.60753,
"civilTwilightHourAngleDeg": 120.82735,
"nauticalTwilightHourAngleDeg": 131.26511,
"astronomicalTwilightHourAngleDeg": 143.45547,
"daylightPlusCivilHours": 16.11031,
"daylightPlusNauticalHours": 17.50201,
"daylightPlusAstronomicalHours": 19.1274,
"civilTwilightDurationHours": 1.09598,
"interpretation": "Day length ≈ 15.01434 h at latitude 40°."
}Input schema
{
"type": "object",
"required": [
"date",
"latitude"
],
"properties": {
"date": {
"type": "string",
"description": "ISO 8601 date (UTC)",
"examples": [
"2024-06-21T00:00:00Z"
]
},
"latitude": {
"type": "number",
"description": "Observer latitude in degrees",
"examples": [
40
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}