Integration Guide

Five ways to integrate Vedika into your application: REST API, JavaScript SDK, Python SDK, SSE streaming for real-time AI responses, and webhooks for async workflows.

Architecture Overview

Your App / Client
↓ HTTPS (JSON) ↓
api.vedika.io
↓ Routes to ↓
Birth Chart
Dasha
Matching
Predictions
AI Chat
Panchang
Numerology
Western

REST API

Standard JSON over HTTPS. All endpoints accept POST requests with JSON body and return JSON responses. Base URL: https://api.vedika.io

POST /v2/astrology/kundli
curl -X POST https://api.vedika.io/v2/astrology/kundli \
  -H "Content-Type: application/json" \
  -H "x-api-key: vk_live_your_key_here" \
  -d '{
    "datetime": "1990-06-15T10:30:00",
    "latitude": 19.0760,
    "longitude": 72.8777,
    "timezone": "+05:30"
  }'
Response (truncated)
{
  "success": true,
  "data": {
    "planets": [
      { "name": "Sun", "sign": "Taurus", "house": 11, "degree": 0.89, "nakshatra": "Mrigashira" },
      { "name": "Moon", "sign": "Capricorn", "house": 5, "degree": 15.23, "nakshatra": "Shravana" }
    ],
    "houses": [ ... ],
    "ascendant": { "sign": "Leo", "degree": 3.45 }
  }
}

JavaScript SDK (@vedika-io/sdk)

Typed interfaces, auto-retry with exponential backoff, streaming support, and error handling built in. Works in Node.js 18+ and modern browsers.

Install
npm install @vedika-io/sdk
Usage
import { VedikaClient } from '@vedika-io/sdk';

const vedika = new VedikaClient({ apiKey: process.env.VEDIKA_API_KEY });

// Birth chart
const chart = await vedika.astrology.kundli({
  datetime: '1990-06-15T10:30:00',
  latitude: 19.0760,
  longitude: 72.8777,
  timezone: '+05:30'
});

console.log(chart.planets);     // Typed planet array
console.log(chart.ascendant);   // { sign, degree, nakshatra }

Python SDK (vedika-sdk)

Pythonic interface with type hints, async support, and automatic retries. Compatible with Python 3.8+.

Install
pip install vedika-sdk
Usage
from vedika import VedikaClient

client = VedikaClient(api_key="vk_live_your_key")

chart = client.astrology.kundli(
    datetime="1990-06-15T10:30:00",
    latitude=19.0760,
    longitude=72.8777,
    timezone="+05:30"
)

print(chart.planets)     # List of Planet objects
print(chart.ascendant)   # Ascendant with sign, degree, nakshatra

Server-Sent Events (SSE) Streaming

The AI chatbot endpoint supports real-time streaming via SSE. Responses are delivered token-by-token for a typing-like experience. Ideal for chat interfaces.

Streaming AI Chat
const evtSource = new EventSource(
  'https://api.vedika.io/api/vedika/chat/stream?' +
  new URLSearchParams({
    question: 'What does my career look like?',
    datetime: '1990-06-15T10:30:00',
    latitude: '19.0760',
    longitude: '72.8777',
    timezone: '+05:30',
    apiKey: 'vk_live_your_key'
  })
);

evtSource.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.type === 'token') {
    document.getElementById('response').textContent += data.content;
  }
  if (data.type === 'done') {
    evtSource.close();
  }
};

Webhooks (Async Workflows)

For long-running AI analysis or batch processing, configure a webhook URL to receive results asynchronously. Useful when you want to offload processing and get notified when results are ready.

Webhook Payload (POST to your URL)
{
  "event": "query.completed",
  "queryId": "q_abc123",
  "timestamp": "2026-02-23T14:30:00Z",
  "data": {
    "question": "Career analysis for 1990 birth chart",
    "response": "Based on your chart, the 10th lord Mercury is...",
    "confidence": 0.95
  }
}

Authentication

API Key Authentication

All requests require an API key passed in the x-api-key header. Keys are generated from the dashboard.

HeaderValueRequired
x-api-keyvk_live_your_key_hereYes (all requests)
Content-Typeapplication/jsonYes (POST requests)

Error Handling

StatusMeaningAction
200SuccessParse response body
400Bad request (missing/invalid fields)Check request body schema
401Invalid or missing API keyCheck x-api-key header
402Insufficient wallet balanceAdd funds from dashboard
429Rate limit exceededBack off and retry after Retry-After header
500Server errorRetry with exponential backoff
Get API Key Read Full Docs