v1

latestOpenAPI 3.1.02026-07-132718.1 KB

Sun times (v1, stable legacy)

Original endpoint, supported indefinitely without changes. Defaults to 12h AM/PM times in UTC; formatted=0 switches to ISO 8601 and day_length in seconds. Known quirks kept for compatibility: errors use {results:'', status:'INVALID_*'} with HTTP 400; polar days return epoch-1970 timestamps; an invalid tzid silently falls back to UTC. New integrations should use /v2.

get/json

Query parameters

latnumber required

Latitude in decimal degrees.

lngnumber required

Longitude in decimal degrees.

datestring

YYYY-MM-DD or PHP relative formats. Default: today (UTC).

formatted0 | 1

1 = 12h AM/PM strings (default), 0 = ISO 8601 and day_length in seconds.

tzidstring

IANA timezone identifier. Invalid values silently fall back to UTC.

callbackstring

JSONP callback name.

Response

OK.

status'OK' | 'INVALID_REQUEST' | 'INVALID_DATE' | 'UNKNOWN_ERROR'
tzidstring

Present on OK responses.