# Sunrise Sunset Times API

> Sunrise Sunset Times API is a paid API for AI agents from x402-deployer.x402-deployer.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Returns sunrise, sunset, solar noon, day length, golden hour, dawn/dusk, and civil/nautical/astronomical twilight times for any latitude/longitude on any date

## Facts

- Endpoint: POST https://x402-deployer.x402-deployer.workers.dev/sunrise-sunset
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-deployer-x402-deployer-workers-dev-2995778d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_hWaiSoUWflD1Yg_GzRAeW

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 x402-deployer-x402-deployer-workers-dev-2995778d -d '<json body>'
```

Example prompt: What time is sunrise, sunset, and golden hour at latitude 48.8566, longitude 2.3522 (Paris) on July 14th? Also give me civil and nautical twilight times.

## When to prefer this

Use this endpoint when you need precise solar event times (sunrise, sunset, twilight phases, golden hour) for a specific geographic coordinate and date. Prefer over generic weather APIs when you need the full set of twilight categories (civil/nautical/astronomical) or golden hour windows in ISO8601 UTC format.

## Known failure modes

- Invalid or out-of-range latitude/longitude returns an error
- Missing required parameters (lat, lng, date) returns a validation error
- Dates far in the past or future may return null values for polar regions with no sunrise/sunset
- Malformed date format returns a parse error

## How this service works

Sunrise sunset times. Returns sunrise, sunset, solar noon, day length, and civil / nautical / astronomical twilight begin and end for any latitude/longitude on any date. Also covers golden-hour and dawn / dusk. Same backend as astro-times under a more search-friendly slug. UTC ISO8601 strings.

## Output

Returns UTC ISO8601 strings for sunrise, sunset, solar noon, day length, civil twilight begin/end, nautical twilight begin/end, astronomical twilight begin/end, golden hour, and dawn/dusk for the given coordinates and date.

## Example request

```json
{
 "input": {
  "body": {
   "date": "2024-07-14",
   "latitude": 48.8566,
   "longitude": 2.3522
  },
  "type": "http",
  "method": "POST",
  "bodyType": "json"
 }
}
```

## 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",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "required": [
      "latitude",
      "longitude"
     ],
     "properties": {
      "date": {
       "type": "string",
       "description": "Date as YYYY-MM-DD. Defaults to today."
      },
      "latitude": {
       "type": "number",
       "description": "Latitude in decimal degrees, -90 to 90."
      },
      "longitude": {
       "type": "number",
       "description": "Longitude in decimal degrees, -180 to 180."
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "date": {
       "type": "string"
      },
      "times": {
       "type": "object",
       "properties": {
        "sunset": {
         "type": "string"
        },
        "sunrise": {
         "type": "string"
        }
       }
      },
      "source": {
       "type": "string"
      }
     }
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-deployer-x402-deployer-workers-dev-2995778d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-deployer.x402-deployer.workers.dev](https://www.zero.xyz/host/x402-deployer.x402-deployer.workers.dev/llms.txt)
