Dosha Detection API - Mangal and Kaal Sarp Dosha Analysis
API TUTORIAL

Dosha Detection API: Mangal, Kaal Sarp, Pitra & Nadi

Complete guide to detecting astrological doshas via API. Automatic severity analysis, exception rules, and remedies included.

January 7, 2026 - 14 min read

What are Doshas?

Doshas are specific planetary combinations in a birth chart that are traditionally considered inauspicious. They're particularly important for marriage compatibility. Vedika API detects all major doshas with severity analysis.

Detect All Doshas

// Comprehensive dosha detection
const response = await fetch('https://api.vedika.io/v2/astrology/all-doshas', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
        datetime: '1990-05-15T14:30:00',
        latitude: 28.6139,
        longitude: 77.2090,
        timezone: '+05:30'
    })
});

const doshas = await response.json();

// One call, one result for each of Mangal, Kaal Sarp and Pitru dosha:
// { success: true, data: { ...the three dosha results... }, billing: { charged, ... } }
// Print it to see every field this endpoint returns for your chart.
console.log(JSON.stringify(doshas.data, null, 2));

Mangal Dosha (Manglik)

Mars in houses 1, 2, 4, 7, 8, or 12 creates Mangal Dosha:

// Detailed Mangal Dosha analysis
const mangalResponse = await fetch('https://api.vedika.io/v2/astrology/mangal-dosha', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
        datetime: '1990-05-15T14:30:00',
        latitude: 28.6139,
        longitude: 77.2090,
        timezone: '+05:30'
    })
});

const mangal = await mangalResponse.json();

// Severity, Mars position, cancellation rules and remedies for this chart
// come back inside data. Print it to see every field.
console.log(JSON.stringify(mangal.data, null, 2));

Kaal Sarp Dosha

All planets between Rahu and Ketu create Kaal Sarp Dosha:

import json
import requests

def check_kaal_sarp(birth_datetime, lat, lng):
    response = requests.post(
        'https://api.vedika.io/v2/astrology/kaal-sarp-dosha',
        headers={'Authorization': 'Bearer YOUR_API_KEY'},
        json={
            'datetime': birth_datetime,
            'latitude': lat,
            'longitude': lng,
            'timezone': '+05:30'
        }
    )
    response.raise_for_status()

    data = response.json()['data']

    # Whether the dosha is present, its type and the remedies are in data.
    # Print it to see every field this endpoint returns for your chart.
    print(json.dumps(data, indent=2))

    return data

# 12 Types of Kaal Sarp Dosha:
# 1. Anant - Rahu in 1st, Ketu in 7th
# 2. Kulik - Rahu in 2nd, Ketu in 8th
# 3. Vasuki - Rahu in 3rd, Ketu in 9th
# 4. Shankhpal - Rahu in 4th, Ketu in 10th
# 5. Padma - Rahu in 5th, Ketu in 11th
# 6. Mahapadma - Rahu in 6th, Ketu in 12th
# 7. Takshak - Rahu in 7th, Ketu in 1st
# 8. Karkotak - Rahu in 8th, Ketu in 2nd
# 9. Shankhchur - Rahu in 9th, Ketu in 3rd
# 10. Ghatak - Rahu in 10th, Ketu in 4th
# 11. Vishdhar - Rahu in 11th, Ketu in 5th
# 12. Sheshnag - Rahu in 12th, Ketu in 6th

result = check_kaal_sarp('1990-05-15T14:30:00', 28.6139, 77.2090)

Pitra Dosha

// Pitra Dosha detection
const pitraResponse = await fetch('https://api.vedika.io/v2/astrology/pitru-dosha', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
        datetime: '1990-05-15T14:30:00',
        latitude: 28.6139,
        longitude: 77.2090,
        timezone: '+05:30'
    })
});

const pitra = await pitraResponse.json();

// Whether the dosha is present, the indicators behind it and the
// remedies come back inside data. Print it to see every field.
console.log(JSON.stringify(pitra.data, null, 2));

Nadi Dosha (Marriage Matching)

// Nadi Dosha is checked during Kundli matching (Guna Milan)
const matchResponse = await fetch('https://api.vedika.io/v2/astrology/guna-milan', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
        male: {
            datetime: '1990-05-15T14:30:00',
            latitude: 28.6139,
            longitude: 77.2090,
            timezone: '+05:30'
        },
        female: {
            datetime: '1992-08-20T09:15:00',
            latitude: 19.0760,
            longitude: 72.8777,
            timezone: '+05:30'
        }
    })
});

const match = await matchResponse.json();

// The Nadi koota carries a score out of 8: name, score, maxPoints, interpretation.
// Same Nadi scores 0 of 8, which is the Nadi Dosha.
const nadi = match.data.gunaDetails.nadi;
console.log(`Nadi: ${nadi.score}/${nadi.maxPoints}`);
console.log(nadi.interpretation);
console.log(nadi.score === 0 ? 'Nadi Dosha present' : 'No Nadi Dosha');

Batch Dosha Check

// Check multiple profiles for doshas
async function batchDoshaCheck(profiles) {
    const results = await Promise.all(
        profiles.map(profile =>
            fetch('https://api.vedika.io/v2/astrology/all-doshas', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'Authorization': 'Bearer YOUR_API_KEY'
                },
                body: JSON.stringify(profile)
            }).then(r => r.json())
        )
    );

    // Each result is the full envelope; the dosha verdicts are in result.data.
    // Log one result first to see the field names for your chart.
    return results.map((result, i) => ({
        profile: profiles[i],
        doshas: result.data
    }));
}

// Useful for matrimonial platforms to pre-calculate dosha status

Accurate Dosha Detection

Vedika API applies traditional rules with all exception cases. Used by 100+ matrimonial platforms for reliable dosha analysis.

Get API Key