Skip to content
BestAstroAPI

Panchang & timing

Sun and Moon

POST/v1/sun-moon

Sunrise, sunset, solar noon and twilight, moonrise, moonset, moon phase, illumination and the next phases.

  • Near the poles the Sun may not rise or set: then those times are null and polar says why.
  • Moon values are for local solar noon, or for time when you send it.

Request

FieldTypeDescription
datestringrequiredYYYY-MM-DD
timestringHH:MM; default is local sunrise
latnumberLatitude, -90 to 90 (north positive). Send lat, lon and tz, or place, or place_id
lonnumberLongitude, -180 to 180 (east positive)
tzstringIANA zone (Asia/Kolkata) or offset (+05:30). Needed with lat and lon; filled in with a place
placestringPlace name instead of lat, lon and tz, for example Gorakhpur, Uttar Pradesh. If the name is not unique: ambiguous_place with choices
place_idintegerThe id of a place from place search, instead of lat, lon and tz
ayanamsastringlahiri (default) | raman | krishnamurti

Example

curl -X POST "https://api.bestastroapi.in/v1/sun-moon" \
  -H "x-api-key: $BESTASTRO_KEY" \
  -H "content-type: application/json" \
  -d '{"date":"2026-11-22","lat":28.6139,"lon":77.209,"tz":"Asia/Kolkata"}'

Try it live

Sends a real request from your browser.

Response

  • [] is a list. {key} is a key that varies.
  • An optional field can be missing. That means it does not apply.
  • Fields marked “or null” are always there but can be empty.
  • Times carry the UTC offset of the place. A time after midnight has the next date.
FieldTypeMeaning
datestringYYYY-MM-DDDate you sent
placeobjectPlace you sent
place.latnumberdegreesLatitude
place.lonnumberdegreesLongitude
place.tzstringZone
place.idintegerId of the place we looked up. Only when you sent place or place_id, like the next two optional
place.namestringIts name optional
place.labelstringIts name with district or state and country optional
sunobjectThe Sun
sun.sunrisestring or nullISO 8601Sunrise (upper limb, with refraction)
sun.sunsetstring or nullISO 8601Sunset
sun.solar_noonstringISO 8601Local apparent noon: the Sun is highest
sun.day_length_hoursnumber or nullhoursSunrise to sunset
sun.polarstring or nullWhy there is no sunrise or sunset. Null on ordinary daysmidnight_sun | polar_night
sun.twilightobjectDawn and dusk when the Sun's centre is 6, 12 and 18 degrees below the horizon
sun.twilight.civilobject6 degrees
sun.twilight.civil.dawnstring or nullISO 8601Morning
sun.twilight.civil.duskstring or nullISO 8601Evening
sun.twilight.nauticalobject12 degrees: dawn and dusk, as above
sun.twilight.nautical.dawnstring or nullISO 8601Morning
sun.twilight.nautical.duskstring or nullISO 8601Evening
sun.twilight.astronomicalobject18 degrees: dawn and dusk, as above
sun.twilight.astronomical.dawnstring or nullISO 8601Morning
sun.twilight.astronomical.duskstring or nullISO 8601Evening
sun.sidereal_longitudenumberdegreesSidereal longitude at solar noon
sun.signSignSidereal sign
moonobjectThe Moon
moon.moonrisestring or nullISO 8601Moonrise on this date
moon.moonsetstring or nullISO 8601Moonset on this date
moon.computed_atstringISO 8601Moment of the phase values
moon.phasestringA principal phase when it happens on this date, else the phase betweennew_moon | first_quarter | full_moon | last_quarter | waxing_crescent | waxing_gibbous | waning_gibbous | waning_crescent
moon.illuminationnumberLit share of the disc, 0 to 1
moon.elongationnumberdegreesMoon minus Sun in longitude, 0 to 360: 0 new, 180 full
moon.phase_anglenumberdegreesSun-Moon-Earth angle
moon.waxingbooleanGrowing towards full
moon.age_daysnumberdaysTime since the last new moon
moon.distance_kmnumberkmDistance from the Earth's centre
moon.sidereal_longitudenumberdegreesSidereal longitude
moon.signSignSidereal sign
moon.nakshatraNakshatraNakshatra
moon.nextobjectNext principal phases after the start of the date
moon.next.new_moonstringISO 8601New moon
moon.next.first_quarterstringISO 8601First quarter
moon.next.full_moonstringISO 8601Full moon
moon.next.last_quarterstringISO 8601Last quarter

Objects used above

Sign A zodiac sign (rashi).

FieldTypeMeaning
numberinteger1 = Aries to 12 = Pisces
namestringEnglish name
rashistringSanskrit name, for example Mesha
lordstringPlanet that rules the sign

Nakshatra A lunar mansion.

FieldTypeMeaning
numberinteger1 = Ashwini to 27 = Revati
namestringNakshatra name
padaintegerQuarter, 1 to 4
lordstringVimshottari lord
Raw sample
200 application/json
{
  "date": "2026-11-22",
  "moon": {
    "age_days": 12.9827,
    "computed_at": "2026-11-22T12:07:13+05:30",
    "distance_km": 370237,
    "elongation": 147.928,
    "illumination": 0.9228,
    "moonrise": "2026-11-22T15:25:18+05:30",
    "moonset": "2026-11-22T04:05:00+05:30",
    "nakshatra": {
      "lord": "Ketu",
      "name": "Ashwini",
      "number": 1,
      "pada": 2
    },
    "next": {
      "first_quarter": "2026-12-17T11:12:40+05:30",
      "full_moon": "2026-11-24T20:23:34+05:30",
      "last_quarter": "2026-12-01T11:38:40+05:30",
      "new_moon": "2026-12-09T06:21:51+05:30"
    },
    "phase": "waxing_gibbous",
    "phase_angle": 32.2724,
    "sidereal_longitude": 3.66072,
    "sign": {
      "lord": "Mars",
      "name": "Aries",
      "number": 1,
      "rashi": "Mesha"
    },
    "waxing": true
  },
  "place": {
    "lat": 28.6139,
    "lon": 77.209,
    "tz": "Asia/Kolkata"
  },
  "sun": {
    "day_length_hours": 10.6079,
    "polar": null,
    "sidereal_longitude": 215.732702,
    "sign": {
      "lord": "Mars",
      "name": "Scorpio",
      "number": 8,
      "rashi": "Vrishchika"
    },
    "solar_noon": "2026-11-22T12:07:13+05:30",
    "sunrise": "2026-11-22T06:48:52+05:30",
    "sunset": "2026-11-22T17:25:21+05:30",
    "twilight": {
      "astronomical": {
        "dawn": "2026-11-22T05:26:45+05:30",
        "dusk": "2026-11-22T18:47:28+05:30"
      },
      "civil": {
        "dawn": "2026-11-22T06:23:51+05:30",
        "dusk": "2026-11-22T17:50:22+05:30"
      },
      "nautical": {
        "dawn": "2026-11-22T05:55:05+05:30",
        "dusk": "2026-11-22T18:19:08+05:30"
      }
    }
  }
}

Real output for the example request above.

Errors use one format. See error codes. Also in openapi.json.

Welcome! How will you use it?

We'll show you what matters to you. You can switch any time at the top.