LifeAstroAPILifeAstroAPI

Build your first Kundli

Fetch a birth chart and display its 12 houses in a browser. Use the sample birth details below for your first request.

1. Sign up and get a key

Create a free account. Copy your starter key when it appears on the dashboard. If you missed it, create a new key under Dashboard → API Keys.

Keep the key on your server or in your terminal environment. Your users only need the chart data that your server returns.

2. Set your key as an environment variable

Use the command for your terminal:

# macOS / Linux
export LIFEASTRO_API_KEY=dv_live_...
 
# Windows (Command Prompt)
set LIFEASTRO_API_KEY=dv_live_...
 
# Windows (PowerShell)
$env:LIFEASTRO_API_KEY = "dv_live_..."

3. Make your first call

In a macOS or Linux terminal, run this request with the sample birth details. A successful call returns HTTP 200 with the ascendant in lagna, placements in planets, and the 12 houses in houses. Kundli Facts API reference

curl --fail-with-body --get 'https://api.lifeastroapi.com/v1/chart/kundli-facts' \
  --header "Authorization: Bearer $LIFEASTRO_API_KEY" \
  --data-urlencode 'date=1990-01-15' \
  --data-urlencode 'time=10:30' \
  --data-urlencode 'tz=Asia/Kolkata' \
  --data-urlencode 'lat=19.076' \
  --data-urlencode 'lon=72.8777' \
  --output kundli.json

Show the houses in HTML

With Node.js installed, save this as kundli.mjs beside kundli.json. Run node kundli.mjs, then open kundli.html in your browser. The HTML contains the chart and can be served to your users without embedding your API key.

import { readFileSync, writeFileSync } from "node:fs";
 
const chart = JSON.parse(readFileSync("kundli.json", "utf8"));
const signs = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo",
  "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"];
 
const houses = chart.houses.map(({ house, sign_index, occupants }) => {
  const planets = occupants.filter((id) => /^[a-z]+$/.test(id)).join(", ");
  return `<li><strong>House ${Number(house)} · ${signs[sign_index]}</strong>
    <p>${planets || "No planets"}</p></li>`;
}).join("");
 
writeFileSync("kundli.html", `<!doctype html>
<html lang="en"><meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sample Kundli</title>
<style>
  body { font: 1rem system-ui; max-width: 48rem; margin: 2rem auto; padding: 0 1rem; }
  ol { list-style: none; padding: 0; display: grid; gap: .5rem;
       grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  li { border: 1px solid #d7d2e2; padding: .75rem; border-radius: .5rem; }
  p { margin: .5rem 0 0; text-transform: capitalize; }
</style>
<main><h1>Sample Kundli</h1><ol>${houses}</ol></main></html>`);

Add divisional charts when you need them

Append include=varga_charts&vargas=D9,D10 to the same request to get complete Navamsa and Dashamsa charts in varga_charts. You can set their house reference with reference=moon, sun, or karakamsha. See and try the bundled example

If the request fails, check the error reference. For credit allowances and limits, see pricing.

More examples, query parameters and response headers

Fetch the tithi for a date and place, in the language of your choice:

GET /v1/panchang/tithi
curl "https://api.lifeastroapi.com/v1/panchang/tithi?date=2026-04-19&tz=Asia/Kolkata&lat=28.61&lon=77.21" -H "Authorization: Bearer YOUR_API_KEY"

You should see a response like:

{
"date": "2026-04-19",
"location": { "lat": 28.61, "lon": 77.21, "alt": 0 },
"tz": "Asia/Kolkata",
"index": 1,
"name": "Dwitiya",
"paksha": "Shukla",
"tithi_in_paksha": 2,
"deity": "Brahma",
"type": "Bhadra",
"end_jd": 2461149.722061077,
"end_local": "2026-04-19 10:49:46"
}

The tithi is the one current at local sunrise, and end_local is when it ends. Daily panchang values like this are computed from sunrise, so the endpoint needs no time.

A successful tithi call returns HTTP 200 and costs 10 credits. Each endpoint's credit cost is listed in the API reference. If you get 401, the key is missing or wrong; 402 means you are out of credits or reached the free plan's daily limit; 429 means you hit the rate limit, so wait for Retry-After seconds. Every error code is explained in Errors.

4. Shared query parameters

Endpoints that calculate for a specific moment use these civil-time parameters. Daily panchang endpoints (tithi, nakshatra, Rahu Kaal and similar) work from local sunrise, so they read date, tz, lat and lon and ignore time. Each endpoint's reference page lists exactly which parameters it reads and which are required.

ParameterExampleNotes
date2026-04-19ISO 8601 date (YYYY-MM-DD)
time06:3024-hour HH:MM local time
tzAsia/KolkataIANA zone name (recommended) or a fixed offset like +05:30 — when using an offset, URL-encode the + as %2B (tz=%2B05:30)

Location (for location-sensitive endpoints such as panchang, sunrise, lagna):

ParameterExampleNotes
lat28.61Decimal degrees, north positive
lon77.21Decimal degrees, east positive

Don't know the coordinates? Call GET /v1/geo/search?q=Mumbai — it returns latitude, longitude and the IANA timezone for 5 million+ places.

Birth-chart endpoints (kundli, dasha, varshaphal) use the same parameters for the birth moment. Match-making endpoints prefix the birth details with boy. / girl. (boy.date, boy.time, boy.tz, girl.date …). Endpoints that compare a birth chart with another moment (tarabala, Sade Sati, transit vedha) take the chart as birth.date, birth.time, birth.tz and the moment as date, time, tz.

5. Response headers worth reading

HeaderMeaning
X-Credits-RemainingBought credits left (plan or wallet) after this call. Sent when the call was paid from bought credits, not for calls covered by welcome credits or the free allowance
X-RateLimit-Limit / X-RateLimit-Remaining / X-RateLimit-ResetPer-minute rate limit for your plan (30 requests a minute on the free plan)
X-CacheHIT when served from the response cache (no extra compute)
X-Request-IDQuote this when contacting support

Next steps