# opendata402 Sun Position & Daylight API

> opendata402 Sun Position & Daylight API is a paid API for AI agents from opendata402.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-15).

Returns sunrise, sunset, solar noon, day length, and solar elevation for any latitude/longitude and date using the NOAA solar algorithm

## Facts

- Endpoint: GET https://opendata402.com/v1/sun?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/opendata402-sun-position-daylight-api-b4d68596
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_pgHRIQBIchX9uRtxEqe5W

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 opendata402-sun-position-daylight-api-b4d68596
```

Example prompt: What time does the sun rise and set tomorrow in Amsterdam (52.3676° N, 4.9041° E), and how long will the day be?

## When to prefer this

Choose this endpoint when you need accurate, algorithmically computed solar times (sunrise, sunset, solar noon) for any global coordinate and date, especially for automation triggers, scheduling, or engineering calculations. It is based on the NOAA solar algorithm (accurate to ~1 minute) and handles edge cases like polar day/night. Prefer it over weather APIs that incidentally include sunrise/sunset but don't guarantee accuracy or polar handling, and over local device APIs when you need server-side computation for arbitrary coordinates.

## Known failure modes

- Invalid latitude (outside -90..90) or longitude (outside -180..180) returns a validation error
- Malformed date string (not YYYY-MM-DD format) returns a parse error
- Missing required lat or lon parameters returns a 400-level error
- Locations at extreme polar latitudes during solstice periods return polar day/night indicators instead of standard times

## How this service works

Sunrise, sunset, solar noon, day length and the sun's elevation at noon for any latitude, longitude and date, computed with the NOAA solar algorithm (accurate to about a minute; times in UTC; polar day and night handled). Use it for solar panel and lighting schedules, photography, outdoor work planning and daylight-dependent automations.

## Output

A JSON object containing sunrise time, sunset time, solar noon time, total day length, and solar elevation angle at noon, all in UTC. Polar day and polar night conditions are handled explicitly.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "lat",
      "lon"
     ],
     "properties": {
      "lat": {
       "type": "string",
       "pattern": "^-?\\d{1,2}(\\.\\d+)?$",
       "description": "Latitude -90..90."
      },
      "lon": {
       "type": "string",
       "pattern": "^-?\\d{1,3}(\\.\\d+)?$",
       "description": "Longitude -180..180."
      },
      "date": {
       "type": "string",
       "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
       "description": "YYYY-MM-DD (default today, UTC)."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/opendata402-sun-position-daylight-api-b4d68596/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from opendata402.com](https://www.zero.xyz/host/opendata402.com/llms.txt)
