# タロット

3つのデッキ: Rider-Waite-Smith（78枚）、マルセイユタロット（78枚）、レノルマン（36枚）。各タロットレスポンスの各カードには画像があり、`POST /v1/interpret/tarot` はスプレッドを解釈に変換します：各位置の文脈、スプレッド全体のサマリー、そして1つのアドバイス。

## オベリテ オファルマニエ カルト

`GET /v1/tarot/decks` は各デッキ、そのスプレッド、および任意のタロットルートに `art` として渡せるアートセットを返します（POST 本文または GET の `?art=`）。すべてのセットはパブリックドメインで、私たちの CDN から提供されます。

| デッキ | `art` | 枚数 |
|---|---|---|
| Rider-Waite-Smith | `rws-1909` (デフォルト), `rws-restored`, `rws-vector` | 78 |
| マルセイユタロット | `arnoult-1748` | 78 |
| レノルマン | `dondorf` | 36枚中35枚、月を除く |

各カードは `urlSmall` (幅300px、ページ上では約150pxのカード)、`url` (幅600px)、`url2x` (幅1200px)、`width`、`height`、`art` を持つ `image` を取得します。スプレッドはまた `back`（カードの裏）も返し、ページが最初にカードを裏向きで表示できるようにします。別のデッキの `art` は `400 INVALID_ART` と許可値のリストを返します。セットに画像がないカード（レノルマンの月）はそのセットの `missing` にリストされ、`image` なしで返されるため、それに対してテキストカードを表示してください。

<Tabs>
  <TabItem label="cURL">
    ```bash frame="terminal"
    curl -X POST https://api.astroway.info/v1/tarot/rider-waite/draw/three-card \
      -H "X-Api-Key: aw_live_your_key_here" \
      -H "Content-Type: application/json" \
      -d '{ "seed": 12345, "art": "rws-restored" }'
    ```
  </TabItem>
</Tabs>

```json
{
  "drawn": [
    {
      "position": { "index": 0, "name": "Past", "meaning": "Forces from the past shaping the situation." },
      "card": {
        "slug": "8-of-pentacles",
        "name": "Eight of Pentacles",
        "image": {
          "url": "https://cdn.astroway.info/tarot/rws-restored/8-of-pentacles.webp",
          "url2x": "https://cdn.astroway.info/tarot/rws-restored/8-of-pentacles@2x.webp",
          "urlSmall": "https://cdn.astroway.info/tarot/rws-restored/8-of-pentacles-300.webp",
          "width": 600,
          "height": 1028,
          "art": "rws-restored"
        }
      },
      "reversed": false
    }
  ],
  "back": { "url": "https://cdn.astroway.info/tarot/rws-1909/back.webp", "url2x": "https://cdn.astroway.info/tarot/rws-1909/back@2x.webp", "urlSmall": "https://cdn.astroway.info/tarot/rws-1909/back-300.webp", "width": 600, "height": 1039, "art": "rws-1909" }
}
```

スプレッド `POST /v1/tarot/rider-waite/draw/three-card` のコストは **10 クレジット** 。

## テキスト カード モデル なし

`GET /v1/public/tarot/texts?cards=the-fool,9-of-swords&lang=uk` はキー不要で動作し、各カードに対して `description`（画像、正位置の意味、逆位置の意味の3段落）と、`love`、`career`、`finance`、`health`、`spirit` の `upright` と `reversed` 用テキスト、さらにローカライズされた名前 `name` と各側に最大5つの `keywords` を返します。`cards` を指定しないと全78枚が返されます。テキストは変更されないので、ページが表示するカードをロードし、キャッシュしてください。

```bash
curl 'https://api.astroway.info/v1/public/tarot/texts?cards=the-fool,9-of-swords&lang=uk'
```

## スプレッド全体の解釈

`POST /v1/interpret/tarot` はデッキ、スプレッド、カード、およびオプションの質問を受け取り、`language`（21言語）で解釈を書きます。カードは `{ "slug", "reversed" }` 形式のオブジェクト、またはスプレッドレスポンスの `drawn` 配列から変更せずに渡すことができます。

<Tabs>
  <TabItem label="Node.js">
    ```js
    const headers = { 'Content-Type': 'application/json', 'X-Api-Key': process.env.ASTROWAY_API_KEY };
    const api = (path, body) =>
      fetch(`https://api.astroway.info/v1${path}`, { method: 'POST', headers, body: JSON.stringify(body) }).then((r) => r.json());
    
    const { data: spread } = await api('/tarot/rider-waite/draw/three-card', { art: 'rws-1909' });
    const { data: reading } = await api('/interpret/tarot', {
      spread: 'three-card',
      question: 'What should I focus on at work?',
      cards: spread.drawn,
      language: 'en',
    });
    
    for (const p of reading.positions) {
      console.log(p.position, p.card.name, p.reversed ? '(reversed)' : '', p.card.image.url);
      console.log(' ', p.reading);
    }
    console.log('Summary:', reading.synthesis);
    ```
  </TabItem>
</Tabs>

レスポンスには `positions[]`（位置、`image` を持つカード、`reversed`、`reading`）、`synthesis`、`advice`、`disclaimer` が含まれます。Rider-Waite-Smith のカードはまた、`nameLocalized` と `positionLocalized`（解釈の言語）も持ちます。解釈のコストは **100 クレジット** (Tier 4) で、Free プランでも利用可能です；独自のモデルキーを使うと安くなります。詳しくは [モデルキーの取得](/agent-setup/) を参照してください。

<Aside type="note">
解釈は、各カードの位置における伝統的な意味に基づいて生成されたテキストです。API はカード、その向き、および位置をあなたのリクエストに結びつけ、カードをスキップする解釈を破棄しますが、テキストは予測ではなく考察のきっかけとして扱ってください。
</Aside>
