Build a Vastu Floor-Plan Checker with the API
This guide walks through a small, honest Vastu checker: the user uploads or draws a plan, labels the rooms, marks the main door and North, and gets back which zone each room is in plus the traditional findings with their sources. It uses one endpoint, POST /api/v1/vastu/plan/analyze, and works on every plan, including the Free trial.
Step 1: get a key and test it
Sign up for a free key, then call the versions endpoint. It is a cheap way to check that the key works, and its values double as cache keys later.
curl "https://vedintelastroapi.com/api/v1/vastu/versions?api_key=YOUR_API_KEY"
{ "status": 200, "response": {
"geometry_engine_version": "1.0.0",
"vastu_rules_version": "1.0.0",
"astro_vastu_rules_version": "0.0.0",
"api_version": "v1" } }Keep the key on your server. POST endpoints accept the X-API-Key header, ?api_key= or api_key in the JSON body. GET endpoints accept the header or the query parameter.
Step 2: turn the drawing into coordinates
The API wants {x, y} points where +X is the right of the plan and +Y is the top, in any consistent unit. Most screens, SVG and many CAD exports put the origin at the top-left with y growing downwards, so flip y before you send it:
// Canvas / SVG / most CAD exports: origin top-left, y grows DOWN.
// The Vastu API: +X = East (plan right), +Y = plan up. Flip y before sending.
const H = drawingHeightInUnits
const toApi = (p) => ({ x: p.x, y: H - p.y })
const plot = outline.map(toApi)
const rooms = roomShapes.map(r => ({ name: r.label, polygon: r.points.map(toApi) }))- Use the same origin and unit for the plot and for every room.
- At least 3 vertices per polygon, in order around the shape. Clockwise or counter-clockwise are both fine, and the closing vertex is optional.
- For an apartment, send the unit's own internal boundary, not the whole building. See the apartment guide.
Step 3: set north_angle and the entrance
Ask the user which way the top of their drawing faces, or let them drag a North arrow. north_angle is the True North bearing of the plan's +Y axis, clockwise: 0 if the top faces North, 90 if it faces East, 315 if it faces North-West.
Bearings you send are converted with true bearing = bearing + north_angle. So if you take the door direction from the drawing (0 = towards the top of the sheet), send it as it is. If the user typed a compass reading instead, send compass bearing − north_angle. entrance.bearing_deg must be between 0 and 360.
Step 4: call plan/analyze
curl -X POST https://vedintelastroapi.com/api/v1/vastu/plan/analyze \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"plot": [{"x":0,"y":0},{"x":20,"y":0},{"x":20,"y":10},{"x":0,"y":10}],
"rooms": [{"name":"Kitchen","polygon":[{"x":15,"y":0},{"x":20,"y":0},{"x":20,"y":3},{"x":15,"y":3}]}],
"entrance": {"bearing_deg": 45},
"north_angle": 0,
"lang": "en"
}'// Node 18+ or any modern browser backend. Keep the key on the server.
const API = 'https://vedintelastroapi.com/api/v1/vastu'
export async function analyzePlan({ plot, rooms, entranceBearing, northAngle = 0 }) {
const res = await fetch(`${API}/plan/analyze`, {
method: 'POST',
headers: { 'X-API-Key': process.env.VEDINTEL_API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
plot, // [{x, y}, ...] at least 3 vertices
rooms, // [{name, polygon: [{x, y}, ...]}]
entrance: { bearing_deg: entranceBearing },
north_angle: northAngle, // True North bearing of your plan's +Y axis
lang: 'en',
}),
})
const json = await res.json()
if (json.status !== 200) {
// 400 INVALID_INPUT carries the failing field, e.g. "rooms.0.polygon"
throw new Error(`${json.error} (${json.field ?? '-'}): ${json.message}`)
}
const { calculation, rule_evaluation, metadata } = json.response
return {
rooms: calculation.rooms, // [{name, zone_8, centroid, bearing_from_plot_centre_deg}]
zones: calculation.zones, // 8 entries with area and area_pct
brahmasthan: calculation.brahmasthan, // is_obstructed, is_fully_in_plot, room_obstructions
entrance: calculation.entrance, // direction_8, deity, labels
findings: rule_evaluation.findings,
counts: {
positive: rule_evaluation.positive_count,
negative: rule_evaluation.negative_count,
critical: rule_evaluation.critical_count,
informational: rule_evaluation.informational_count,
},
versions: { geometry: metadata.geometry_engine_version, rules: metadata.vastu_rules_version },
}
}import os, requests
API = "https://vedintelastroapi.com/api/v1/vastu"
HEADERS = {"X-API-Key": os.environ["VEDINTEL_API_KEY"], "Content-Type": "application/json"}
body = {
"plot": [{"x": 0, "y": 0}, {"x": 20, "y": 0}, {"x": 20, "y": 10}, {"x": 0, "y": 10}],
"rooms": [{"name": "Kitchen", "polygon": [{"x": 15, "y": 0}, {"x": 20, "y": 0},
{"x": 20, "y": 3}, {"x": 15, "y": 3}]}],
"entrance": {"bearing_deg": 45},
"north_angle": 0,
}
r = requests.post(f"{API}/plan/analyze", json=body, headers=HEADERS, timeout=30)
data = r.json()
if data["status"] != 200:
raise SystemExit(f'{data["error"]} ({data.get("field")}): {data["message"]}')
resp = data["response"]
for room in resp["calculation"]["rooms"]:
print(room["name"], "->", room["zone_8"])
for f in resp["rule_evaluation"]["findings"]:
print(f["outcome"], f["rule_id"], "| confidence:", f["interpretive_confidence"],
"| source:", f["source_verification_status"])Step 5: show the results
- Rooms: one row per room with its
zone_8. Group findings bysubjectso each room shows its own rules. - Zones: draw the eight
zonespolygons or list them witharea_pct. On a rectangle the East and West wedges are naturally bigger than North and South, so show the percentages. With a non-zero north_angle, returned coordinates are in the rotated, north-up frame, so draw them in a north-up view. - Centre: show
brahmasthan.is_obstructedand, for irregular plots, theirregularity_warning. When the centre cell is not fully inside the plot the API gives an informational finding, not a verdict. - Findings: show
outcome,severity,interpretive_confidenceandsource_verification_statusnext to eachtrigger. A moderate, consensus-only finding should not look as firm as a high-confidence classical one. - Counts:
positive_count,negative_count,critical_countandinformational_countmake a fair summary line. Avoid inventing a single score the API does not produce.
Step 6: cache, quotas and errors
- Results are deterministic. Cache on a hash of the request body plus
geometry_engine_versionandvastu_rules_version, and refresh when/vastu/versionschanges. - Every call counts against your plan's quota and rate limit. Each response includes
remaining_api_calls. - 400
INVALID_INPUTresponses name the failingfield(for examplerooms.0.polygonorentrance). 401 means the key is missing or invalid. - Debounce re-analysis while the user is dragging vertices. One call when they stop is enough.
Where to go next
Use /vastu/mandala if you want to draw all 81 padas, /vastu/findings for quick what-if tests without geometry, and /vastu/muhurta to suggest a griha pravesh date. The Vastu API reference lists every field, and GET /api/v1/vastu/methodology documents every convention.
Related
Get a free key and run your first plan/analyze call in a few minutes.