# 타로

세 덱: Rider-Waite-Smith (78장), 마르세유 타로 (78장) 및 레노르망 (36장). 각 타로 응답의 모든 카드에는 이미지가 있으며, `POST /v1/interpret/tarot`은 스프레드를 해석으로 변환합니다: 각 위치의 맥락, 전체 스프레드의 요약 및 한 가지 조언.

## 카드 아트 선택하기
`GET /v1/tarot/decks` endpoint는 각 덱, 그 스프레드 및 전달할 수 있는 `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`을 반환하여 페이지가 inicialmente 카드를 뒷면 위로 표시할 수 있도록 합니다. 다른 덱의 `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` endpoint는 키 없이 작동하며 각 카드에 대해 세 단락(이미지, 정방향 의미, 역방향 의미)으로 구성된 `description`과 `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` endpoint는 덱, 스프레드, 카드 및 선택적 질문을 받아 `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>
