API Reference / Vedic Astrology / Panchang
/v1/panchang/moonrise-moonset
Moonrise and moonset JD.
What this tells you
Moonrise and moonset move about 50 minutes later each day, so they can fall at any hour of the day or night. Moonrise matters for vrats that end at moonrise, such as Sankashti Chaturthi. The API searches forward from local midnight on `date` and returns the first moonrise and the first moonset it finds. The two searches are independent, so moonset can come before moonrise, or fall on the next date as in this example (moonset 2027-01-16 00:36 for date 2027-01-15).
Request
All requests require an Authorization header with your dv_live_* API key.
curl "https://api.lifeastroapi.com/v1/panchang/moonrise-moonset?date=2027-01-15&tz=Asia%2FKolkata&lat=28.6139&lon=77.209" \
-H "Authorization: Bearer YOUR_API_KEY"Query parameters
Checked against the API: a parameter is marked required when the request fails without it.
| Name | Required | Example | Description |
|---|---|---|---|
date | yes | 2027-01-15 | Date (YYYY-MM-DD). |
tz | yes | Asia/Kolkata | Timezone: IANA name (Asia/Kolkata) or UTC offset (+05:30). |
lat | yes | 28.6139 | Latitude in decimal degrees. |
lon | yes | 77.209 | Longitude in decimal degrees. |
Response (200 OK)
The real response to the example request above, generated from the API itself. Long arrays are trimmed to their first two items. Field names are stable across versions.
{
"date": "2027-01-15",
"location": {
"lat": 28.6139,
"lon": 77.209,
"alt": 0
},
"tz": "Asia/Kolkata",
"moonrise_jd": 2461420.740844,
"moonset_jd": 2461421.295876,
"moonrise_local": "2027-01-15 11:16:49",
"moonset_local": "2027-01-16 00:36:04",
"has_moonrise": true,
"has_moonset": true
}Field reference
Every field in the response, with its type, a real example, and what it means.
| Field | Type | Meaning |
|---|---|---|
| date | string | Echo of the `date` parameter (local date). example: "2027-01-15" |
| location | object | Echo of `lat`, `lon` and `alt` (metres, default 0). example: { "lat": 28.6139, "lon": 77.209, "alt": 0 } |
| tz | string | Echo of the `tz` parameter. The `*_local` times are in this zone. example: "Asia/Kolkata" |
| moonrise_jd | number | First moonrise after local midnight on `date`, as a Julian Day in UT. Left out when `has_moonrise` is false. example: 2461420.740844 |
| moonset_jd | number | First moonset after local midnight on `date`, as a Julian Day in UT. Left out when `has_moonset` is false. example: 2461421.295876 |
| moonrise_local | string (YYYY-MM-DD HH:MM:SS) | Moonrise in local time (request `tz`), with no offset suffix. Left out when `has_moonrise` is false. example: "2027-01-15 11:16:49" |
| moonset_local | string (YYYY-MM-DD HH:MM:SS) | Moonset in local time (request `tz`), with no offset suffix. Left out when `has_moonset` is false. example: "2027-01-16 00:36:04" |
| has_moonrise | boolean | False when no moonrise is found (high latitudes). example: true |
| has_moonset | boolean | False when no moonset is found (high latitudes). example: true |
Usage tips
How to use it
- Check the date partAbout once a month the Moon does not rise (or set) on a given date. The API then returns the next event, which is on the following date. Compare the date in `moonrise_local` with `date` before showing "Moonrise today".
- Missing fields, not nullWhen `has_moonrise` or `has_moonset` is false, the matching `_jd` and `_local` fields are left out of the JSON. Check the boolean first.
- Local strings carry no offsetThe `*_local` strings are already in the request `tz`. To build a JavaScript Date, convert from the JD: Unix ms = (jd − 2440587.5) × 86400000.
Errors
Every error follows the same envelope. Use the error.code field (not the message) for conditional logic in your integration.
401 Unauthorized
{
"error": {
"code": "unauthorized",
"message": "missing or invalid API key",
"request_id": "req_01hqy7k8c3e7m1n"
}
}402 Payment Required
{
"error": {
"code": "trial_exhausted",
"message": "your free trial credits are exhausted — pick a plan to continue",
"top_up_url": "https://lifeastroapi.com/pricing",
"request_id": "req_01hqy7k8c3e7m1n"
}
}429 Too Many Requests
{
"error": {
"code": "rate_limited",
"message": "rate limit exceeded; retry after 12 seconds",
"request_id": "req_01hqy7k8c3e7m1n"
}
}Try it
Get a dv_live_* key from your dashboard and paste into the cURL snippet above. New accounts get 1,500 free credits. Sign up.