Vedic Astrology API Integration Guide for Developers
Complete guide to integrating Vedic astrology APIs in your application. Includes authentication, birth charts, panchang, dasha periods, and compatibility matching.
TL;DR
- The RoxyAPI TypeScript SDK (
@roxyapi/sdk) gives you typed access to 40+ Vedic astrology endpoints with one line of setup - Generate birth charts, Panchang, Vimshottari dasha periods, and Gun Milan compatibility scores
- Every response is fully typed: no manual interfaces, no raw fetch, no JSON parsing
- Get your API key and make your first call in under 5 minutes
About the author: Brajesh Vashisht is a Vedic Astrologer and KP Systems Specialist with 22 years of experience in Vedic astrology and Krishnamurti Paddhati. He holds a postgraduate degree in Jyotish Shastra from Banaras Hindu University and has authored two books on KP sub-lord theory and nakshatra analysis.
Integrating Vedic astrology calculations into your application normally requires deep knowledge of sidereal astronomy, Lahiri ayanamsa corrections, and the Vimshottari dasha system. Building this from scratch means implementing astronomical position algorithms, nakshatra boundary tables, dasha period math, and Ashtakoot compatibility scoring. The RoxyAPI Vedic Astrology API handles all of this behind verified, tested endpoints that return structured, interpreted data.
This guide shows you how to integrate birth charts, Panchang, dasha periods, and Kundli compatibility matching into any TypeScript or Node.js application using the official SDK. All planetary positions are verified against NASA JPL Horizons data and cross-referenced against 828 gold standard test cases from DrikPanchang and onlinejyotish.
How to install and configure the SDK
Install the TypeScript SDK and create your client in two steps. The SDK provides full types for every endpoint, so you never need to write manual TypeScript interfaces.
npm install @roxyapi/sdk
import { createRoxy } from '@roxyapi/sdk';
const roxy = createRoxy(process.env.ROXY_API_KEY!);
That is the entire setup. The SDK configures the base URL (https://roxyapi.com/api/v2), authentication headers, and response typing automatically. Every method returns a { data, error, response } object. If error is defined, the request failed and error.code tells you why. If data is defined, you have a fully typed result. No custom error classes, no retry wrappers, no raw fetch calls needed.
For Python or other languages, use the REST endpoints directly with the same request bodies and an X-API-Key header. The curl examples at the end of this guide show the exact HTTP calls. All endpoints are standard REST with JSON request and response bodies, so any HTTP client works.
# Python example using requests
import requests
API_KEY = "your_api_key"
BASE = "https://roxyapi.com/api/v2/vedic-astrology"
headers = {"Content-Type": "application/json", "X-API-Key": API_KEY}
response = requests.post(f"{BASE}/birth-chart", json={
"date": "1990-07-15",
"time": "14:30:00",
"latitude": 28.6139,
"longitude": 77.209,
"timezone": 5.5,
}, headers=headers)
chart = response.json()
print(f"Lagna: {chart['meta']['Lagna']['rashi']}")
Ready to build this? RoxyAPI Vedic Astrology API gives you 40+ endpoints for birth charts, Panchang, dasha, compatibility, doshas, and more. See pricing.
How to generate a Vedic birth chart (D1 Rashi)
The birth chart endpoint returns all 9 Navagraha positions plus Lagna, grouped by rashi house, with nakshatra and pada data for each planet.
const { data, error } = await roxy.vedicAstrology.generateBirthChart({
body: {
date: '1990-07-15',
time: '14:30:00',
latitude: 28.6139,
longitude: 77.209,
timezone: 5.5,
},
});
if (data) {
console.log('Lagna:', data.meta.Lagna.rashi);
console.log('Moon:', data.meta.Moon.nakshatra.name, 'Pada', data.meta.Moon.nakshatra.pada);
// Check combustion (planets too close to Sun)
for (const c of data.combustion) {
console.log(`${c.planet} is combust: ${c.distanceFromSun.toFixed(1)} deg from Sun`);
}
// Check planetary war (planets within 1 degree)
for (const w of data.planetaryWar) {
console.log(`${w.planet1} vs ${w.planet2}: ${w.winner} wins`);
}
}
The response includes 12 rashi house objects (each with a signs array of planets), a meta lookup keyed by planet name, a houses array with bhava descriptions, combustion data using Surya Siddhanta orb values, planetaryWar detection, and per-planet interpretations with rashi and nakshatra readings. Here is a partial response showing the structure:
{
"aries": {
"rashi": "aries",
"signs": [
{
"graha": "Mars",
"nakshatra": { "name": "Ashwini", "pada": 3, "key": 1 },
"longitude": 8.15,
"isRetrograde": false
}
]
},
"meta": {
"Lagna": {
"graha": "Lagna",
"rashi": "Libra",
"longitude": 198.45,
"nakshatra": { "name": "Swati", "pada": 2, "key": 15 }
},
"Sun": {
"graha": "Sun",
"rashi": "Gemini",
"longitude": 88.92,
"nakshatra": { "name": "Punarvasu", "pada": 3, "key": 7 },
"isRetrograde": false
}
},
"houses": [
{ "number": 1, "name": "Lagna", "description": "Self, personality, physical body..." }
],
"combustion": [
{ "planet": "Mercury", "distanceFromSun": 4.2, "orb": 14 }
],
"planetaryWar": [],
"interpretations": {
"Sun": {
"rashi": "Sun in Gemini brings intellectual curiosity...",
"nakshatra": "Punarvasu nakshatra gives renewal and optimism..."
}
}
}
Combustion and planetary war detection are unique to RoxyAPI. Most Vedic astrology APIs return only planet positions, but this endpoint also flags combust planets and planetary war conditions based on classical Jyotish texts, saving you from implementing these rules manually.
How to calculate daily Panchang (Tithi, Nakshatra, Yoga, Karana)
The Panchang endpoint returns all five limbs of the Hindu calendar for any date and location.
const { data } = await roxy.vedicAstrology.getBasicPanchang({
body: {
date: '2026-03-30',
time: '06:00:00',
latitude: 28.6139,
longitude: 77.209,
timezone: 5.5,
},
});
if (data) {
console.log('Tithi:', data.tithi.name, `(${data.tithi.paksha})`);
console.log('Nakshatra:', data.nakshatra.name, '| Lord:', data.nakshatra.lord);
console.log('Yoga:', data.yoga.name);
console.log('Karana:', data.karana.name);
}
The response structure for each element includes a name, number, and descriptive fields. Tithi includes paksha ("Shukla" or "Krishna") and percent completion. Nakshatra includes lord (ruling planet), pada, deity, and symbol. Use the detailed Panchang endpoint (getDetailedPanchang) if you also need sunrise, sunset, moonrise, Rahu Kaal, Yamaganda, and Gulika Kaal timings.
How to get current Vimshottari dasha periods
The dasha endpoint returns the active Mahadasha, Antardasha, and Pratyantardasha based on the birth Moon nakshatra position.
const { data } = await roxy.vedicAstrology.getCurrentDasha({
body: {
date: '1990-07-15',
time: '14:30:00',
latitude: 28.6139,
longitude: 77.209,
timezone: 5.5,
},
});
if (data) {
console.log('Birth Nakshatra:', data.nakshatraName, '| Lord:', data.nakshatraLord);
console.log('Mahadasha:', data.mahadasha.planet);
console.log(' Period:', data.mahadasha.startDate, 'to', data.mahadasha.endDate);
console.log(' Remaining:', data.remainingInMahadasha.years, 'y',
data.remainingInMahadasha.months, 'm', data.remainingInMahadasha.days, 'd');
console.log('Antardasha:', data.antardasha.planet);
console.log('Pratyantardasha:', data.pratyantardasha.planet);
}
Each dasha period includes planet, startDate, endDate, durationYears, and an interpretation string. Remaining time for each level is in a separate object with years, months, days, and totalDays fields:
{
"nakshatraName": "Revati",
"nakshatraLord": "Mercury",
"mahadasha": {
"planet": "Moon",
"startDate": "2023-01-15T00:00:00Z",
"endDate": "2033-01-15T00:00:00Z",
"durationYears": 10,
"interpretation": "Moon Mahadasha brings emotional growth..."
},
"remainingInMahadasha": {
"years": 6,
"months": 9,
"days": 16,
"totalDays": 2482
},
"antardasha": {
"planet": "Jupiter",
"mahadashaLord": "Moon",
"startDate": "2025-12-15T00:00:00Z",
"endDate": "2027-04-15T00:00:00Z",
"durationYears": 1.33
},
"remainingInAntardasha": { "years": 1, "months": 0, "days": 16, "totalDays": 381 }
}
Use getMajorDashas() to get the full 120-year Vimshottari cycle, or getSubDashas() for Antardasha sub-periods within a specific Mahadasha.
How to check Kundli compatibility with Gun Milan
The 36-point Ashtakoot Gun Milan endpoint calculates compatibility between two birth charts across 8 kootas.
const { data } = await roxy.vedicAstrology.calculateGunMilan({
body: {
person1: {
date: '1990-07-15',
time: '14:30:00',
latitude: 28.6139,
longitude: 77.209,
timezone: 5.5,
},
person2: {
date: '1992-03-20',
time: '10:00:00',
latitude: 19.076,
longitude: 72.8777,
timezone: 5.5,
},
},
});
if (data) {
console.log(`Score: ${data.total}/${data.maxScore} (${data.percentage}%)`);
console.log('Compatible:', data.isCompatible);
console.log('Recommendation:', data.recommendation);
for (const koota of data.breakdown) {
console.log(` ${koota.category}: ${koota.score}/${koota.maxScore}`);
}
// Check active doshas and cancellations
if (data.doshas.length > 0) {
console.log('Active doshas:', data.doshas.join(', '));
}
for (const cancel of data.doshaCancellations) {
console.log(` ${cancel.dosha} cancelled: ${cancel.reason}`);
}
}
The breakdown array covers all 8 Ashtakoot kootas: Varna (spiritual compatibility), Vashya (mutual attraction), Tara (birth star harmony), Yoni (physical compatibility), Graha Maitri (mental compatibility), Gana (temperament), Bhakoot (love and prosperity), and Nadi (health and progeny). Each entry includes score, maxScore, and the classification for both persons. The response also includes a recommendation string, active doshas, and doshaCancellations with reasons, making it easy to display a complete compatibility report for matrimonial applications without writing any interpretation logic.
How to test the endpoints with curl
Use these curl commands to verify API responses before integrating into your application:
# Birth chart
curl -X POST https://roxyapi.com/api/v2/vedic-astrology/birth-chart \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"date":"1990-07-15","time":"14:30:00","latitude":28.6139,"longitude":77.209,"timezone":5.5}'
# Panchang
curl -X POST https://roxyapi.com/api/v2/vedic-astrology/panchang/basic \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"date":"2026-03-30","time":"06:00:00","latitude":28.6139,"longitude":77.209,"timezone":5.5}'
# Current dasha
curl -X POST https://roxyapi.com/api/v2/vedic-astrology/dasha/current \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"date":"1990-07-15","time":"14:30:00","latitude":28.6139,"longitude":77.209,"timezone":5.5}'
Replace YOUR_API_KEY with your RoxyAPI key. Test all endpoints live in the Vedic Astrology API reference.
Frequently Asked Questions
Q: What input format does every Vedic astrology endpoint use?
A: All endpoints accept the same five fields: date (YYYY-MM-DD), time (HH:MM:SS, 24-hour), latitude, longitude, and timezone (UTC offset, defaults to 5.5 for IST). Compatibility endpoints wrap these fields in person1 and person2 objects.
Q: Does the API use tropical or sidereal calculations? A: All positions are sidereal using the Lahiri ayanamsa, which is the Indian government standard for Vedic astrology. Planetary positions are verified against NASA JPL Horizons data with sub-arc-second precision.
Q: How do I handle timezones for birth data? A: Send the local birth time as-is with the UTC offset as a decimal number. India IST is 5.5, Nepal NPT is 5.75, US Eastern is -5, UK GMT is 0. The API handles all internal conversions. Do not convert to UTC manually.
Q: Can I use the API from Python or other languages?
A: Yes. The TypeScript SDK is the recommended client, but all endpoints are standard REST. Use any HTTP client with Content-Type: application/json and an X-API-Key header. The request and response bodies are the same regardless of language.
Q: What other Vedic astrology endpoints are available? A: Beyond the four shown here, the API covers Navamsa (D9) and all divisional charts (D2 through D60), Manglik and Kalsarpa dosha detection, Sadhesati (Saturn transit) analysis, Shadbala (6-fold strength) and Ashtakavarga (8-fold strength) scoring, planetary aspects (drishti), monthly transits, KP (Krishnamurti Paddhati) charts with star and sub-lord tables, Choghadiya muhurta periods, Hora planetary hours, and complete reference data for all 12 rashis, 27 nakshatras, and 300+ yogas. Over 40 endpoints are available under a single API key.
Q: How do I get Navamsa or other divisional charts?
A: Use roxy.vedicAstrology.generateNavamsa() for the D9 chart or roxy.vedicAstrology.generateDivisionalChart() with a division parameter (2 through 60) for any other divisional chart. The request body is the same birth data format used by the birth chart endpoint.
Conclusion
The RoxyAPI TypeScript SDK gives you typed access to the full Vedic astrology calculation engine with a single createRoxy() call. No custom API wrappers, no manual type definitions, no raw HTTP logic. Every endpoint returns structured, interpreted data verified against authoritative Jyotish sources. Whether you are building a Kundli generator, a matrimonial matching platform, a daily Panchang widget, or a full-featured Jyotish application, the same API key and SDK cover all 40+ endpoints across birth charts, dashas, doshas, divisional charts, transits, and reference data.
Start integrating at RoxyAPI Vedic Astrology API or browse the full Vedic Astrology API reference. Check pricing for plan details.