# 2s.io Sunrise/Sunset Solar Times Calculator

> 2s.io Sunrise/Sunset Solar Times Calculator is a paid API for AI agents from 2s.io, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-13).

Computes sunrise, sunset, solar noon, and twilight times (civil, nautical, astronomical) for a geographic coordinate and date, returned in UTC ISO 8601

## Facts

- Endpoint: GET https://2s.io/api/sunrise/compute
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/2s-io-ae2885d1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_jLzjicu3qRejgPEupjSvz

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 2s-io-ae2885d1
```

Example prompt: What time does the sun rise and set in Reykjavik (lat 64.1355, lon -21.8954) on December 21, 2025, and how long is the day? Also give me civil and nautical twilight times.

## When to prefer this

Use this endpoint when you need precise, programmatically computed solar event times (sunrise, sunset, twilight phases) for any global coordinate and date — especially when you need all twilight categories (civil, nautical, astronomical) in a single call, or when handling edge cases like polar regions where events may not occur.

## Known failure modes

- Invalid latitude outside -90..90 returns validation error
- Invalid longitude outside -180..180 returns validation error
- Date not in YYYY-MM-DD format returns parse error
- At high latitudes near solstice, some or all events return null with polar day/night note
- Missing required parameters (lat, lon, date) returns 400-level error
- Payment not included or insufficient results in 402 Payment Required

## How this service works

Compute sunrise, sunset, solar noon, and civil/nautical/astronomical twilight times for a coordinate + date. Query: lat (-90..90), lon (-180..180), date (YYYY-MM-DD). All times returned as ISO 8601 UTC. At high latitudes near solstices an event may not occur (polar day/night) — those fields return null and a note is included. dayLengthMinutes is the sunrise→sunset interval.

## Output

Returns ISO 8601 UTC timestamps for sunrise, sunset, solar noon, civil twilight start/end, nautical twilight start/end, and astronomical twilight start/end, plus dayLengthMinutes (sunrise-to-sunset interval). At extreme latitudes near solstices, events that don't occur (polar day/night) return null with an explanatory note.

## Example request

```json
{
 "input": {
  "type": "http",
  "method": "GET",
  "queryParams": {
   "lat": 40.7128,
   "lon": -74.006,
   "date": "2025-06-21"
  }
 }
}
```

## 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",
    "queryParams"
   ],
   "properties": {
    "type": {
     "const": "http"
    },
    "method": {
     "const": "GET"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "lat",
      "lon",
      "date"
     ],
     "properties": {
      "lat": {
       "type": "number",
       "maximum": 90,
       "minimum": -90
      },
      "lon": {
       "type": "number",
       "maximum": 180,
       "minimum": -180
      },
      "date": {
       "type": "string"
      }
     },
     "additionalProperties": false
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "schema": {
  "type": "object",
  "required": [
   "ok",
   "items",
   "total",
   "source"
  ],
  "properties": {
   "ok": {
    "enum": [
     true
    ],
    "type": "boolean"
   },
   "meta": {
    "type": "object",
    "required": [
     "query"
    ],
    "properties": {
     "query": {
      "type": "object",
      "required": [
       "latitude",
       "longitude",
       "date"
      ],
      "properties": {
       "date": {
        "type": "string"
       },
       "latitude": {
        "type": "number"
       },
       "longitude": {
        "type": "number"
       }
      },
      "additionalProperties": false
     }
    },
    "additionalProperties": false
   },
   "items": {
    "type": "array",
    "items": {
     "type": "object",
     "additionalProperties": {}
    }
   },
   "total": {
    "type": "integer",
    "nullable": true,
    "description": "Total matching rows upstream; null when unknown."
   },
   "source": {
    "type": "object",
    "required": [
     "provider",
     "url",
     "license"
    ],
    "properties": {
     "url": {
      "type": "string"
     },
     "license": {
      "type": "string"
     },
     "provider": {
      "type": "string"
     }
    },
    "additionalProperties": false
   }
  },
  "additionalProperties": false
 },
 "example": {
  "ok": true,
  "meta": {
   "query": {
    "date": "example",
    "latitude": 1,
    "longitude": 1
   }
  },
  "items": [
   {}
  ],
  "total": 1,
  "source": {
   "url": "example",
   "license": "example",
   "provider": "example"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/2s-io-ae2885d1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 2s.io](https://www.zero.xyz/host/2s.io/llms.txt)
