Inputs
| Field | Type | Notes |
|---|---|---|
horary_number | integer 1-249 | 108.5 and 250 are 400s. Decides the Lagna on its own. Unknown fields are rejected too (the body is strict). |
question_at | ISO 8601 timestamp | ISO 8601 only. Optional, but always send it, with an offset: without one it is read as UTC; omitted means "now" on the server. |
There is no location field: the Lagna comes from the number and the houses are equal 30° divisions from it. POST /v1/kp/horary is a Pro endpoint; the other KP endpoints (birth-chart based) are on Hobby.
Node: cast and read the cusps
// horary.mjs - Node 18+, server-side. /v1/kp/horary needs the Pro plan.
const API = "https://api.astronode.dev";
// Record WHEN the question was asked, with the asker's UTC offset.
// Without an offset the API reads it as UTC, which is rarely what the user meant.
const askedAt = "2026-12-01T10:30:00+05:30";
const horaryNumber = 108; // the querent's pick, 1-249
const res = await fetch(`${API}/v1/kp/horary`, {
method: "POST",
headers: { authorization: `Bearer ${process.env.ASTRONODE_API_KEY}`, "content-type": "application/json" },
body: JSON.stringify({ horary_number: horaryNumber, question_at: askedAt }),
});
const body = await res.json();
if (res.status === 403) {
// PLAN_REQUIRED: not billed; details.upgrade_url points at the dashboard.
console.log(body.error.code, body.error.details.required_tier, body.error.details.upgrade_url);
} else {
const { question_utc, ascendant, cusps, planets } = body.data;
console.log(question_utc, `Lagna ${ascendant.sign} ${ascendant.longitude.toFixed(2)}`, body.data.meta);
// The answer to a KP question is read from the cuspal sub-lord of the house
// that governs it - for example the 7th for partnership, 10th for career.
for (const house of [1, 7, 10, 11]) {
const r = cusps[house - 1].resolution;
console.log(`cusp ${house}: ${r.sign} / star ${r.star_lord} / sub ${r.sub_lord}`);
}
const moon = planets.find((p) => p.name === "Moon");
console.log(`Moon ${moon.sign} ${moon.nakshatra} - star ${moon.star_lord}, sub ${moon.sub_lord}`);
}Pro key, then a Starter key:
$ node horary.mjs # Pro key
2026-12-01T05:00:00.000Z Lagna Virgo 153.00 {
tradition: 'kp/krishnamurti-horary',
ayanamsa: 'kp_newcomb',
house_system: 'equal'
}
cusp 1: Virgo / star Sun / sub Saturn
cusp 7: Pisces / star Jupiter / sub Rahu
cusp 10: Gemini / star Mars / sub Venus
cusp 11: Cancer / star Jupiter / sub Rahu
Moon Leo Purva Phalguni - star Venus, sub Venus
$ node horary.mjs # Starter key
PLAN_REQUIRED pro /dashboard/billing/plansEach cusp carries a full KP resolution - sign, nakshatra, pada, and the sign, star, sub and sub-sub lords. Which house to read for which question (the 7th for partnership, the 10th for career, the 11th for gains) is the reader's convention, not the API's; build that table into your app so the screen can highlight the right cusp.
Python: what the number controls
Two calls with the same number two hours apart make the division of labour visible: the Lagna does not move, the Moon does.
# horary_check.py - Python 3.9+, standard library only.
import json, os, urllib.request
API = "https://api.astronode.dev"
KEY = os.environ["ASTRONODE_API_KEY"]
def horary(number, asked_at):
req = urllib.request.Request(
API + "/v1/kp/horary",
data=json.dumps({"horary_number": number, "question_at": asked_at}).encode(),
headers={"Authorization": "Bearer " + KEY, "Content-Type": "application/json"},
)
return json.load(urllib.request.urlopen(req))["data"]
# Same number, two hours apart: the Lagna is fixed by the number, the planets move.
for asked_at in ["2026-12-01T10:30:00+05:30", "2026-12-01T12:30:00+05:30"]:
d = horary(108, asked_at)
moon = next(p for p in d["planets"] if p["name"] == "Moon")
print(d["question_utc"], "Lagna", round(d["ascendant"]["longitude"], 2),
"| Moon", round(moon["longitude"], 2), moon["nakshatra"], "sub", moon["sub_lord"])$ python3 horary_check.py 2026-12-01T05:00:00.000Z Lagna 153 | Moon 134.27 Purva Phalguni sub Venus 2026-12-01T07:00:00.000Z Lagna 153 | Moon 135.4 Purva Phalguni sub Venus
The timestamp traps
- Record the moment when the question is submitted, in the client, with its UTC offset (
2026-12-01T10:30:00+05:30). A server-side "now" is the moment your queue processed it. - Never send a timestamp without an offset.
2026-12-01T10:30:00is read as 10:30 UTC - for a user in India that is a chart cast five and a half hours late, with no error to warn you. Anything that is not ISO 8601 ("tomorrow") is a400 VALIDATION_ERROR, not billed. - Omitting `question_at` breaks idempotency. Each retry is cast for a later moment, so the planets differ between attempts. With an explicit timestamp, retries - and an
Idempotency-Key- return the same chart. - Number-to-Lagna mapping. The engine uses Krishnamurti's 249-entry table: the 243 star-sub divisions, with the subs that straddle a sign boundary split in two, so every number from 1 to 249 gives its own Lagna (number 1 is 0° Aries, 108 is 153° Virgo, 249 is 357.89° Pisces). Show the returned
ascendantrather than a precomputed one.
A Starter or Hobby key gets 403 PLAN_REQUIRED with details.required_tier: "pro" and upgrade_url. It is not billed; stop on it rather than retrying.
Questions
- What do I end up with?
- A horary chart for a recorded question: Lagna, 12 cusps with star and sub-lords, and the planets at that moment. The code is in Node.js and Python.
- Which endpoints does this recipe call, and in what order?
- 1 endpoint, in this order: KP Horary (Prashna 1-249) (
POST /v1/kp/horary).