Mangal Dosha (also called the Manglik or Kuja Dosha) is the placement of Mars in the 1st, 4th, 7th, 8th, or 12th house of a chart, a condition examined in marriage matching across Jyotish tradition. With the Vedika API you detect it programmatically by computing a sidereal chart and reading Mars's house position, then layer in the cancellation (bhanga) rules that decide whether the dosha actually applies. This guide shows the exact endpoints, request shapes, and code to do that.
What Mangal Dosha is, in API terms
In classical practice, Mangal Dosha is assessed from the placement of Mars (Mangal/Kuja) relative to the Ascendant (Lagna), the Moon, and in matching contexts the Venus chart. Brihat Parashara Hora Shastra and Phaladeepika both treat Mars's occupation of the 7th and 8th houses as significant for marital matters, and matrimonial tradition extends the count to the 1st, 4th, and 12th houses. Translating that into software means three deterministic steps:
- Compute the chart — get Mars's sidereal longitude and the house it falls in, from the Ascendant and (for a fuller reading) from the Moon.
- Apply the dosha rule — flag the chart if Mars sits in 1, 4, 7, 8, or 12.
- Check cancellations — apply the dosha bhanga rules that neutralise the flag (Mars in own/exalted sign, certain aspects, age thresholds, and equivalent dosha on the partner's chart).
The first two steps are pure astronomy and rule logic; only the interpretive layer touches anything subjective, which is why a code-computed approach is reliable here. Mars's house is not a matter of opinion — it is a function of birth time, latitude, longitude, and the ayanamsa used for sidereal calculation.
Why timezone and ayanamsa matter
The most common integration bug is a wrong timezone offset, which shifts the Ascendant and can move Mars across a house boundary. Always send an explicit IANA timezone and a precise birth time. Vedika uses sidereal (Lahiri-family) positions for Vedic computations, so the house Mars occupies is consistent with how a Jyotish practitioner would read the same chart.
Detecting Mangal Dosha with one query
The fastest path is the natural-language query endpoint. You send the birth details and a question, and Vedika AI returns a grounded answer that already incorporates the house placement and cancellation logic.
curl -X POST https://api.vedika.io/api/v1/astrology/query \
-H "x-api-key: vk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"question": "Is this chart Manglik, and do any cancellation rules apply?",
"birthDetails": {
"datetime": "1992-04-18T22:15:00",
"latitude": 28.6139,
"longitude": 77.2090,
"timezone": "Asia/Kolkata"
}
}'
For interactive UIs, stream the same request from /api/v1/astrology/query/stream over Server-Sent Events so the explanation renders token by token. If you only need a low-latency yes/no with a short justification, add "speed": "fast" to route through Vedika Swift.
Reading the response
The query response gives you the natural-language verdict plus the computed facts behind it. Because every astrological fact is computed in code before the language layer ever sees it, the house Mars sits in and the dosha flag are deterministic — re-running the same birth details returns the same placement.
Computing the chart yourself with the V2 endpoints
If you want the raw numbers — Mars's house, sign, and longitude — so your own service applies the dosha rule, call the V2 computation layer. These endpoints take flat parameters and return structured chart data without an interpretive layer.
import requests
BASE = "https://api.vedika.io"
HEADERS = {"x-api-key": "vk_live_xxx", "Content-Type": "application/json"}
birth = {
"datetime": "1992-04-18T22:15:00",
"latitude": 28.6139,
"longitude": 77.2090,
"timezone": "Asia/Kolkata",
}
# Pull the Vedic (sidereal) chart and locate Mars
chart = requests.post(f"{BASE}/v2/astrology/chart",
json=birth, headers=HEADERS).json()
MANGLIK_HOUSES = {1, 4, 7, 8, 12}
mars = next(p for p in chart["planets"] if p["name"] == "Mars")
is_manglik_from_lagna = mars["house"] in MANGLIK_HOUSES
print(f"Mars house (from Lagna): {mars['house']}")
print(f"Mars sign: {mars['sign']} longitude: {mars['longitude']:.2f}")
print(f"Manglik (from Ascendant): {is_manglik_from_lagna}")
A complete Manglik check also counts Mars from the Moon and, in some lineages, from Venus. Compute the house of Mars relative to each reference point and treat the chart as afflicted if Mars lands in 1/4/7/8/12 from any of them — then weigh that against the cancellations below.
Applying cancellation (bhanga) rules
A raw house flag is not a final verdict. Classical and matrimonial sources describe conditions that neutralise the dosha. A defensible implementation checks at least these:
- Dignity of Mars — Mars in its own sign (Aries, Scorpio) or exalted (Capricorn) is widely held to soften or cancel the affliction.
- Sign-based exceptions — several matching traditions treat the dosha as inactive when Mars occupies specific signs in the relevant houses.
- Mutual dosha — when both partners' charts carry Mangal Dosha, matrimonial practice commonly treats them as cancelling each other.
- Aspect and conjunction — benefic aspects on Mars, or Mars with certain planets, are cited as mitigating factors.
Vedika's marriage-matching and report endpoints already encode these checks; when you ask the query endpoint a Manglik question for two charts, the cancellation logic is applied rather than a bare house count. If you compute charts yourself, keep your bhanga rules attributable to a real source rather than a paraphrase, in line with how the platform grounds its own citations.
Manglik in marriage matching
Mangal Dosha rarely matters in isolation — it surfaces inside compatibility (Kundli Milan) checks. The typical flow is: compute both charts, detect the dosha on each, apply mutual cancellation, then fold the result into the broader Ashtakoota (Guna Milan) scoring. You can drive the whole sequence through the query endpoint by passing both birth details and asking a matching question, or assemble it from the V2 chart calls plus your own scoring.
| Step | Endpoint | Output |
|---|---|---|
| Compute each chart | /v2/astrology/chart | Planet houses, signs, longitudes |
| Manglik verdict + cancellation | /api/v1/astrology/query | Grounded yes/no with reasoning |
| Streamed explanation for UI | /api/v1/astrology/query/stream | SSE token stream |
Three systems, one chart of truth
The same birth details can be read in Vedic (sidereal), Western (tropical), and KP from a single API. Mangal Dosha is a Vedic concept, so detection runs on the sidereal chart, but having all three systems behind one key means a marriage product can show a Manglik verdict alongside a Western synastry view without integrating a second vendor.
Precision underneath the dosha rule
A dosha flag is only as trustworthy as the chart it reads. Vedika computes positions with the XALEN Ephemeris, its own open-source astronomical engine (Apache-2.0, published to crates.io, PyPI, and as a WebAssembly package, with roughly 2,200 tests). It has been validated against JPL DE440 and swetest, with no chart deviating beyond 0.1 degrees across a five-million-chart test set. That is astronomical precision for planet positions — distinct from any claim about astrological interpretation — and it is what keeps Mars on the correct side of a house cusp so the Manglik flag is stable.
Sandbox, pricing, and going live
You can prototype the entire flow without a key. The free sandbox exposes mock endpoints that mirror the production request and response shapes, so you can build and test your Manglik detection before you spend anything.
When you move to live keys, per-query cost runs roughly $0.01 to $0.05, and plans start at $12/mo (Starter), with Professional at $60, Business at $120 (adds the fast path and voice), and Enterprise at $240. For comparison, Prokerala and AstrologyAPI.com offer solid matching and Manglik tooling at their own tiers; Vedika's differentiators are the three-system coverage in one key, the open-source ephemeris you can audit, and source-attributed reasoning. See full pricing and the API docs for field-level detail, and the Kundli matching guide for the full compatibility workflow.
Key facts
- Mangal Dosha = Mars in house 1, 4, 7, 8, or 12, counted from the Ascendant and (for a full reading) the Moon.
- Detect it with one call to
POST /api/v1/astrology/query, or compute the raw chart via/v2/astrology/*and apply the rule yourself. - Always send an explicit IANA timezone — a wrong offset can move Mars across a house cusp and flip the verdict.
- Cancellation (bhanga) rules — Mars dignity, sign exceptions, and mutual dosha — must be applied before a final verdict.
- Detection runs on the sidereal Vedic chart; the same key also returns Western and KP readings.
- Positions come from the XALEN Ephemeris (Apache-2.0, ~2,200 tests, validated vs JPL DE440 and swetest within 0.1 degrees).
- Auth with
x-api-key: vk_live_*; base URLhttps://api.vedika.io; free sandbox needs no key.
FAQ
Which endpoint detects Mangal Dosha?
Use POST /api/v1/astrology/query with the birth details and a Manglik question for a grounded verdict that includes cancellation logic, or compute the chart with /v2/astrology/chart and apply the 1/4/7/8/12 house rule yourself.
Does the API apply Manglik cancellation rules?
Yes. When you ask a Manglik question through the query and matching flow, dosha bhanga conditions — Mars dignity, sign exceptions, and mutual dosha between partners — are applied rather than a bare house count.
How accurate is the Mars placement?
Planet positions are computed with the XALEN Ephemeris, validated against JPL DE440 and swetest with no chart deviating beyond 0.1 degrees across a five-million-chart test. That precision is astronomical, not a claim about interpretation, and it keeps Mars on the correct side of a house cusp.
Can I test Manglik detection for free?
Yes. The free sandbox exposes mock endpoints matching the production request and response shapes, so you can build and verify your detection logic before using a live key.