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/doshas/all', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'x-api-key': 'YOUR_API_KEY'
    },
    body: JSON.stringify({
        datetime: '1990-05-15T14:30:00+05:30',
        latitude: 28.6139,
        longitude: 77.2090
    })
});

const doshas = await response.json();

// Response:
{
    "mangalDosha": {
        "present": true,
        "severity": "partial",
        "percentage": 50,
        "marsHouse": 7,
        "exceptions": ["Mars aspected by Jupiter"],
        "cancelled": false,
        "remedies": [
            "Kumbh Vivah before marriage",
            "Mangal Shanti Puja",
            "Wear coral on Tuesday"
        ]
    },
    "kaalSarpDosha": {
        "present": true,
        "type": "Anant Kaal Sarp",
        "ascending": true,
        "severity": "moderate",
        "rahuHouse": 1,
        "ketuHouse": 7,
        "remedies": [
            "Kaal Sarp Dosh Nivaran Puja",
            "Visit Trimbakeshwar temple",
            "Chant Rahu mantra 18,000 times"
        ]
    },
    "pitraDosha": {
        "present": false,
        "indicators": []
    },
    "nadiDosha": {
        "applicable": false,
        "note": "Nadi dosha is checked during matching, not in individual charts"
    }
}

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/doshas/mangal', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'x-api-key': 'YOUR_API_KEY'
    },
    body: JSON.stringify({
        datetime: '1990-05-15T14:30:00+05:30',
        latitude: 28.6139,
        longitude: 77.2090,
        checkExceptions: true // Check cancellation rules
    })
});

const mangal = await mangalResponse.json();

// Response:
{
    "present": true,
    "marsPosition": {
        "house": 7,
        "sign": "Aries",
        "degree": 15.42,
        "nakshatra": "Bharani"
    },
    "severity": {
        "level": "high", // low, medium, high, severe
        "score": 75,
        "reason": "Mars in 7th house (marriage house)"
    },
    "type": "Uchcha Manglik", // Based on Mars dignity
    "exceptions": {
        "checked": [
            "Mars in own sign (Aries/Scorpio)",
            "Mars aspected by benefics",
            "Mars with Jupiter",
            "Both partners are Manglik"
        ],
        "applicable": ["Mars in own sign"],
        "cancellation": "partial" // none, partial, full
    },
    "effectOnMarriage": {
        "delay": "possible",
        "compatibility": "Match with another Manglik recommended"
    },
    "remedies": {
        "pujas": ["Mangal Shanti Puja", "Hanuman Puja on Tuesday"],
        "gemstones": ["Red Coral (Moonga)"],
        "mantras": ["Om Ang Angarakaya Namah (108 times)"],
        "fasting": "Tuesday fasting",
        "donations": "Red items on Tuesday"
    }
}

Kaal Sarp Dosha

All planets between Rahu and Ketu create Kaal Sarp Dosha:

import requests

def check_kaal_sarp(birth_datetime, lat, lng):
    response = requests.post(
        'https://api.vedika.io/v2/astrology/doshas/kaal-sarp',
        headers={'x-api-key': 'YOUR_API_KEY'},
        json={
            'datetime': birth_datetime,
            'latitude': lat,
            'longitude': lng
        }
    )

    data = response.json()

    if data['present']:
        print(f"Kaal Sarp Dosha: {data['type']}")
        print(f"Direction: {'Ascending' if data['ascending'] else 'Descending'}")
        print(f"Severity: {data['severity']}")
        print(f"\nRemedies:")
        for remedy in data['remedies']:
            print(f"  - {remedy}")
    else:
        print("No Kaal Sarp Dosha present")

    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+05:30', 28.6139, 77.2090)

Pitra Dosha

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

const pitra = await pitraResponse.json();

// Response:
{
    "present": true,
    "severity": "moderate",
    "indicators": [
        {
            "factor": "Sun conjunct Rahu",
            "description": "Sun (father) afflicted by Rahu",
            "weight": "major"
        },
        {
            "factor": "9th lord in 6th house",
            "description": "House of father's blessings weakened",
            "weight": "minor"
        }
    ],
    "effects": [
        "Obstacles in career despite effort",
        "Difficulty in having children",
        "Sudden financial losses"
    ],
    "remedies": {
        "pujas": [
            "Pitra Dosh Nivaran Puja",
            "Tripind Shraddha at Gaya"
        ],
        "donations": "Food to Brahmins on Amavasya",
        "rituals": "Perform Shraddha ceremony annually",
        "mantras": ["Pitra Gayatri Mantra"]
    }
}

Nadi Dosha (Marriage Matching)

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

const matchDoshas = await matchResponse.json();

// Response:
{
    "nadiDosha": {
        "present": true,
        "maleNadi": "Aadi",
        "femaleNadi": "Aadi",
        "severity": "high",
        "effects": [
            "Same Nadi indicates health issues for progeny",
            "Potential for genetic compatibility issues"
        ],
        "exceptions": {
            "checked": [
                "Same Rashi but different Nakshatra",
                "Same Nakshatra but different Pada"
            ],
            "applicable": [],
            "cancelled": false
        },
        "remedies": [
            "Nadi Dosha Nivaran Puja",
            "Mahamrityunjaya Japa (1.25 lakh)",
            "Donate gold equal to partner's weight (symbolic)"
        ]
    },
    "mangalDoshaCompatibility": {
        "maleHas": true,
        "femaleHas": false,
        "compatible": false,
        "note": "Manglik should marry Manglik for best results"
    }
}

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/doshas/all', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'x-api-key': 'YOUR_API_KEY'
                },
                body: JSON.stringify(profile)
            }).then(r => r.json())
        )
    );

    return results.map((doshas, i) => ({
        profile: profiles[i],
        isManglik: doshas.mangalDosha.present,
        hasKaalSarp: doshas.kaalSarpDosha.present,
        hasPitra: doshas.pitraDosha.present,
        overallSeverity: calculateOverallSeverity(doshas)
    }));
}

// 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 Free API Key