COMPATIBILITY MATCHING

How to Integrate Kundali Matching in Your App via API

Complete developer guide to implementing marriage compatibility features with Ashtakoot gun milan, Mangal dosha detection, and AI-powered match recommendations.

December 23, 2025 16 min read

Why Kundali Matching is a Must-Have Feature

Kundali matching (gun milan) is the #1 feature request for astrology and matrimonial apps in India and among the Indian diaspora. With 85% of Indian marriages still being arranged or semi-arranged, compatibility matching drives user engagement and premium conversions. Apps with kundali matching see 3.5x higher retention rates.

Market Opportunity

  • $4.5B - Indian matrimonial market size (2025)
  • 92% of matrimonial app users check kundali compatibility
  • 65% willing to pay $5-20 for detailed compatibility reports
  • 4.2x higher conversion on apps with automated matching

Understanding Ashtakoot System

The Ashtakoot (8 kutas) system evaluates compatibility across 8 dimensions based on Moon's nakshatra position in both birth charts. Here's the complete breakdown:

1. Varna Kuta

1 point

Spiritual compatibility and ego levels

Brahmin > Kshatriya > Vaishya > Shudra

2. Vashya Kuta

2 points

Mutual attraction and control

Human, Quadruped, Water, Insect, Wild

3. Tara Kuta

3 points

Birth star compatibility and health

Count from bride's nakshatra to groom's

4. Yoni Kuta

4 points

Sexual compatibility and intimacy

14 animal categories, natural enemies = 0

5. Graha Maitri

5 points

Mental compatibility and friendship

Based on Moon sign lord relationships

6. Gana Kuta

6 points

Temperament and behavior matching

Deva (divine), Manushya (human), Rakshasa (demon)

7. Bhakoot Kuta

7 points

Love and financial prosperity

6-8 or 2-12 moon sign distance = 0 points

8. Nadi Kuta

8 points

Health and progeny compatibility

Most important - same Nadi = 0 points

Score Interpretation

0-17 points:
❌ Not recommended - significant incompatibility
18-24 points:
⚠️ Average - acceptable with remedies
25-32 points:
✓ Good - compatible match
33-36 points:
✓✓ Excellent - highly compatible

API Integration - Basic Implementation

Let's implement kundali matching step by step. We'll use Vedika API which handles all complex calculations and dosha detection.

Step 1: Initialize API Client

import requests
from typing import Dict, Optional

class KundaliMatchingAPI:
    def __init__(self, api_key: str):
        self.api_key = api_key
        self.base_url = "https://api.vedika.io/v1"
        self.headers = {
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json"
        }

    def create_chart(self, name: str, dob: str, tob: str,
                     place: str) -> Dict:
        """Create a birth chart"""
        response = requests.post(
            f"{self.base_url}/charts/birth",
            headers=self.headers,
            json={
                "name": name,
                "dateOfBirth": dob,
                "timeOfBirth": tob,
                "placeOfBirth": place
            }
        )
        return response.json()

    def match_kundali(self, chart1_id: str, chart2_id: str,
                      detailed: bool = True) -> Dict:
        """Perform kundali matching"""
        response = requests.post(
            f"{self.base_url}/compatibility/match",
            headers=self.headers,
            json={
                "chart1": chart1_id,
                "chart2": chart2_id,
                "method": "ashtakoot",
                "includeDetails": detailed,
                "checkMangalDosha": True,
                "checkNadiDosha": True
            }
        )
        return response.json()

# Initialize
api = KundaliMatchingAPI("your_api_key_here")

Step 2: Create Charts for Both Partners

# Bride's chart
bride_chart = api.create_chart(
    name="Priya Sharma",
    dob="1995-03-15",
    tob="08:30:00",
    place="Mumbai, India"
)

# Groom's chart
groom_chart = api.create_chart(
    name="Rahul Verma",
    dob="1992-07-22",
    tob="14:45:00",
    place="Delhi, India"
)

print(f"Bride Chart ID: {bride_chart['id']}")
print(f"Groom Chart ID: {groom_chart['id']}")

Step 3: Perform Matching

# Match kundalis
match_result = api.match_kundali(
    chart1_id=bride_chart['id'],
    chart2_id=groom_chart['id'],
    detailed=True
)

# Display results
print(f"\n{'='*50}")
print(f"Compatibility Score: {match_result['totalScore']}/36")
print(f"Compatibility: {match_result['compatibility']}")
print(f"{'='*50}\n")

# Individual kuta scores
for kuta in match_result['kutas']:
    status = "✓" if kuta['scored'] == kuta['maximum'] else "○"
    print(f"{status} {kuta['name']:15} {kuta['scored']}/{kuta['maximum']}")

# Doshas
print(f"\n{'='*50}")
print("Dosha Analysis:")
print(f"{'='*50}")
print(f"Mangal Dosha (Bride): {match_result['doshas']['bride']['mangalDosha']}")
print(f"Mangal Dosha (Groom): {match_result['doshas']['groom']['mangalDosha']}")
print(f"Nadi Dosha: {match_result['doshas']['nadiDosha']}")

API Response Structure

{
  "totalScore": 28,
  "compatibility": "Good",
  "recommendation": "Compatible match with good prospects",
  "kutas": [
    {
      "name": "Varna",
      "scored": 1,
      "maximum": 1,
      "description": "Spiritual compatibility - Excellent",
      "details": "Both belong to compatible varnas"
    },
    {
      "name": "Vashya",
      "scored": 2,
      "maximum": 2,
      "description": "Mutual attraction - Perfect",
      "details": "Strong natural attraction between partners"
    },
    {
      "name": "Tara",
      "scored": 3,
      "maximum": 3,
      "description": "Birth star compatibility - Excellent",
      "details": "Favorable nakshatra combination"
    },
    {
      "name": "Yoni",
      "scored": 3,
      "maximum": 4,
      "description": "Sexual compatibility - Good",
      "details": "Compatible animal signs"
    },
    {
      "name": "Graha Maitri",
      "scored": 5,
      "maximum": 5,
      "description": "Mental compatibility - Perfect",
      "details": "Moon lords are natural friends"
    },
    {
      "name": "Gana",
      "scored": 6,
      "maximum": 6,
      "description": "Temperament - Perfect match",
      "details": "Both belong to Deva gana"
    },
    {
      "name": "Bhakoot",
      "scored": 7,
      "maximum": 7,
      "description": "Love and prosperity - Excellent",
      "details": "Favorable moon sign distance"
    },
    {
      "name": "Nadi",
      "scored": 0,
      "maximum": 8,
      "description": "Health compatibility - Critical",
      "details": "Same nadi - requires remedies"
    }
  ],
  "doshas": {
    "bride": {
      "mangalDosha": {
        "present": false,
        "severity": "none",
        "houses": []
      },
      "nadiDosha": true,
      "otherDoshas": []
    },
    "groom": {
      "mangalDosha": {
        "present": true,
        "severity": "medium",
        "houses": [1, 8],
        "cancellation": "Age over 28"
      },
      "nadiDosha": true,
      "otherDoshas": []
    },
    "nadiDosha": {
      "present": true,
      "severity": "high",
      "remedies": [
        "Perform Nadi Dosha Shanti Puja",
        "Donate to couples trying to conceive",
        "Chant Maha Mrityunjaya Mantra 108 times daily"
      ]
    }
  },
  "strengths": [
    "Excellent mental compatibility (Graha Maitri 5/5)",
    "Perfect temperament match (Gana 6/6)",
    "Strong financial prospects (Bhakoot 7/7)"
  ],
  "concerns": [
    "Nadi dosha present - affects progeny",
    "Groom has medium Mangal dosha",
    "Overall score borderline for traditional standards"
  ],
  "aiInsights": {
    "summary": "This match shows strong emotional and mental compatibility...",
    "prognosis": "Good long-term prospects with remedies for Nadi dosha",
    "keyFactors": ["Strong friendship base", "Similar life goals"]
  }
}

Advanced: Mangal Dosha Detection

Mangal dosha (Kuja dosha) is critical for marriage matching. Here's how to detect and analyze it:

def analyze_mangal_dosha(chart_id: str) -> Dict:
    """Detailed Mangal dosha analysis"""
    response = requests.post(
        f"{base_url}/analysis/mangal-dosha",
        headers=headers,
        json={
            "chartId": chart_id,
            "checkCancellation": True,
            "includeSeverity": True
        }
    )

    dosha = response.json()

    # Severity levels
    severity_map = {
        "none": 0,
        "low": 1,
        "medium": 2,
        "high": 3,
        "severe": 4
    }

    return {
        "present": dosha['present'],
        "severity": severity_map[dosha['severity']],
        "houses": dosha['marsHouses'],
        "cancellations": dosha['cancellationFactors'],
        "matchRequired": dosha['severity'] in ['high', 'severe']
    }

# Check both partners
bride_dosha = analyze_mangal_dosha(bride_chart['id'])
groom_dosha = analyze_mangal_dosha(groom_chart['id'])

# Dosha matching logic
def is_mangal_dosha_compatible(dosha1, dosha2):
    """Check if Mangal doshas cancel out"""

    # Both have dosha - cancels out
    if dosha1['present'] and dosha2['present']:
        return True, "Both partners have Mangal dosha - cancels out"

    # Neither has dosha
    if not dosha1['present'] and not dosha2['present']:
        return True, "No Mangal dosha in either chart"

    # One has dosha
    severe_dosha = dosha1 if dosha1['present'] else dosha2

    # Check for natural cancellations
    if 'age_over_28' in severe_dosha['cancellations']:
        return True, "Dosha cancelled by age factor"

    if severe_dosha['severity'] <= 1:  # Low severity
        return True, "Low severity dosha - acceptable"

    return False, "Unmatched Mangal dosha - requires remedies"

compatible, reason = is_mangal_dosha_compatible(bride_dosha, groom_dosha)
print(f"Mangal Dosha Compatible: {compatible}")
print(f"Reason: {reason}")

Building a Complete Matching Feature

Frontend Implementation (React)

import React, { useState } from 'react';
import axios from 'axios';

function KundaliMatchingForm() {
  const [bride, setBride] = useState({});
  const [groom, setGroom] = useState({});
  const [result, setResult] = useState(null);
  const [loading, setLoading] = useState(false);

  const handleMatch = async () => {
    setLoading(true);

    try {
      // Create both charts
      const brideChart = await axios.post('/api/charts', bride);
      const groomChart = await axios.post('/api/charts', groom);

      // Perform matching
      const matchResult = await axios.post('/api/compatibility/match', {
        chart1: brideChart.data.id,
        chart2: groomChart.data.id
      });

      setResult(matchResult.data);
    } catch (error) {
      console.error('Matching failed:', error);
    } finally {
      setLoading(false);
    }
  };

  return (
    

Kundali Matching

{/* Bride Details */}

Bride Details

{/* Groom Details */}

Groom Details

{result && }
); } function MatchingResults({ result }) { const getScoreColor = (score) => { if (score >= 33) return 'text-green-600'; if (score >= 25) return 'text-blue-600'; if (score >= 18) return 'text-orange-600'; return 'text-red-600'; }; return (
{/* Overall Score */}
{result.totalScore}/36
{result.compatibility}
{result.recommendation}
{/* Kuta Breakdown */}

Detailed Analysis

{result.kutas.map((kuta, idx) => (
{kuta.name}
{kuta.description}
{kuta.scored}/{kuta.maximum}
))}
{/* Doshas */} {(result.doshas.nadiDosha || result.doshas.bride.mangalDosha.present || result.doshas.groom.mangalDosha.present) && (

Doshas Detected

{result.doshas.nadiDosha && (
Nadi Dosha
{result.doshas.nadiDosha.remedies?.join(', ')}
)}
)} {/* AI Insights */}

AI Analysis

{result.aiInsights.summary}

); }

Batch Matching for Matrimonial Platforms

For matrimonial sites, you need to match one profile against hundreds. Here's an efficient batch implementation:

async def find_compatible_matches(
    base_chart_id: str,
    candidate_chart_ids: List[str],
    min_score: int = 18
) -> List[Dict]:
    """Find all compatible matches from a list"""

    # Batch API call for efficiency
    response = await asyncio.gather(*[
        api.match_kundali(base_chart_id, candidate_id)
        for candidate_id in candidate_chart_ids
    ])

    # Filter and sort results
    compatible = [
        {
            'chartId': candidate_chart_ids[i],
            'score': result['totalScore'],
            'compatibility': result['compatibility'],
            'concerns': result['concerns']
        }
        for i, result in enumerate(response)
        if result['totalScore'] >= min_score
    ]

    # Sort by score descending
    compatible.sort(key=lambda x: x['score'], reverse=True)

    return compatible

# Find top matches
user_chart = "chart_abc123"
all_candidates = get_all_eligible_profiles()  # Your DB query

matches = await find_compatible_matches(
    user_chart,
    [c['chartId'] for c in all_candidates],
    min_score=24  # Only "Good" or better
)

# Display top 10 matches
for match in matches[:10]:
    print(f"{match['score']}/36 - {match['compatibility']}")

Caching Strategy for Performance

import redis
import json
from datetime import timedelta

redis_client = redis.Redis(host='localhost', port=6379, decode_responses=True)

def get_cached_match(chart1_id: str, chart2_id: str) -> Optional[Dict]:
    """Check cache for existing match result"""
    # Create deterministic key (sorted to handle order)
    charts = sorted([chart1_id, chart2_id])
    cache_key = f"match:{charts[0]}:{charts[1]}"

    cached = redis_client.get(cache_key)
    if cached:
        return json.loads(cached)
    return None

def cache_match_result(chart1_id: str, chart2_id: str, result: Dict):
    """Cache match result for 30 days"""
    charts = sorted([chart1_id, chart2_id])
    cache_key = f"match:{charts[0]}:{charts[1]}"

    redis_client.setex(
        cache_key,
        timedelta(days=30),
        json.dumps(result)
    )

def match_with_cache(chart1_id: str, chart2_id: str) -> Dict:
    """Match with caching"""
    # Check cache first
    cached = get_cached_match(chart1_id, chart2_id)
    if cached:
        return cached

    # Calculate new match
    result = api.match_kundali(chart1_id, chart2_id)

    # Cache result
    cache_match_result(chart1_id, chart2_id, result)

    return result

Monetization Strategies

Freemium Model

  • ✓ Basic score (free)
  • ✓ 3 matches per month (free)
  • 💎 Detailed kuta breakdown ($4.99)
  • 💎 Unlimited matches ($9.99/mo)
  • 💎 AI compatibility report ($14.99)

Enterprise Model

  • 💼 API access ($299/mo)
  • 💼 White-label solution ($999/mo)
  • 💼 Custom matching rules ($1999/mo)
  • 💼 Astrologer consultation platform ($2999/mo)

Best Practices

Always Handle Exceptions

Invalid birth times, place names, or API errors. Provide fallback UI and clear error messages.

Cache Aggressively

Kundali matches don't change. Cache results for 30+ days to reduce API costs and improve speed.

Explain the Scores

Users don't understand "18/36". Show what each kuta means and why it matters.

Handle Dosha Sensitively

Mangal dosha carries stigma. Present it factually with remedies and cancellation factors.

Add Kundali Matching to Your App

Vedika API handles all kundali matching complexity - Ashtakoot scoring, dosha detection, remedies, and AI insights. Production-ready with <200ms latency.

Frequently Asked Questions

What is Kundali matching in Vedic astrology?

Kundali matching (Gun Milan) is the Vedic process of assessing marriage compatibility between two people using their birth charts. It evaluates 8 factors (Ashtakoot) including Varna, Vashya, Tara, Yoni, Graha Maitri, Gana, Bhakoot, and Nadi. A score of 18+ out of 36 points indicates good compatibility.

How is the Ashtakoot compatibility score calculated?

Ashtakoot system assigns points based on Moon's nakshatra in both charts. Maximum points: Nadi (8), Bhakoot (7), Gana (6), Graha Maitri (5), Yoni (4), Tara (3), Vashya (2), Varna (1). Total of 36 points. Scores: 18-24 = Average, 25-32 = Good, 33-36 = Excellent compatibility.

What is Mangal Dosha and how serious is it?

Mangal Dosha (Kuja Dosha) occurs when Mars is in 1st, 4th, 7th, 8th, or 12th house. It's believed to cause marital discord. Severity varies - Mars in 1st or 8th is most severe. Dosha cancels if both partners have it, or after age 28. Many modern astrologers consider it less critical than overall compatibility.

Which API is best for kundali matching integration?

Vedika API offers comprehensive kundali matching with Ashtakoot scoring, Mangal Dosha detection, detailed kuta analysis, and AI-generated compatibility reports. It handles North/South Indian systems, multiple ayanamsas, and provides match recommendations. Response time under 200ms with 99.9% uptime.

Can I customize kundali matching rules in the API?

Yes, Vedika API allows customization of matching criteria including minimum score thresholds, weightage adjustments for each kuta, Mangal Dosha cancellation rules, and regional variations (North vs South Indian). You can also exclude certain doshas or add custom compatibility factors.