# Floor plan to verdicts

`POST https://api.astroway.info/v1/vastu/plan`

Send the outline of a house or plot, the angle to north and the rooms, fixtures and main door as points or polygons, in image pixels (or fractions with the image size) or in metres. Each room gets its bearing from the centre of the wall-aligned mandala, its 8, 16 and 32 sector, its mandala cell and deity, the share of each direction it covers, and the verdict and source /vastu/rooms gives; the door gets its pada and result. Findings come heaviest first with remedies, and the score is version 2: weighted by importance, with a band. Magnetic north needs the declination, walls on the diagonals need the facing side, and an L-shaped plan is warned about rather than averaged. The outline itself is judged too: square or modest rectangle, irregular, or turned off the directions, each with its verse. school sixteen-zone reads from the area centre and judges by 16 zones.

Group: Vastu Shastra. Auth: `X-Api-Key` header. Operation ID: `vastu_plan`.

## Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `fields` | query | no | string | Comma-separated dotted paths, relative to `data`, to keep in the response. A path is applied to every element of an array, so `planets.name` means the name of each planet. Paths that match nothing come back in `_fields_unmatched`; a list where nothing matches at all is a 400, because an empty object would be a confident wrong answer. |
| `precision` | query | no | integer | Round every non-integer number in the response to this many decimal places. Integers are left alone, because an id is not a measurement. Ecliptic longitudes ship with fourteen decimals by default; 2 is about a tenth of an arcminute. |
| `Idempotency-Key` | header | no | string | Unique per logical operation, kept across retries. For 24 hours from the first request, a repeat with the same key, method, path, body and query string returns the stored response with `Idempotent-Replayed: true` and costs 0 credits. The same key with a different body or query string is a 409 `IDEMPOTENCY_KEY_REUSED`; a repeat while the first is still running is a 409 `IDEMPOTENCY_IN_PROGRESS`. Only 2xx responses are kept. See /idempotency/. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `coords` | object | yes |  |
| `coords.system` | "image" \| "metric" | yes |  |
| `coords.width` | number | no |  |
| `coords.height` | number | no |  |
| `coords.normalized` | boolean | no |  |
| `coords.units` | "m" \| "ft" | no |  |
| `northAngle` | number | yes |  |
| `northReference` | "true" \| "magnetic" | no |  |
| `declination` | number | no |  |
| `boundary` | number[][] | yes |  |
| `rooms` | object[] | no |  |
| `items` | object[] | no |  |
| `entrance` | number[] | no |  |
| `entranceMethod` | "eight-per-side" \| "mandala-cells" | no |  |
| `facing` | "E" \| "S" \| "W" \| "N" | no |  |
| `school` | "brihat-samhita" \| "mayamata" \| "sixteen-zone" | no |  |
| `scoreVersion` | 1 \| 2 | no |  |

```json
{
  "coords": {
    "system": "metric",
    "units": "m"
  },
  "northAngle": 0,
  "boundary": [
    [
      0,
      0
    ],
    [
      12,
      0
    ],
    [
      12,
      9
    ],
    [
      0,
      9
    ]
  ],
  "rooms": [
    {
      "type": "kitchen",
      "polygon": [
        [
          8,
          0
        ],
        [
          12,
          0
        ],
        [
          12,
          3
        ],
        [
          8,
          3
        ]
      ]
    },
    {
      "type": "master-bedroom",
      "polygon": [
        [
          0,
          0
        ],
        [
          4,
          0
        ],
        [
          4,
          4
        ],
        [
          0,
          4
        ]
      ]
    }
  ],
  "items": [
    {
      "type": "toilet",
      "point": [
        11,
        8
      ]
    }
  ],
  "entrance": [
    12,
    6
  ]
}
```

## Responses

| Status | Meaning |
|---|---|
| 200 | Successful calculation |
| 400 | Validation error |
| 401 | Missing or invalid API key |

### Success fields, under `data`

| Field | Type | Required | Description |
|---|---|---|---|
| `language` | string | no |  |
| `requestedLanguage` | string | no |  |
| `school` | string | no |  |
| `coords` | object | no |  |
| `coords.system` | string | no |  |
| `coords.units` | string | no |  |
| `north` | object | no |  |
| `north.northAngle` | number | no |  |
| `north.northReference` | string | no |  |
| `north.declination` | object | no |  |
| `north.trueNorthAngle` | number | no |  |
| `centres` | object | no |  |
| `centres.grid` | object | no |  |
| `centres.area` | object | no |  |
| `mandala` | object | no |  |
| `mandala.wallAngle` | number | no |  |
| `mandala.sides` | object | no |  |
| `mandala.orientation` | string | no |  |
| `brahmasthan` | object | no |  |
| `brahmasthan.from` | string | no |  |
| `brahmasthan.cells` | number[][] | no |  |
| `shape` | object | no |  |
| `shape.rectangular` | boolean | no |  |
| `shape.fill` | number | no |  |
| `shape.proportion` | object | no |  |
| `shape.offsetFromCardinal` | number | no |  |
| `shape.findings` | object[] | no |  |
| `cells` | object[] | no |  |
| `rooms` | object[] | no |  |
| `items` | object[] | no |  |
| `entrance` | object | no |  |
| `entrance.side` | string | no |  |
| `entrance.position` | number | no |  |
| `entrance.pada` | string | no |  |
| `entrance.devata` | string | no |  |
| `entrance.devataMayamata` | string | no |  |
| `entrance.effect` | string | no |  |
| `entrance.verdict` | string | no |  |
| `entrance.source` | string | no |  |
| `entrance.edgeDistance` | number | no |  |
| `entrance.method` | string | no |  |
| `entrance.at` | object | no |  |
| `entrance.wallFraction` | number | no |  |
| `entrance.from` | string | no |  |
| `entrance.bearing` | number | no |  |
| `entrance.sector32` | object | no |  |
| `findings` | object[] | no |  |
| `scoreVersion` | number | no |  |
| `score` | number | no |  |
| `band` | string | no |  |
| `scoring` | object | no |  |
| `scoring.points` | object | no |  |
| `scoring.weights` | object | no |  |
| `scoring.importance` | object | no |  |
| `scoring.bands` | object[] | no |  |
| `scoring.formula` | string | no |  |
| `warnings` | object[] | no |  |
| `notes` | string[] | no |  |

## Example

```bash
curl -X POST https://api.astroway.info/v1/vastu/plan \
  -H "X-Api-Key: aw_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "coords": { "system": "metric", "units": "m" }, "northAngle": 0, "boundary": [ [ 0, 0 ], [ 12, 0 ], [ 12, 9 ], [ 0, 9 ] ], "rooms": [ { "type": "kitchen", "polygon": [ [ 8, 0 ], [ 12, 0 ], [ 12, 3 ], [ 8, 3 ] ] }, { "type": "master-bedroom", "polygon": [ [ 0, 0 ], [ 4, 0 ], [ 4, 4 ], [ 0, 4 ] ] } ], "items": [ { "type": "toilet", "point": [ 11, 8 ] } ], "entrance": [ 12, 6 ] }'
```

---

Rendered from https://api.astroway.info/v1/openapi.json. HTML page: https://api.astroway.info/docs/api/operations/vastu_plan/
