# Trigram Analysis

`POST https://api.astroway.info/v1/iching/trigram-analysis`

For a hexagram (number or lines): both trigrams in full, the image (upper over lower), the five-phase relation of upper to lower, the nuclear trigrams and nuclear hexagram (lines 2-4 and 3-5), the inverse (turned over) and the complement (every line changed).

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

## 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 |
|---|---|---|---|
| `hexagram` | integer | no | King Wen number. |
| `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. |

```json
{
  "hexagram": 63
}
```

## Responses

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

### Success fields, under `data`

| Field | Type | Required | Description |
|---|---|---|---|
| `hexagram` | object | no |  |
| `hexagram.number` | number | no |  |
| `hexagram.name` | string | no |  |
| `hexagram.pinyin` | string | no |  |
| `hexagram.legge` | string | no |  |
| `hexagram.chinese` | string | no |  |
| `hexagram.lines` | number[] | no |  |
| `hexagram.lowerTrigram` | number | no |  |
| `hexagram.upperTrigram` | number | no |  |
| `hexagram.judgment` | string | no |  |
| `lowerTrigram` | object | no |  |
| `lowerTrigram.index` | number | no |  |
| `lowerTrigram.name` | string | no |  |
| `lowerTrigram.symbol` | string | no |  |
| `lowerTrigram.lines` | number[] | no |  |
| `lowerTrigram.pinyin` | string | no |  |
| `lowerTrigram.chinese` | string | no |  |
| `lowerTrigram.image` | string | no |  |
| `lowerTrigram.attribute` | string | no |  |
| `lowerTrigram.family` | string | no |  |
| `lowerTrigram.animal` | string | no |  |
| `lowerTrigram.bodyPart` | string | no |  |
| `lowerTrigram.earlierHeaven` | object | no |  |
| `lowerTrigram.laterHeaven` | object | no |  |
| `lowerTrigram.phase` | string | no |  |
| `upperTrigram` | object | no |  |
| `upperTrigram.index` | number | no |  |
| `upperTrigram.name` | string | no |  |
| `upperTrigram.symbol` | string | no |  |
| `upperTrigram.lines` | number[] | no |  |
| `upperTrigram.pinyin` | string | no |  |
| `upperTrigram.chinese` | string | no |  |
| `upperTrigram.image` | string | no |  |
| `upperTrigram.attribute` | string | no |  |
| `upperTrigram.family` | string | no |  |
| `upperTrigram.animal` | string | no |  |
| `upperTrigram.bodyPart` | string | no |  |
| `upperTrigram.earlierHeaven` | object | no |  |
| `upperTrigram.laterHeaven` | object | no |  |
| `upperTrigram.phase` | string | no |  |
| `image` | string | no |  |
| `phases` | object | no |  |
| `phases.upper` | string | no |  |
| `phases.lower` | string | no |  |
| `phases.upperToLower` | string | no |  |
| `nuclear` | object | no |  |
| `nuclear.lowerTrigram` | object | no |  |
| `nuclear.upperTrigram` | object | no |  |
| `nuclear.hexagram` | number | no |  |
| `nuclear.rule` | string | no |  |
| `inverse` | object | no |  |
| `inverse.hexagram` | number | no |  |
| `inverse.rule` | string | no |  |
| `inverse.symmetric` | boolean | no |  |
| `complement` | object | no |  |
| `complement.hexagram` | number | no |  |
| `complement.rule` | string | no |  |
| `source` | string | no |  |

## Example

```bash
curl -X POST https://api.astroway.info/v1/iching/trigram-analysis \
  -H "X-Api-Key: aw_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "hexagram": 63 }'
```

---

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