Access model
- Public beta
- No API key required right now
- Best for read-only integrations and lightweight tooling
- Anonymous rollout target: 100 requests per IP per day
The SunriseTime API lets you discover supported city slugs first, then request sun, moon, and prayer data in one structured response. The current catalog covers 500 indexed cities.
Resolve a city slug first, then request timing data with the returned slug.
curl "https://sunrisetime.co/api/v1/cities?query=london&limit=3" curl "https://sunrisetime.co/api/v1/times?city=london&date=2026-03-29" These three endpoints are enough for most external integrations.
GET /api/v1/cities Search supported cities by name, slug, country, or region and get stable slugs back. GET /api/v1/times Fetch sunrise, sunset, golden hour, moon, and prayer-time data for one city and date. GET /api/v1/openapi.json Read the machine-friendly OpenAPI document for generated clients or internal tooling. Keep the flow simple: discover a slug, then request one city at a time.
/api/v1/cities| Parameter | Required | Notes |
|---|---|---|
query | No | City, slug, country, or admin region. Empty query returns popular cities. |
limit | No | Default 10, max 25. |
/api/v1/times| Parameter | Required | Notes |
|---|---|---|
city | Yes | Stable city slug such as london, istanbul, or new-york. |
date | No | Optional local date in YYYY-MM-DD format. |
The JSON stays grouped by use case instead of exposing only low-level calculation internals.
{
"meta": {
"version": "v1",
"endpoint": "/api/v1/times",
"cacheTtlSeconds": 900
},
"city": {
"slug": "london",
"name": "London",
"timezone": "Europe/London"
},
"sun": {
"sunrise": "6:44 AM",
"sunset": "7:26 PM"
},
"moon": {
"phase": "Waxing Crescent",
"illumination": 12
},
"prayerTimes": {
"fajr": "5:10 AM",
"maghrib": "7:26 PM"
}
} Command-line and server-side usage work best right now. Third-party browser access should wait until broader CORS controls are available.
curl "https://sunrisetime.co/api/v1/times?city=london&date=2026-03-29" const cityLookup = await fetch("https://sunrisetime.co/api/v1/cities?query=london&limit=1");
const cityResult = await cityLookup.json();
const citySlug = cityResult.cities[0]?.slug;
const timingResponse = await fetch(`https://sunrisetime.co/api/v1/times?city=${citySlug}&date=2026-03-29`
);
const timingData = await timingResponse.json();
console.log(timingData.sun.sunrise, timingData.prayerTimes.maghrib); Errors return structured JSON, which makes external handling more predictable.
| Code | Status | Meaning |
|---|---|---|
missing_city | 400 | The city query parameter was not sent to /api/v1/times. |
invalid_date | 400 | The date value was not in YYYY-MM-DD format. |
unknown_city | 404 | The provided city slug does not exist in the current index. |
invalid_limit | 400 | The limit value sent to /api/v1/cities was invalid. |
Use these three links when you want to validate assumptions, inspect public slugs, or ask for higher-volume access.