# Yearly Hexagram

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

A hexagram for a person and a year: the Mei Hua formula with the earthly branch of the year asked about in place of the year of asking and the lunar month, day and hour of birth. Labelled `basis: convention`: Mei Hua casts for a question, and this annual use is this API's convention. Returns the full Legge reading and ti/yong.

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

## 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 |
|---|---|---|---|
| `birthDate` | string | yes |  |
| `birthTime` | string | yes | Birth time; gives the hour term of the cast. |
| `timezoneOffset` | number | no | Hours from UTC at the birthplace; places the lunar birth day. Defaults to 8. |
| `year` | integer | yes | The year the reading is for, by its earthly branch. |

```json
{
  "birthDate": "1990-06-15",
  "birthTime": "14:20",
  "timezoneOffset": 3,
  "year": 2027
}
```

## Responses

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

### Success fields, under `data`

| Field | Type | Required | Description |
|---|---|---|---|
| `birthDate` | string | no |  |
| `year` | number | no |  |
| `lunarBirth` | object | no |  |
| `lunarBirth.month` | number | no |  |
| `lunarBirth.isLeapMonth` | boolean | no |  |
| `lunarBirth.day` | number | no |  |
| `lunarBirth.hourBranch` | string | no |  |
| `yearBranch` | string | no |  |
| `basis` | string | no |  |
| `method` | string | no |  |
| `terms` | object | no |  |
| `terms.year` | number | no |  |
| `terms.month` | number | no |  |
| `terms.day` | number | no |  |
| `terms.hour` | number | no |  |
| `terms.upperSum` | number | no |  |
| `terms.lowerSum` | number | no |  |
| `terms.upperTrigramNumber` | number | no |  |
| `terms.lowerTrigramNumber` | number | no |  |
| `terms.movingLine` | number | no |  |
| `terms.rule` | 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 |  |
| `tiYong` | object | no |  |
| `tiYong.ti` | object | no |  |
| `tiYong.yong` | object | no |  |
| `tiYong.relation` | string | no |  |
| `tiYong.verdict` | string | no |  |
| `meiHuaSource` | string | no |  |

## Example

```bash
curl -X POST https://api.astroway.info/v1/iching/yearly \
  -H "X-Api-Key: aw_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "birthDate": "1990-06-15", "birthTime": "14:20", "timezoneOffset": 3, "year": 2027 }'
```

---

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