Guide
Generate a Kundli Report
From birth details to a report in your app and a branded PDF for your customer, in four steps.
Step 1 · Save your company details
Save your company name, logo and contacts in Dashboard → Company. They are printed on every PDF page. The PDF is only delivered once they are saved.
Step 2 · Generate the report
Send the birth details from your server (see Birth data & timezones). The response holds the report in English and Hindi, and a download_url for the PDF.
// Node 18+, on YOUR server (the API key stays secret). const res = await fetch("https://astrologyapis.ratnoveda.com/pdf/v1/kundli_report", { method: "POST", headers: { "X-API-Key": process.env.RATNOVEDA_API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ name: "Asha Sharma", gender: "female", day: 10, month: 5, year: 1990, hour: 19, min: 55, latitude: 28.6139, longitude: 77.209, timezone: 5.5, place: "New Delhi, India", language: "en", chart_style: "NORTH_INDIAN", }), }).then((r) => r.json()); const report = res.response.reports.en; // title, cover_rows, sections[] const pdfLink = res.response.download_url; // store it with the order; valid for 7 days
Step 3 · Show it in your app (optional)
Each report is a list of sections made of simple blocks, so you can draw it in your own design. Skip this step if you only sell the PDF.
for (const section of report.sections) { // section.title, section.part (e.g. [1, "Basic"]), section.blocks[] for (const block of section.blocks) { switch (block.type) { case "heading": /* block.text */ break; case "text": /* block.paragraphs[] */ break; case "keyvalue": /* block.rows: [label, value][] */ break; case "table": /* block.columns[], block.rows[][] */ break; // keygrid, chart … } } }
Step 4 · Deliver the PDF
Send a POST to the download_url, with no API key and no body. The first download is charged at the PDF price and repeat downloads are free, so retrying is safe.
const pdf = await fetch(pdfLink, { method: "POST" }).then((r) => r.json()); console.log(pdf.pdf_urls.en, pdf.pdf_urls.hi); // share these with your customer
To get the PDF in a single call, send "format": "pdf" with the request. Every field is listed in the Kundli Report API reference.