Developer Guide

Embed a Vedic chart in one line

Drop D1, D9, Bhava Chalit and Dasha into any page with a single script tag — powered by one API call.

The GrahaJyoti API gives you raw JSON. This guide adds a tiny, dependency-free helper — grahajyoti-chart.js — that turns the default POST /charts response into a ready-made chart: Rāśi (D1) and Navāṁśa (D9) planet tables, Bhāva Chalit cusps, and the Vimśottari mahādaśā timeline. One request, one script, zero build step.

You'll need a key. Grab a free one at the API Dashboard (1,000 requests/month free — see pricing).

1. The fastest way — a drop-in tag

Add a <div> with your birth details as data attributes, then the script. It auto-renders on load.

<div data-grahajyoti
     data-api-key="mkc_live_…"
     data-dob="1990-05-15"
     data-birth-time="14:30"
     data-latitude="12.9716"
     data-longitude="77.5946"
     data-timezone="Asia/Kolkata"
     data-name="Sample Chart"></div>

<script src="https://grahajyoti.com/assets/grahajyoti-chart.js"></script>

2. Or call it from JavaScript

For dynamic apps, render on demand and get a promise back:

GrahaJyoti.renderChart({
  el: '#chart',
  apiKey: 'mkc_live_…',
  dob: '1990-05-15',
  birth_time: '14:30',
  latitude: 12.9716,
  longitude: 77.5946,
  timezone: 'Asia/Kolkata'
}).then(function (resp) {
  console.log('rendered', resp.data);
});

3. Try it live

Paste your own key (it stays in your browser) and render the sample below:

4. What you get

Everything above comes from a single POST /charts call — lean by default (D1 + D9, panchanga, Bhava Chalit, and the mahādaśā timeline). Want more? Pass options straight through:

OptionTypeNotes
elstring / elementContainer to render into (CSS selector or node).
apiKeystringYour mkc_live_… key. Sent as X-API-Key.
dob, birth_timestringYYYY-MM-DD and HH:MM (24h, local).
latitude, longitudenumberDecimal degrees.
timezonestringIANA name, e.g. Asia/Kolkata.
ayanamshastringOptional. Default Lahiri.
chartsstring / arrayMore vargas: "all" or ["D10","D24"].
dasha_depthstringmaha (default) · antar · pratyantar.
baseUrlstringPoint at your own proxy (see below).

5. Going to production (read this)

An API key in client-side code is visible to anyone who opens dev tools. That's fine for prototypes, internal dashboards, or trusted users — and keys are rate-limited and quota-capped, so exposure is bounded. But for a public website, proxy the request through your own backend so the key never ships to the browser:

// your server: POST /astro-proxy  →  forwards to GrahaJyoti with the key
// then in the browser:
GrahaJyoti.renderChart({ el: '#chart', baseUrl: '/astro-proxy', /* no apiKey */
  dob: '1990-05-15', birth_time: '14:30',
  latitude: 12.9716, longitude: 77.5946, timezone: 'Asia/Kolkata' });

Your proxy just needs to accept the JSON body, add the X-API-Key header, and return the API's response verbatim at /astro-proxy/charts.

6. Next steps

Loading...