☰ DiAstrologer API Docs

DiAstrologer — Developer Guide

Pure Parashari Vedic Astrology API. All calculations run on the Vedic Ephemeris with Lahiri ayanamsa and Whole-Sign houses. 399 public endpoints across 51 domains.


1. Two API surfaces

Platform API Developer API
Prefix /api/v1/* /api/dev/v1/*
Auth Authorization: Bearer <JWT> X-API-Key: <api_key>
Audience End-users of your product External developers who pay per call
Access Free register + login Request access → admin approval → generate key
Billing Session/entitlement based Credit based (1 credit = ₹1)

Platform API (/api/v1)

Register a user (POST /api/v1/auth/register), log in (POST /api/v1/auth/login) to receive JWT access_token / refresh_token, and send Authorization: Bearer <access_token> on every call.

Developer API (/api/dev/v1)

The monetized API. Flow:

  1. POST /api/dev/v1/request-access — request a developer account.
  2. An admin approves it (/api/dev/v1/admin/access-requests).
  3. GET/POST /api/dev/v1/keys — list or create an API key (CreateKeyBody { name }).
  4. Call tools with header X-API-Key: <api_key>.

Every developer gets 100 free credits (≈6 calls at ₹15 each). After that each tool call costs 15 credits (₹15) flat — see the pricing table in section 6.


2. Quickstart

2.1 Register & login (Platform API)

# 1. Register
curl -X POST http://127.0.0.1:8000/api/v1/auth/register \
  -H 'Content-Type: application/json' \
  -d '{"email":"[email protected]","username":"dev","password":"secret123","full_name":"Dev"}' \
  -H 'X-Admin-Key: ...'

# 2. Login
curl -X POST http://127.0.0.1:8000/api/v1/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"email":"[email protected]","password":"secret123"}'
# → {"access_token":"...","refresh_token":"...","expires_in":...}

2.2 First chart calculation

curl -X POST http://127.0.0.1:8000/api/v1/chart/birth \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Rahul Sharma",
    "date": "1990-06-15",
    "time": "14:30:00",
    "latitude": 28.6139,
    "longitude": 77.209,
    "timezone": "Asia/Kolkata",
    "place_name": "Delhi"
  }'

2.3 First developer API call

curl -X POST http://127.0.0.1:8000/api/dev/v1/vedic/chart/birth \
  -H 'X-API-Key: <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{"date":"1990-06-15","time":"14:30:00","latitude":28.6139,"longitude":77.209,"timezone":"Asia/Kolkata"}'

Check remaining credits at any time:

curl -X GET http://127.0.0.1:8000/api/dev/v1/credits -H 'X-API-Key: <api_key>'

3. Authentication

Platform API (JWT)

Send: Authorization: Bearer <access_token>.

Developer API (API keys)


4. Core concepts

Birth data (the universal request shape)

Almost every calculation endpoint accepts the same birth-data fields:

Field Type Required Meaning
date string yes YYYY-MM-DD
time string yes HH:MM:SS (24-hour local time)
latitude number yes Decimal degrees, negative south
longitude number yes Decimal degrees, negative west
timezone string no IANA name, e.g. Asia/Kolkata. Omit to auto-estimate from coordinates
place_name string no Display name
name string no Native's name
gender / marital_status string no Context for some analyses

If timezone is omitted the server estimates it from longitude (38 offset buckets). For exact D60/karma analysis always supply a real IANA timezone.

Astrological constants

Response envelope

Most endpoints return:

{
  "success": true,
  "data": { "...": "payload" },
  "metadata": { "computed_ms": 123, "rule_matches": 42 }
}

A few return raw objects. Check each endpoint's reference page for the exact shape.


5. Error handling

HTTP Meaning Typical fix
400 Malformed request / invalid date Validate YYYY-MM-DD; check coordinates
401 Missing/invalid token or API key Send Authorization/X-API-Key header
403 No entitlement / paywall Purchase credits or upgrade tier
404 Unknown route / resource Check path; {resource_id} exists
422 Validation error Pydantic-style detail array of {loc, msg, type}
429 Rate limited Back off; retry with exponential delay
500 Internal error Contact support; include request id

Validation example:

{
  "detail": [
    {
      "loc": ["body", "date"],
      "msg": "Input should be a valid date in the format YYYY-MM-DD",
      "type": "date_from_datetime_parsing"
    }
  ]
}

6. Credits & pricing (Developer API)

Source: GET /api/dev/v1/pricing

Tool Cost/call Tool Cost/call
kundali 15 karma 15
medical 15 ayurdaya 15
btr 15 career 15
career-premium 15 dhana 15
jaimini 15 matching 15
muhurta 15 nakshatra 15
panchang 15 remedies 15
santan 15 timing 15
transit 15 varshphal 15
videsh-yoga 15 vidya 15
vyapar 15 varga 15
lalkitab 15 pdae 15
prashna 15 ping 0

Order more: POST /api/dev/v1/credits/order → Razorpay → POST /api/dev/v1/credits/verify.


7. Domain map (what to call for what)

You want Endpoint family
Charts (D1–D60) /api/v1/chart/*, /api/v1/varga/*
Daily panchang /api/v1/panchang/*
Dasha periods /api/v1/dasha/* (Vimshottari, Yogini, Ashtottari, Chara)
Future predictions /api/v1/prediction/*, /api/v1/timing/*
Career / wealth / marriage / education / children /api/v1/career, /dhana, /vivaha, /vidya, /santan
Kundali matching /api/v1/matching/* (36-point)
Muhurta (auspicious dates) /api/v1/muhurta/*, /api/v1/muhurta-select/*
Health /api/v1/medical/* (incl. Neecha Bhanga Raja Yoga)
Longevity /api/v1/ayurdaya/*
Doshas /api/v1/dosha/* (Manglik, Kaal Sarp, Kemdrum, …)
Yogas /api/v1/yoga/* (Raja, Dhana, Gajakesari, Vipreet, …)
Daily forecast /api/v1/pdae/*
Birth time rectification /api/v1/btr/*
Full kundali report /api/v1/kundali/generate (5 tiers)
Planet strength /api/v1/strength/* (Shadbala)
Transit /api/v1/transit/* (Gochara + Ashtakavarga)
Annual returns /api/v1/varshphal/*
Jaimini /api/v1/jaimini/*

8. Code examples

Python

import requests

BASE = "http://127.0.0.1:8000"
birth = {
    "date": "1990-06-15", "time": "14:30:00",
    "latitude": 28.6139, "longitude": 77.209,
    "timezone": "Asia/Kolkata", "place_name": "Delhi",
}

def call(path, payload, api_key=None, token=None):
    headers = {"Content-Type": "application/json"}
    if api_key:
        headers["X-API-Key"] = api_key
    if token:
        headers["Authorization"] = f"Bearer {token}"
    r = requests.post(f"{BASE}{path}", json=payload, headers=headers)
    r.raise_for_status()
    return r.json()

chart = call("/api/v1/chart/birth", birth)          # platform
chart = call("/api/dev/v1/vedic/chart/birth", birth, api_key="YOUR_KEY")  # dev API

JavaScript

async function callDevApi(path, payload, apiKey) {
  const res = await fetch(`http://127.0.0.1:8000${path}`, {
    method: "POST",
    headers: { "Content-Type": "application/json", "X-API-Key": apiKey },
    body: JSON.stringify(payload),
  });
  if (!res.ok) throw new Error(await res.text());
  return res.json();
}

9. Rate limits & best practices


10. Administration & monitoring

Admin endpoints live under /api/v1/admin/* (JWT + admin role):

Full inventory in the API Reference.