# Sunrise Sunset API

> Sunrise Sunset calculates exact sunrise and sunset times, twilight stages, and golden hour windows for any latitude and longitude coordinates. Paid plans can specify custom dates and receive solar noon. With local=true, the response names the IANA timezone of the coordinates on any plan, and paid plans also get each time in local time with its UTC offset.

**Endpoint:** `GET https://api.apiverve.com/v1/sunrisesunset`  
**Category:** Weather  
**Cost:** 2 credits per call  
**Canonical page:** https://apiverve.com/marketplace/sunrisesunset

## Overview

A sunrise and sunset times API that works like a sunrise sunset calculator for any coordinates: get sunset time, dawn, dusk and golden hour in one call. Sunrise Sunset works by calculating the sunrise and sunset times based on the location and date provided. It returns the sunrise and sunset times in UTC in a structured format. Pass local=true to get the IANA timezone of the coordinates on any plan, and on paid plans every time again as local ISO 8601 with its UTC offset, daylight saving included, so no separate timezone lookup is needed.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/sunrisesunset?lat=36.7201600&lon=-4.4203400&date=01-16-2026&local=true" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `lat` | number | Yes | The latitude of the location. range -90-90 |
| `lon` | number | Yes | The longitude of the location. range -180-180 |
| `date` | string | No | The date for which you want to get the sunrise and sunset times (e.g., MM-DD-YYYY : 01-01-2022). date. Premium field |
| `local` | boolean | No | Also return the timezone of the coordinates and every time in local time. default false. timezone |

## Response fields

- `solarNoon` — string · Solar noon time · (premium)
- `sunrise` — string · Sunrise time in ISO 8601 format
- `sunset` — string · Sunset time in ISO 8601 format
- `sunriseEnd` — string · Moment the sun's disc has fully cleared the horizon, in UTC
- `sunsetStart` — string · Moment the sun's disc first touches the horizon at sunset, in UTC
- `dawn` — string · Start of civil twilight, when the sun is 6 degrees below the horizon
- `dusk` — string · End of civil twilight, when the sun drops 6 degrees below the horizon
- `nauticalDawn` — string · Start of nautical twilight, when the sun is 12 degrees below the horizon
- `nauticalDusk` — string · End of nautical twilight, when the sun drops 12 degrees below the horizon
- `nightEnd` — string · End of astronomical night, when the sun rises above 18 degrees below the horizon
- `night` — string · Start of astronomical night, when the sun drops 18 degrees below the horizon
- `goldenHourEnd` — string · End of the morning golden hour, when soft low-angle light gives way to daylight
- `goldenHour` — string · Start of the evening golden hour, when the light turns soft and low-angle
- `timezone` — string · With local=true, the IANA timezone of the coordinates
- `localTimes` — object · With local=true, every time above as local ISO 8601 with its UTC offset, null where the sun never reaches that point · (premium)
  - `localTimes.solarNoon` — string · Solar noon time · (premium)
  - `localTimes.sunrise` — string · Sunrise time in ISO 8601 format · (premium)
  - `localTimes.sunset` — string · Sunset time in ISO 8601 format · (premium)
  - `localTimes.sunriseEnd` — string · Moment the sun's disc has fully cleared the horizon, in UTC · (premium)
  - `localTimes.sunsetStart` — string · Moment the sun's disc first touches the horizon at sunset, in UTC · (premium)
  - `localTimes.dawn` — string · Start of civil twilight, when the sun is 6 degrees below the horizon · (premium)
  - `localTimes.dusk` — string · End of civil twilight, when the sun drops 6 degrees below the horizon · (premium)
  - `localTimes.nauticalDawn` — string · Start of nautical twilight, when the sun is 12 degrees below the horizon · (premium)
  - `localTimes.nauticalDusk` — string · End of nautical twilight, when the sun drops 12 degrees below the horizon · (premium)
  - `localTimes.nightEnd` — string · End of astronomical night, when the sun rises above 18 degrees below the horizon · (premium)
  - `localTimes.night` — string · Start of astronomical night, when the sun drops 18 degrees below the horizon · (premium)
  - `localTimes.goldenHourEnd` — string · End of the morning golden hour, when soft low-angle light gives way to daylight · (premium)
  - `localTimes.goldenHour` — string · Start of the evening golden hour, when the light turns soft and low-angle · (premium)
- `sunAlwaysUp` — boolean · True on a midnight-sun day, when the sun never sets and sunrise and sunset are null
- `sunAlwaysDown` — boolean · True on a polar-night day, when the sun never rises and sunrise and sunset are null

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "solarNoon": "2026-01-16T12:27:25.604Z",
    "sunrise": "2026-01-16T07:28:59.535Z",
    "sunset": "2026-01-16T17:26:08.497Z",
    "sunriseEnd": "2026-01-16T07:31:57.020Z",
    "sunsetStart": "2026-01-16T17:23:11.000Z",
    "dawn": "2026-01-16T07:00:49.868Z",
    "dusk": "2026-01-16T17:54:18.301Z",
    "nauticalDawn": "2026-01-16T06:29:04.238Z",
    "nauticalDusk": "2026-01-16T18:26:04.076Z",
    "nightEnd": "2026-01-16T05:58:02.796Z",
    "night": "2026-01-16T18:57:05.885Z",
    "goldenHourEnd": "2026-01-16T08:07:52.702Z",
    "goldenHour": "2026-01-16T16:47:15.298Z",
    "timezone": "Europe/Madrid",
    "localTimes": {
      "solarNoon": "2026-01-16T13:27:25+01:00",
      "sunrise": "2026-01-16T08:28:59+01:00",
      "sunset": "2026-01-16T18:26:08+01:00",
      "sunriseEnd": "2026-01-16T08:31:57+01:00",
      "sunsetStart": "2026-01-16T18:23:11+01:00",
      "dawn": "2026-01-16T08:00:49+01:00",
      "dusk": "2026-01-16T18:54:18+01:00",
      "nauticalDawn": "2026-01-16T07:29:04+01:00",
      "nauticalDusk": "2026-01-16T19:26:04+01:00",
      "nightEnd": "2026-01-16T06:58:02+01:00",
      "night": "2026-01-16T19:57:05+01:00",
      "goldenHourEnd": "2026-01-16T09:07:52+01:00",
      "goldenHour": "2026-01-16T17:47:15+01:00"
    },
    "sunAlwaysUp": false,
    "sunAlwaysDown": false
  }
}
```

## Use cases

- **Golden Hour Photography** — Camera apps check golden hour start and civil twilight times to alert photographers when optimal natural lighting begins.
- **Municipal Lighting Automation** — Smart lighting controllers switch streetlights and architectural fixtures on at sunset and off at dawn based on coordinate lookups.
- **Visual Flight Dispatch** — Before dispatching visual flight rules flights, aviation platforms check nautical dawn and dusk to verify legal daylight operating hours.
- **Agricultural Spray Scheduling** — To schedule field treatments during cooler periods, farm management systems use sunrise and dusk timestamps to plan early morning passes.

## SDKs

- **npm** — `npm install @apiverve/sunrisesunset` (https://www.npmjs.com/package/@apiverve/sunrisesunset)
- **PyPI** — `pip install apiverve-sunrisesunset` (https://pypi.org/project/apiverve-sunrisesunset/)
- **NuGet** — `dotnet add package APIVerve.API.SunriseSunset` (https://www.nuget.org/packages/APIVerve.API.SunriseSunset)
- **Source** — https://github.com/apiverve/sunrisesunset-api

## More

- Full reference: https://docs.apiverve.com/ref/sunrisesunset
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
