WordPressREST APIKundliPanchangWooCommerce

Add Astrology to Any WordPress Site
No Plugin. Pure REST API.

Embed live kundli charts, daily panchang, dasha timelines, and compatibility scores in any WordPress site using PHP or JavaScript. Works with every theme and page builder.

Get Free API Key →API Documentation

What You Can Build

📅
Daily Panchang Widget
Show today's tithi, nakshatra, and Choghadiya in your sidebar. Auto-refreshes every day via a simple JavaScript fetch.
📜
Free Kundli Form
Let visitors enter their birth details and receive a downloadable PDF kundli. Capture leads while providing value.
🔮
Birth Chart Widget
Render a North Indian or South Indian kundli chart SVG on any post or page using the chart-image endpoint.
💑
Compatibility Checker
Add a Kundli Milan form to matrimonial pages. Display the Ashtakoot score and compatibility report instantly.
Dasha Timeline Page
Create membership-gated pages showing personalised Mahadasha timelines for registered users.
Horoscope Landing Pages
Generate moon sign or sun sign horoscope pages. Serve 1,000s of personalised readings without server overhead.

PHP Integration (WordPress)

functions.php
<?php
// WordPress: fetch daily panchang via REST API
function vai_get_panchang() {
  $today = date('d/m/Y');
  $url   = add_query_arg([
    'api_key' => get_option('vai_api_key'),
    'date'    => $today,
    'lat'     => get_option('vai_default_lat', 28.6139),
    'lon'     => get_option('vai_default_lon', 77.2090),
    'tz'      => get_option('vai_default_tz', 5.5),
  ], 'https://vedintelastroapi.com/api/v1/panchang/panchang');

  $response = wp_remote_get($url, ['timeout' => 10]);
  if (is_wp_error($response)) return null;

  $data = json_decode(wp_remote_retrieve_body($response), true);
  return $data['response'] ?? null;
}

// Shortcode: [vai_panchang]
add_shortcode('vai_panchang', function() {
  $p = vai_get_panchang();
  if (!$p) return '<p>Unable to load Panchang.</p>';

  return sprintf('
    <div class="vai-panchang">
      <strong>Tithi:</strong> %s &nbsp;|&nbsp;
      <strong>Nakshatra:</strong> %s &nbsp;|&nbsp;
      <strong>Yoga:</strong> %s
    </div>',
    esc_html($p['tithi']),
    esc_html($p['nakshatra']),
    esc_html($p['yoga'])
  );
});

JavaScript Integration (Frontend)

kundli-widget.js
// JavaScript: render kundli chart in any page
async function renderKundliChart(containerId, birthData) {
  const { dob, tob, lat, lon, tz } = birthData
  const url = new URL('https://vedintelastroapi.com/api/v1/horoscope/chart-image')
  url.searchParams.set('api_key', 'vai_YOUR_KEY')
  url.searchParams.set('dob', dob)   // DD/MM/YYYY
  url.searchParams.set('tob', tob)   // HH:MM
  url.searchParams.set('lat', lat)
  url.searchParams.set('lon', lon)
  url.searchParams.set('tz', tz)
  url.searchParams.set('style', 'north')  // or 'south'
  url.searchParams.set('format', 'svg')

  const data = await fetch(url).then(r => r.json())
  // Embed inline SVG
  document.getElementById(containerId).innerHTML = atob(data.response.image)
}

WordPress Integration — FAQs

Do I need a WordPress plugin to use the astrology API?
No plugin is required. You can integrate the API directly using PHP (via wp_remote_get) or JavaScript (via fetch). This means it works with any WordPress theme — Elementor, Divi, Astra, GeneratePress, or custom. You control exactly what is displayed, where, and how.
Can I use this with WooCommerce to sell personalised reports?
Yes. Many developers use the API to power paid astrology report generation in WooCommerce. A customer purchases a "personalised kundli report" product, fills in their birth details on the thank-you page, and you call our API to generate and deliver a PDF or on-screen reading. We have PDF report endpoints for this exact workflow.
How do I keep my API key secure in WordPress?
Store your API key in wp-config.php or as a WordPress option using the wp_options table (add_option / get_option). Never hard-code it in theme files that might be version-controlled. All API calls should be made server-side (PHP) rather than exposing the key in frontend JavaScript. Only make client-side calls if you implement a WordPress proxy endpoint that calls our API from your PHP backend.
How much will the API cost for a high-traffic WordPress site?
Our natal chart caching means repeat visitors with the same birth details never consume additional API calls — the result is returned from our Supabase cache instantly. For a daily panchang widget showing one result per day, you use 1 call/day per timezone regardless of traffic. The Starter plan (100,000 calls/month) handles most high-traffic WordPress sites comfortably at $49/mo.
Can I show the kundli chart as an image on the page?
Yes. The /horoscope/chart-image endpoint returns a North or South Indian kundli diagram as a base64-encoded SVG or PNG. In PHP: echo base64_decode($response['image']). In JavaScript: embed it directly as an inline SVG or set it as an <img> src with a data URI. The chart renders at any size without pixelation.
Related Resources
Kundli APIPanchang APIFree Vedic API GuideDasha Integration Guide

Start for free. Ship today.

500 free API calls. No credit card. Works with any WordPress theme.

Get Your Free API Key →