# I Ching Reading (Legge text)

`POST https://api.astroway.info/v1/iching/reading`

A full reading in Legge's public-domain translation: the primary hexagram's judgment, the text of each changing line, the resulting hexagram, and `focus`, the texts to read for that count of changing lines by Zhu Xi's rule (none: the judgment; one: that line; two: both, the upper leads; three: both judgments; four: the two unchanged lines of the resulting hexagram; five: its one unchanged line; six: the use of nines or sixes on Qian and Kun, otherwise the resulting judgment). Send your own six coin totals in `lines` (6, 7, 8, 9 bottom to top), or a `seed` (the same cast as /iching/throw-coins), or a `question` that seeds it.

Group: I Ching (Standalone). Auth: `X-Api-Key` header. Operation ID: `iching_reading`.

## 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 |
|---|---|---|---|
| `lines` | 6 \| 7 \| 8 \| 9[] | no | Six line values, bottom to top: 6 old yin (changing), 7 young yang, 8 young yin, 9 old yang (changing). Send the coins you threw yourself. |
| `seed` | number \| string | no | Reproducible cast: the same seed gives the same hexagram as /iching/throw-coins. |
| `question` | string | no | Without lines or seed, the question text seeds the cast, as /iching/by-question does. |

```json
{
  "question": "Should I take the new job?"
}
```

## Responses

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

### Success fields, under `data`

| Field | Type | Required | Description |
|---|---|---|---|
| `question` | string | no |  |
| `seed` | number | no |  |
| `method` | string | no |  |
| `lines` | object[] | no |  |
| `primary` | object | no |  |
| `primary.number` | number | no |  |
| `primary.name` | string | no |  |
| `primary.pinyin` | string | no |  |
| `primary.legge` | string | no |  |
| `primary.chinese` | string | no |  |
| `primary.lines` | number[] | no |  |
| `primary.lowerTrigram` | number | no |  |
| `primary.upperTrigram` | number | no |  |
| `primary.judgment` | string | no |  |
| `changingLines` | object[] | no |  |
| `resulting` | object | no |  |
| `resulting.number` | number | no |  |
| `resulting.name` | string | no |  |
| `resulting.pinyin` | string | no |  |
| `resulting.legge` | string | no |  |
| `resulting.chinese` | string | no |  |
| `resulting.lines` | number[] | no |  |
| `resulting.lowerTrigram` | number | no |  |
| `resulting.upperTrigram` | number | no |  |
| `resulting.judgment` | string | no |  |
| `focus` | object | no |  |
| `focus.rule` | string | no |  |
| `focus.texts` | object[] | no |  |
| `source` | string | no |  |
| `readingRuleSource` | string | no |  |

## Example

```bash
curl -X POST https://api.astroway.info/v1/iching/reading \
  -H "X-Api-Key: aw_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "question": "Should I take the new job?" }'
```

---

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