The test
POST /v1/dosha/kaal-sarp (Hobby plan) takes the plain birth body. The engine measures each of the seven planets - Sun, Moon, Mars, Mercury, Jupiter, Venus, Saturn - forward from Rahu in sidereal longitude, from 0° to 360°. Ketu is always at 180°. The dosha is present when every planet lies strictly between 0° and 180° (between Rahu and Ketu going forward through the zodiac) or every planet lies strictly between 180° and 360°.
- Both sides count, and both get the same names. Some texts call the Ketu-to-Rahu side by a separate name; the API does not distinguish them.
- The ascendant is not tested. Only the seven planets are.
- Rahu is the mean node, and longitudes are Lahiri sidereal - see ayanamsa.
The sample birth has the dosha. Every offset is between 0° and 180°:
| Planet | degrees_from_rahu |
|---|---|
| Moon | 9.04 |
| Jupiter | 28.86 |
| Mars | 39.08 |
| Mercury | 89.25 |
| Sun | 112.92 |
| Venus | 116.73 |
| Saturn | 156.52 |
The response is present: true, partial: false, type: "Shankhpal", house_of_rahu: 4, house_of_ketu: 10, plus that per-planet list, which is there so you can apply your own margins or rules on top.
Twelve types, chosen by Rahu's house
The named type depends only on the house Rahu occupies, counted whole-sign from the lagna (see house systems). type is null when the dosha is absent.
| Rahu in house | Type | Rahu in house | Type |
|---|---|---|---|
| 1 | Anant | 7 | Takshak |
| 2 | Kulik | 8 | Karkotak |
| 3 | Vasuki | 9 | Shankhachood |
| 4 | Shankhpal | 10 | Ghaatak |
| 5 | Padma | 11 | Vishdhar |
| 6 | Mahapadma | 12 | Sheshnag |
Because the type hangs on the lagna, it changes with birth time even when the planets barely move. Rahu stays in Sagittarius all night of 23-24 April 1973, but a birth at 00:00 IST on the 24th returns type: "Anant", house_of_rahu: 1 and a birth at 01:00 returns "Sheshnag", house 12: the lagna moved on a sign in between. If your users' birth times are approximate, the presence of the dosha is usually stable and its name is not.
What `partial` means here
Many writers use "partial Kaal Sarp" for a chart where one planet sits outside the Rahu-Ketu arc. The API does not: one planet outside, by any amount, gives present: false. partial: true is narrower - all planets are on one side except one or more sitting on the axis itself, within 0.5° of Rahu or Ketu, on either side of it.
The Moon makes the edge easy to see, because it moves about 13° a day and so crosses Rahu within hours. Keep the sample's date and place and move the clock back:
| Birth time (IST) | Moon from Rahu | present | partial | type |
|---|---|---|---|---|
| 23 Apr, 17:25 | 357.11° | false | false | null |
| 23 Apr, 23:00 | 359.88° | true | true | Anant |
| 24 Apr, 00:00 | 0.37° | true | false | Anant |
| 24 Apr, 17:25 (sample) | 9.04° | true | false | Shankhpal |
At 23:00 the Moon is 0.12° behind Rahu and the other six planets are ahead of it: the Moon is on the axis, so the dosha is present and partial. An hour later the Moon has crossed and it is present in full; at 17:25 the day before, the Moon is 2.89° behind Rahu, well outside the tolerance, and the answer is false. (Before engine 1.4.1 the tolerance worked only at the Ketu end, and the 23:00 chart came back false.) If you want a softer band ("a planet within a degree of the axis"), compute it from planets_relative_to_rahu rather than relying on partial.
kaal_sarp.py - the planet closest to the axis
# kaal_sarp.py - python3 kaal_sarp.py (stdlib only)
import json
import os
import urllib.request
API = os.environ.get("ASTRONODE_API_URL", "https://api.astronode.dev")
KEY = os.environ["ASTRONODE_API_KEY"] # server-side only
birth = {"date": "1973-04-24", "time": "17:25:00", "tz_offset_minutes": 330,
"lat": 19.076, "lng": 72.8777}
req = urllib.request.Request(
API + "/v1/dosha/kaal-sarp",
data=json.dumps(birth).encode(),
headers={"Authorization": "Bearer " + KEY, "Content-Type": "application/json"},
)
data = json.load(urllib.request.urlopen(req))["data"]
print("present:", data["present"], "partial:", data["partial"], "type:", data["type"])
if data["present"]:
# Distance of each planet to the nearer end of the axis (Rahu at 0, Ketu at 180).
def to_axis(d):
return min(d, abs(180 - d), 360 - d)
nearest = min(data["planets_relative_to_rahu"],
key=lambda p: to_axis(p["degrees_from_rahu"]))
print("closest to the axis: %s, %.2f deg"
% (nearest["name"], to_axis(nearest["degrees_from_rahu"])))Output against the API:
present: True partial: False type: Shankhpal closest to the axis: Moon, 9.04 deg
No cancellation is applied
The Kaal Sarp response has no cancelled flag and no list of reasons. The endpoint reports the geometry and stops. That is a deliberate contrast with POST /v1/dosha/mangal, which returns cancelled and cancellation_reasons because its cancellation rules are sourced and implemented. The conditions that various writers give for Kaal Sarp being cancelled or weakened are not consistent with one another, and none is applied here.
- If your product applies a cancellation rule, apply it on your side and label it as yours - the inputs you need are in this response and in
POST /v1/charts/birth. - Do not treat
present: trueas a verdict. The interpretation block says only that the dosha is present and its type, with a disclaimer to read it alongside the rest of the chart. - The result is fixed for a birth: no date input, no transit. It is safe to compute once and store.
Questions
- How does the API decide that Kaal Sarp dosha is present?
- All seven planets from the Sun to Saturn must lie on one side of the Rahu-Ketu axis, measured in sidereal longitude. The ascendant is not tested, and a single planet outside the arc by any amount means the dosha is reported absent.
- How is the Kaal Sarp type chosen?
- By the house Rahu occupies, counted whole-sign from the lagna: Anant for the 1st house through Sheshnag for the 12th. Because it depends on the lagna, the type can change with birth time while the dosha itself stays present.
- Does the Kaal Sarp endpoint apply cancellation rules?
- No. It reports the geometry and the per-planet distances from Rahu, with no cancelled flag. If your product applies a cancellation rule, apply it on your side using those distances and the birth chart.