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 "Authorization: Bearer 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 Authorization: Bearer header. Keys are generated from the dashboard.

HeaderValueRequired
Authorization: Bearervk_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 Authorization: Bearer <key> header (x-api-key also accepted during deprecation window until 2026-10-20)
402Insufficient wallet balanceAdd funds from dashboard
429Rate limit exceededBack off and retry after Retry-After header
500Server errorRetry with exponential backoff

Geocode (lat / long / historical timezone)

Every birth chart requires latitude, longitude, and timezone. Instead of integrating a separate geocoding vendor, use Vedika's built-in geocode endpoints — $0.01 per call flat, no external-vendor markup, no ToS restrictions on reselling results.

What makes it different: the resolve endpoint returns the historical timezone offset at the moment of birth, not the modern one. For births before 1970, US DST rule changes of 2007, or India's pre-1945 timezone shifts, this gives you the mathematically correct UTC offset — which every competing astrology API gets wrong.

EndpointPurposePriceRate limit
GET /v2/geocode/searchAutocomplete place name → ranked list$0.01 / callPlan default
GET /v2/geocode/resolveplaceId (+ optional birthDate) → full details + historical timezone$0.01 / callPlan default
GET /v2/geocode/reverselat/lng → nearest city$0.01 / callPlan default

Example — resolve timezone for a 1962 Bombay birth

# 1. Autocomplete
curl "https://api.vedika.io/v2/geocode/search?q=mumbai&country=IN&limit=1" \
  -H "Authorization: Bearer vk_live_your_key"

# Returns: { placeId: "IN-16-Mumbai-1275339", ... timezone: "Asia/Kolkata" }

# 2. Resolve with birthDate → historical offset
curl "https://api.vedika.io/v2/geocode/resolve?placeId=IN-16-Mumbai-1275339&birthDate=1962-06-15T07:42:00" \
  -H "Authorization: Bearer vk_live_your_key"

# Returns:
# {
#   "success": true,
#   "place": { "name": "Mumbai", "latitude": 19.07283, "longitude": 72.88261, ... },
#   "timezoneAtBirth": {
#     "ianaZone": "Asia/Kolkata",
#     "utcOffsetMinutes": 330,
#     "utcOffsetString": "+05:30",
#     "isDst": false,
#     "resolvedFor": "1962-06-15T07:42:00.000Z"
#   }
# }

JavaScript example

const API = 'https://api.vedika.io';
const KEY = 'vk_live_your_key';

async function getBirthCoords(placeQuery, birthDate) {
  const search = await fetch(`${API}/v2/geocode/search?q=${encodeURIComponent(placeQuery)}&limit=1`, {
    headers: { Authorization: `Bearer ${KEY}` }
  }).then(r => r.json());

  if (!search.results.length) throw new Error('Place not found');
  const placeId = search.results[0].placeId;

  const resolved = await fetch(`${API}/v2/geocode/resolve?placeId=${placeId}&birthDate=${birthDate}`, {
    headers: { Authorization: `Bearer ${KEY}` }
  }).then(r => r.json());

  return {
    latitude:  resolved.place.latitude,
    longitude: resolved.place.longitude,
    timezone:  resolved.timezoneAtBirth.utcOffsetString   // e.g. "+05:30"
  };
}

// Feed directly into any /v2/astrology/* endpoint
const coords = await getBirthCoords('Bombay', '1962-06-15T07:42:00');

Python example

import requests

API = 'https://api.vedika.io'
KEY = 'vk_live_your_key'
headers = {'Authorization': f'Bearer {KEY}'}

def get_birth_coords(place_query, birth_date):
    s = requests.get(f'{API}/v2/geocode/search',
                     params={'q': place_query, 'limit': 1},
                     headers=headers).json()
    if not s['results']:
        raise ValueError('Place not found')
    place_id = s['results'][0]['placeId']

    r = requests.get(f'{API}/v2/geocode/resolve',
                     params={'placeId': place_id, 'birthDate': birth_date},
                     headers=headers).json()
    return {
        'latitude':  r['place']['latitude'],
        'longitude': r['place']['longitude'],
        'timezone':  r['timezoneAtBirth']['utcOffsetString']
    }

coords = get_birth_coords('Bombay', '1962-06-15T07:42:00')

Historical name aliases (auto-resolved)

These are mapped for you — passing the old name returns the modern city:

Get API Key Read Full Docs