Guides
Calculate the ascendant (rising sign) with the API
The ascendant is the zodiac sign rising on the eastern horizon at the moment of birth. Western astrology calls it the rising sign. Vedic astrology calls it the lagna.
You don't need to compute it yourself. Send us a birth date, time and place, and we return the ascendant as JSON. This guide shows which endpoint to call for each need, what the request looks like, and what comes back.
https://json.astrologyapi.com/v1 with HTTP Basic auth (your user ID as the username, your API key as the password). We don't send CORS headers, so call the API from your server, not the browser. For a browser-safe pattern, see the access token usage guide.Pick the right endpoint
Several endpoints include the ascendant. Pick the one that matches what you want to show.
| You need | Endpoint | Where the ascendant is |
|---|---|---|
| Vedic lagna sign only | astro_details | ascendant holds the sign name. |
| Vedic lagna with degree and nakshatra | planets | The array entry with name set to "Ascendant". It has fullDegree, normDegree, sign, nakshatra and nakshatra_pad. |
| Western ascendant degree, with houses | house_cusps/tropical | ascendant is an absolute longitude from 0 to 360. We also return midheaven, vertex and all 12 house cusps. |
| A written rising sign reading | general_ascendant_report (Vedic) or general_ascendant_report/tropical (Western) | The sign plus a report paragraph you can show as is. |
| Which lagna rises when, through a day | panchang_lagna_table | A list of lagnas with start_time and end_time. Useful for muhurta and panchang screens. |
What to send
The ascendant endpoints all take the same birth fields:
day,month,year: the birth date.hour,min: the local birth time, in 24-hour format.lat,lon: the birth place in decimal degrees.tzone: the UTC offset at that moment as a decimal, for example5.5for India. See Timezones, DST, and birth data to get it right for old dates and daylight saving.house_type: only for the tropical endpoints, for exampleplacidus.
Here is the smallest call that returns a Vedic lagna:
curl -s -u "$ASTROLOGY_USER_ID:$ASTROLOGY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"day":10,"month":5,"year":1990,"hour":19,"min":55,"lat":19.2056,"lon":25.2056,"tzone":5.5}' \
https://json.astrologyapi.com/v1/astro_detailsSample response, trimmed:
{
"ascendant": "Leo",
"sign": "Virgo",
"SignLord": "Mercury",
"Naksahtra": "Uttra Phalguni",
"NaksahtraLord": "Sun",
"Charan": 3
// ...more Vedic details
}The Naksahtra spelling in this response is the real field name. Read it exactly as written.
Get the lagna degree and nakshatra
planets returns one object per planet, plus one for the ascendant. Find the entry named Ascendant:
[
// ...one object per planet, then:
{
"id": 9,
"name": "Ascendant",
"fullDegree": 207.92868587120444,
"normDegree": 27.928685871204436,
"isRetro": false,
"sign": "Libra",
"signLord": "Venus",
"nakshatra": "Vishakha",
"nakshatraLord": "Jupiter",
"nakshatra_pad": 3,
"house": 1
}
]fullDegreeis the position from 0 to 360 in the sidereal zodiac.normDegreeis the degree inside the sign, from 0 to 30.- On the ascendant entry,
isRetrois the booleanfalse. On planet entries it is the string"true"or"false". Compare with care.
Get the Western ascendant degree
house_cusps/tropical returns the ascendant as an absolute longitude, along with the midheaven and every house cusp:
{
"houses": [
{ "house": 1, "sign": "Cancer", "degree": 114.19653 },
{ "house": 2, "sign": "Leo", "degree": 141.2691 }
// ...houses 3 to 12
],
"ascendant": 138.21237548900893,
"midheaven": 47.54697697669932,
"vertex": 235.92360650178892
}To show it as a sign and degree, divide by 30. The whole number picks the sign, starting from Aries at 0. The remainder is the degree inside that sign. For example, 138.21 is 18° 12' Leo. The full example below includes a toSign helper that does this.
Full example in Node.js
This script gets both ascendants for one birth. Set ASTROLOGY_USER_ID and ASTROLOGY_API_KEY, save it as ascendant.mjs and run node ascendant.mjs.
// ascendant.mjs - Node 18+ (built-in fetch).
// Run this on your server. Never put your API key in browser code.
const USER_ID = process.env.ASTROLOGY_USER_ID
const API_KEY = process.env.ASTROLOGY_API_KEY
const BASE_URL = 'https://json.astrologyapi.com/v1'
async function callApi(endpoint, body) {
const res = await fetch(`${BASE_URL}/${endpoint}`, {
method: 'POST',
headers: {
Authorization:
'Basic ' + Buffer.from(USER_ID + ':' + API_KEY).toString('base64'),
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
})
if (!res.ok) throw new Error(`${endpoint} failed with ${res.status}`)
return res.json()
}
const SIGNS = [
'Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo',
'Libra', 'Scorpio', 'Sagittarius', 'Capricorn', 'Aquarius', 'Pisces',
]
// Turn an absolute longitude (0 to 360) into a sign and a degree in that sign.
function toSign(longitude) {
const lon = ((longitude % 360) + 360) % 360
const index = Math.floor(lon / 30)
const inSign = lon - index * 30
const deg = Math.floor(inSign)
const min = Math.floor((inSign - deg) * 60)
return { sign: SIGNS[index], degree: deg, minute: min, text: `${deg}° ${min}' ${SIGNS[index]}` }
}
// Birth date, local time, place and UTC offset.
const birth = {
day: 10, month: 5, year: 1990,
hour: 19, min: 55,
lat: 19.2056, lon: 25.2056,
tzone: 5.5,
}
// 1. Vedic (sidereal) ascendant, with degree and nakshatra.
const planets = await callApi('planets', birth)
const lagna = planets.find((p) => p.name === 'Ascendant')
console.log('Vedic lagna:', lagna.sign, lagna.normDegree.toFixed(2), lagna.nakshatra, 'pada', lagna.nakshatra_pad)
// 2. Western (tropical) ascendant. house_type is required here.
const cusps = await callApi('house_cusps/tropical', { ...birth, house_type: 'placidus' })
console.log('Western ascendant:', toSign(cusps.ascendant).text)Why the Vedic and Western ascendant differ
Vedic astrology measures from the fixed stars (the sidereal zodiac). Western astrology measures from the seasons (the tropical zodiac). The two are about 24 degrees apart today, so the same birth can have a different rising sign in each system.
Neither answer is wrong. Show the one that matches the tradition your users follow. To learn how ayanamsha and house systems change the result, read Ayanamsha, house systems, and why charts differ.
The birth time matters most
The ascendant moves through all 12 signs in about a day, so it changes sign roughly every two hours. A birth time that is off by a few minutes can move the degree, and near a sign boundary it can change the sign.
hour and min are required on every ascendant endpoint. If your users don't know their birth time, read When the birth time is unknown before you show an ascendant at all.
For AI agents
- Vedic sign only: POST
/astro_details, readascendant. - Vedic degree: POST
/planets, read the entry wherename === "Ascendant". - Western degree: POST
/house_cusps/tropicalwithhouse_type, readascendant(0 to 360). - Reading text: POST
/general_ascendant_report(Vedic, the result is underasc_report) or/general_ascendant_report/tropical(Western). - Body fields:
day,month,year,hour,min,lat,lon,tzone. Basic auth, server-side only.