---
title: "Sun Times"
method: POST
path: "/sun-times"
tags: ["Core"]
---

# Sun Times

`POST /sun-times`

Calculate sunrise, sunset, twilight times, and day length for a given date and geographic location.

## Request body

- SunTimes
  - `date` string, required
  - `latitude` number, nullable, required
  - `longitude` number, nullable, required
  - `timezoneOffset` number, nullable — Hours from UTC at the given moment, not minutes. Fractional zones are hours too: 5.5 for India, 5.75 for Nepal, -3.5 for Newfoundland. Defaults to 0, meaning UTC.

## Response `200`

Successful calculation

- object
  - `ok` boolean
  - `data` object
    - `sunrise` string, nullable
    - `sunset` string, nullable
    - `dayLength` number, nullable
    - `dawn` string, nullable
    - `dusk` string, nullable

## Other responses

- `400` — Validation error
- `401` — Missing or invalid API key

## Changes

- **2026-08-15** `e637d1a9911b` — 2 warning, 1 info
  - the `timezoneOffset` request property's max was set to `14.00`
  - the `timezoneOffset` request property's min was set to `-14.00`
  - the `timezoneOffset` request property default value `0` was added

[Change history](https://skmtc.dev/astroway/apis/astroway-calculation-api/changes/sun-times/post.md)

---

[API](https://skmtc.dev/astroway/apis/astroway-calculation-api.md) · [All operations](https://skmtc.dev/astroway/apis/astroway-calculation-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/astroway/astroway-calculation-api/revisions/8ab5a768b521/schema)
