Developer GuideNovember 202610 min read

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
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:

JavaScript
// 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) }))

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
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"
  }'
JavaScript (server side)
// 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 },
  }
}
Python
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

Add a short disclosure to every report: the findings come from traditional Vastu texts and common practice, depend on the coordinates entered, and are not predictions or professional architectural, structural or legal advice.

Step 6: cache, quotas and errors

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

Vastu Shastra API overviewEach response field explained.Griha pravesh date finderScan dates with the muhurta endpoint.Vastu consultation workflowHow practitioners use the same calls.

Get a free key and run your first plan/analyze call in a few minutes.

Get a free API keyVastu API reference