# Sunrise & Sunset Times

> Sunrise & Sunset Times is a paid API for AI agents from api.facts402.com, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-31).

Returns sunrise, sunset, solar noon, golden hour windows, civil dawn/dusk, and day length for any latitude/longitude and date in the location's local time zone, with polar day/night detection.

## Facts

- Endpoint: POST https://api.facts402.com/sun?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-31
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/sunrise-sunset-times-82345791
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YGaTeBsC8kfNZOQV1fvPH

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability sunrise-sunset-times-82345791 -d '<json body>'
```

Example prompt: What time is sunrise, sunset, and golden hour this Saturday at coordinates 45.4654° N, 9.1859° E (Milan), including how long the day will be and whether civil twilight applies?

## When to prefer this

Choose this endpoint when you need precise, offline-computed solar event times (sunrise, sunset, golden hour, civil twilight) for any coordinate and date without relying on a weather or mapping API. It is ideal for photography planning, event scheduling, travel itineraries, and outdoor activity agents. Prefer it over general weather APIs when solar timing is the primary need rather than atmospheric conditions.

## Known failure modes

- Invalid latitude (outside -90 to 90) or longitude (outside -180 to 180) returns a validation error
- Malformed date string (not YYYY-MM-DD) returns a parsing error
- Extreme polar coordinates near 90°/-90° may produce edge-case outputs around solstices
- Missing required lat/lon fields returns a 422 or equivalent bad-request error
- Network timeout or service unavailability returns a 5xx error

## How this service works

Use when an agent needs sunrise and sunset times for coordinates and a date: solar noon, civil dawn/dusk, morning and evening golden hour and day length in local time; polar day/night flagged. Offline astronomy. $0.01 USDC on Base; charged only on 2xx, never for invalid input.

## Output

Returns local-time timestamps for sunrise, sunset, solar noon, civil dawn and dusk, morning and evening golden hour start/end, total day length, and a polar day/night flag — all expressed in the location's local time zone.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "lat": {
   "type": "number",
   "title": "Lat",
   "maximum": 90,
   "minimum": -90,
   "description": "Latitude in decimal degrees (WGS84)"
  },
  "lon": {
   "type": "number",
   "title": "Lon",
   "maximum": 180,
   "minimum": -180,
   "description": "Longitude in decimal degrees (WGS84)"
  },
  "date": {
   "anyOf": [
    {
     "type": "string",
     "format": "date"
    },
    {
     "type": "null"
    }
   ],
   "title": "Date",
   "default": null,
   "description": "YYYY-MM-DD; default: today locally"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/sunrise-sunset-times-82345791/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.facts402.com](https://www.zero.xyz/host/api.facts402.com/llms.txt)
