Endpoint reference · v1
Moon API
Calculate moon phase, illumination, lunar age and approximate moonrise/moonset.
GET
/api/v1/moonWhat It Does
Calculate moon phase, illumination, lunar age and approximate moonrise/moonset.
- HTTP method
- GET
- Authentication
- Public read-only; Bearer keys supported
- Version
- v1
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
city | string | No | City lookup alternative to coordinates. Example: Karachi |
latitude | number | No | Latitude. Example: 24.86 |
longitude | number | No | Longitude. Example: 67.01 |
date | date | No | Local date. Example: 2026-09-09 |
timezone | string | No | Output timezone. Example: Asia/Karachi |
Request Examples
cURL
curl -s 'https://worldclock.to/api/v1/moon?city=Karachi&latitude=24.86&longitude=67.01&date=2026-09-09&timezone=Asia/Karachi'JavaScript
const response = await fetch("https:\/\/worldclock.to\/api\/v1\/moon?city=Karachi&latitude=24.86&longitude=67.01&date=2026-09-09&timezone=Asia\/Karachi");
const result = await response.json();
console.log(result.data);PHP
$response = wp_remote_get('https://worldclock.to/api/v1/moon?city=Karachi&latitude=24.86&longitude=67.01&date=2026-09-09&timezone=Asia/Karachi');
= json_decode(wp_remote_retrieve_body(), true);Python
import requests
response = requests.get("https:\/\/worldclock.to\/api\/v1\/moon?city=Karachi&latitude=24.86&longitude=67.01&date=2026-09-09&timezone=Asia\/Karachi")
response.raise_for_status()
print(response.json()["data"])Example Response
The values below illustrate the response shape. Live current-time fields are generated dynamically by the endpoint.
JSON
{
"success": true,
"data": {
"date": "2026-09-09",
"latitude": 24.8599999999999994315658113919198513031005859375,
"longitude": 67.0100000000000051159076974727213382720947265625,
"timezone": "Asia/Karachi",
"phase": "Waning crescent",
"phase_fraction": 0.9210000000000000408562073062057606875896453857421875,
"illumination": 0.060999999999999998667732370449812151491641998291015625,
"illumination_percent": 6.0999999999999996447286321199499070644378662109375,
"lunar_age_days": 27.199999999999999289457264239899814128875732421875,
"moonrise": "2026-09-09T04:19:00+05:00",
"moonset": "2026-09-09T17:14:00+05:00"
},
"meta": {
"version": "v1",
"timezone": "Asia/Karachi",
"timestamp": 1788946200
}
}Response Properties
Every successful response contains success: true, endpoint-specific data, and a meta object. The table below documents the public fields for this endpoint.
| Property | Meaning |
|---|---|
success | Boolean indicating whether the request completed successfully. |
meta.version | Published API response version. |
meta.timestamp | Unix timestamp for the API response instant. |
meta.timezone | Timezone context used by the response. |
meta.rate_limit | Per-client fair-use limit and remaining-request information on public transports. |
data.date | Local calculation date. |
data.latitude | Calculation latitude. |
data.longitude | Calculation longitude. |
data.timezone | Timezone used for output. |
data.phase | Named lunar phase. |
data.phase_fraction | Approximate cycle position from 0 to 1. |
data.illumination | Approximate illuminated fraction from 0 to 1. |
data.illumination_percent | Approximate illuminated percentage. |
data.lunar_age_days | Approximate age in the current synodic month. |
data.moonrise | Approximate timezone-aware moonrise datetime when calculable. |
data.moonset | Approximate timezone-aware moonset datetime when calculable. |
Errors use success: false with a stable machine-readable error code and a safe human-readable message.
Errors & HTTP Status Codes
400— invalid or missing parameter.401— API key required or invalid when key-only access is enabled.404— unknown city, country or endpoint.429— configured rate limit reached.503— API disabled or maintenance mode.
Rate Limits & Caching
Current fair-use configuration is 60 requests per minute and 5000 requests per day. Cache stable directory/calculation responses where appropriate; treat current-time output as point-in-time data.