← Back to PixelAPI · All docs · Blog

Vastu Compliance API NEW

Score any floor plan against 21 traditional Vastu Shastra rules. Get a per-rule report and an AutoCAD-openable DXF on the same call.

Free during beta. The engine is pure CPU rules — no GPU credits used. Rate-limited 30 requests / minute / IP, plenty for a real architect's working session.

What you submit

A structured floor plan as JSON. All distances in feet. Coordinate origin is the south-west corner of the plot; +x goes east and +y goes north. Each room is an axis-aligned rectangle described by its SW corner plus width and height.

FieldTypeRequiredNotes
facingstringyesOne of north, north-east, east, south-east, south, south-west, west, north-west (long form, short form, and capitalisation are all accepted).
plot.width_ftnumberyesPlot width (east-west extent).
plot.depth_ftnumberyesPlot depth (north-south extent).
rooms[]arraynoEach room is {name, x, y, w, h}. name is normalised to lower_snake_case, so "Master Bedroom" and "master_bedroom" are equivalent.
main_entrance{x, y}noPoint on the plot perimeter where the main door is.
features{key: {x, y}}noOptional point markers. Recognised keys: water_tank, well, septic_tank.

Recognised room names (each one has at least one rule attached): kitchen, dining_room, living_room, drawing_room, master_bedroom, bedroom, children_bedroom, guest_room, bathroom, toilet, pooja_room, prayer_room, study, office, home_office, storage, store_room, garage, staircase. Any other name is accepted but won't trigger zone-specific rules (it'll still count toward the centre-occlusion check).


POST/v1/vastu/analyze

Run the rules engine on a layout. Returns a 0–100 score plus per-rule findings.

Request

curl -X POST https://api.pixelapi.dev/v1/vastu/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "facing": "north",
    "plot": {"width_ft": 40, "depth_ft": 60},
    "rooms": [
      {"name": "kitchen",        "x": 30, "y": 3,  "w": 8,  "h": 12},
      {"name": "master_bedroom", "x": 2,  "y": 3,  "w": 13, "h": 12},
      {"name": "toilet",         "x": 16, "y": 3,  "w": 6,  "h": 6},
      {"name": "pooja_room",     "x": 34, "y": 55, "w": 6,  "h": 5},
      {"name": "living_room",    "x": 18, "y": 40, "w": 18, "h": 15}
    ],
    "main_entrance": {"x": 20, "y": 58},
    "features": {"water_tank": {"x": 36, "y": 56}}
  }'

Response

{
  "score": 100.0,
  "bucket": "excellent",
  "summary": "Strong Vastu alignment overall.",
  "rule_counts": {"pass": 14, "fail": 0, "warning": 0, "na": 7},
  "findings": [
    {
      "rule_id": "kitchen_se",
      "name": "Kitchen in Southeast (Agneya)",
      "status": "pass",
      "severity": "high",
      "detail": "Kitchen is in SE — ideal Agneya placement (fire element).",
      "suggestion": ""
    },
    {
      "rule_id": "kitchen_not_ne",
      "name": "Kitchen NOT in Northeast",
      "status": "pass",
      "severity": "critical",
      "detail": "Kitchen is in SE, not NE — good.",
      "suggestion": ""
    }
    // ... 19 more findings
  ]
}
FieldDescription
score0–100. Severity-weighted: critical=5, high=3, medium=2, low=1. pass earns full weight, warning half, fail zero. na rules don't count toward the denominator.
bucketOne of excellent (≥85), good (≥70), fair (≥50), poor (<50).
summaryOne-sentence human-readable interpretation.
rule_countsHow many rules ended in each status.
findings[]One entry per rule. status is pass/warning/fail/na. suggestion is filled with a concrete fix when the rule fails or warns.

Errors

CodeMeaning
400Invalid layout — message includes the specific field. e.g. {"detail":"Invalid layout: unknown direction: 'upward'"}
422Schema mismatch — Pydantic-level error before reaching the engine.
429Rate limit (30/min/IP). Retry in < 60s.

POST/v1/vastu/export-dxf

Same input as /analyze. Returns the layout as an AutoCAD-openable DXF file (R2010, decimal feet).

curl -X POST https://api.pixelapi.dev/v1/vastu/export-dxf \
  -H "Content-Type: application/json" \
  -d @my-layout.json \
  -o my-layout.dxf

Response headers:

HTTP/2 200
content-type: application/dxf
content-disposition: attachment; filename="vastu-layout.dxf"

The DXF carries these layers (toggle them in AutoCAD's Layer Manager):

Units are decimal feet ($INSUNITS=2). The file ID's as AutoCAD Drawing Exchange Format, version 2010 on the file command and opens cleanly in AutoCAD, DraftSight, LibreCAD, BricsCAD, and other DXF-compatible tools.


GET/v1/vastu/rules

List every rule the engine evaluates. Useful for client UIs that want to render a checklist before submission.

curl https://api.pixelapi.dev/v1/vastu/rules
{
  "count": 21,
  "rules": [
    {"rule_id": "kitchen_se",         "name": "Kitchen in Southeast (Agneya)",         "severity": "high"},
    {"rule_id": "kitchen_not_ne",     "name": "Kitchen NOT in Northeast",              "severity": "critical"},
    {"rule_id": "master_bedroom_sw",  "name": "Master bedroom in Southwest (Nairutya)", "severity": "high"},
    {"rule_id": "pooja_ne",           "name": "Pooja/prayer room in Northeast",        "severity": "critical"}
    // ... 17 more
  ]
}

Python example

import requests, json

payload = {
    "facing": "north",
    "plot": {"width_ft": 40, "depth_ft": 60},
    "rooms": [
        {"name": "kitchen",        "x": 30, "y": 3,  "w": 8,  "h": 12},
        {"name": "master_bedroom", "x": 2,  "y": 3,  "w": 13, "h": 12},
        {"name": "pooja_room",     "x": 34, "y": 55, "w": 6,  "h": 5},
    ],
    "main_entrance": {"x": 20, "y": 58},
}

# 1. Score
r = requests.post("https://api.pixelapi.dev/v1/vastu/analyze", json=payload)
r.raise_for_status()
result = r.json()
print(f"Score: {result['score']} ({result['bucket']})")
for f in result["findings"]:
    if f["status"] in ("fail", "warning"):
        print(f"  [{f['status']}] {f['name']}: {f['suggestion']}")

# 2. Download DXF for AutoCAD
r = requests.post("https://api.pixelapi.dev/v1/vastu/export-dxf", json=payload)
with open("my-house.dxf", "wb") as f:
    f.write(r.content)
print("Saved my-house.dxf — open in AutoCAD")

JavaScript example (browser)

const payload = { facing: "north", plot: {width_ft: 40, depth_ft: 60}, rooms: [...] };

// Analyze
const a = await fetch("https://api.pixelapi.dev/v1/vastu/analyze", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify(payload),
});
const result = await a.json();
console.log(`Score ${result.score} (${result.bucket})`);

// Download DXF
const d = await fetch("https://api.pixelapi.dev/v1/vastu/export-dxf", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify(payload),
});
const blob = await d.blob();
const url = URL.createObjectURL(blob);
Object.assign(document.createElement("a"), {href: url, download: "layout.dxf"}).click();

The 21 rules at a glance

Rule IDSeverityWhat it checks
kitchen_sehighKitchen primary zone is SE (Agneya, fire element).
kitchen_not_necriticalKitchen is NOT in NE — fire element clashes with the Ishanya water/study zone.
master_bedroom_swhighMaster bedroom in SW (Nairutya, stability).
master_bedroom_not_nehighMaster bedroom not in NE.
pooja_necriticalPooja / prayer room in NE.
toilet_not_ne_or_centercriticalNo bathroom or toilet in NE or overlapping the central Brahmasthan.
toilet_nw_w_preflowAt least one toilet in NW or W (preferred).
entrance_n_ne_ehighMain entrance lies in N, NE, or E zone.
water_nemediumWater tank or well in NE / N / E.
septic_not_nehighSeptic tank NOT in NE (and ideally NW or W).
stairs_sw_w_smediumStaircase in SW, W, or S.
center_opencriticalBrahmasthan (central 1/3 × 1/3 cell) not occupied by kitchen / toilet / master bedroom / staircase / heavy storage.
guest_room_nwlowGuest room in NW (Vayavya, transient stays).
children_bedroom_w_nwlowChildren's bedroom in W, NW, or E.
study_n_ne_elowStudy / office in N / NE / E or SW (knowledge or authority zones).
living_room_n_e_nemediumLiving / drawing room in N, E, or NE.
dining_w_elowDining room in W or E.
storage_swlowHeavy storage in SW / S / W.
garage_nw_selowGarage in NW or SE.
kitchen_not_under_or_above_poojalowKitchen wall doesn't touch the pooja-room wall.
plot_ratio_reasonablelowPlot ratio not heavily skewed (max:min ≤ 2.5).

Limitations

The engine takes structured input — a JSON description of the layout. It does not yet read a floor-plan image directly; that needs OCR plus room segmentation, which is on the roadmap. If you have a CAD file you can pull the room rectangles out programmatically and feed them in. If you have a hand sketch, you'll need to type the room boxes (or use the tutorial's small starter form).

Multi-floor buildings are modelled as one plan at a time — call the API once per floor and combine the scores yourself.

Last reviewed: 2026-05-08. Engine version 1.0 (21 rules). 46 unit tests passing on every deploy.