> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sajuapi.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 캐시 삭제

> 사용자 캐시 삭제

특정 사주에 대한 캐시된 운세 데이터를 삭제합니다. 프로필 삭제 시 또는 데이터 새로고침이 필요할 때 사용합니다.

<Note>
  이 엔드포인트는 `/v1/calculations/saju`에서 반환된 사주 객체 전체를 입력으로 받습니다.
</Note>

## 요청

<ParamField body="saju" type="object" required>
  사주 계산 API에서 반환된 사주 객체. `four_pillars`, `day_master`, `element_counts` 등을 포함합니다.

  <Expandable title="saju 객체 구조">
    사주 객체는 `/v1/calculations/saju` API의 응답 `data` 필드와 동일한 구조입니다.
    내부적으로 이 객체를 해시하여 캐시 키를 생성합니다.
  </Expandable>
</ParamField>

## 응답

```json theme={null}
{
  "success": true,
  "data": {
    "deleted_count": 12,
    "saju_hash": "a1b2c3d4e5f6"
  },
  "meta": {
    "requestId": "req_del123",
    "durationMs": 89
  }
}
```

### 응답 필드 설명

| 필드              | 설명          |
| --------------- | ----------- |
| `deleted_count` | 삭제된 캐시 키 개수 |
| `saju_hash`     | 삭제된 사주의 해시값 |

<Warning>
  캐시 삭제 후 다음 운세 조회 시 AI가 새로 생성하므로 응답 시간이 길어질 수 있습니다.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.sajuapi.dev/v1/cache/clear \
    -H "X-API-Key: your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "saju": {
        "four_pillars": {
          "year": {
            "stem": { "hangul": "갑", "hanja": "甲" },
            "branch": { "hangul": "술", "hanja": "戌" }
          },
          "month": {
            "stem": { "hangul": "병", "hanja": "丙" },
            "branch": { "hangul": "자", "hanja": "子" }
          },
          "day": {
            "stem": { "hangul": "경", "hanja": "庚" },
            "branch": { "hangul": "인", "hanja": "寅" }
          },
          "hour": {
            "stem": { "hangul": "갑", "hanja": "甲" },
            "branch": { "hangul": "신", "hanja": "申" }
          }
        },
        "day_master": {
          "stem": "庚",
          "name": "경금",
          "element": "metal",
          "element_kr": "금",
          "element_name": "강철",
          "emoji": "⚔️"
        },
        "element_counts": {
          "wood": 3,
          "fire": 1,
          "earth": 1,
          "metal": 2,
          "water": 1
        }
      }
    }'
  ```
</RequestExample>
