> ## 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.

# 프로필 복호화 조회

<Info>
  **v1 Enterprise API (Coming Soon)**

  이 엔드포인트는 Enterprise 버전에서 제공될 예정입니다.
  현재는 [v0 API](/api-reference/v0/overview)를 사용하세요.
</Info>

암호화된 프로필 데이터를 복호화하여 원본 데이터를 조회합니다. 이 엔드포인트는 민감한 개인정보를 반환하므로 모든 요청이 감사 로그에 기록됩니다.

<Warning>
  이 엔드포인트는 민감한 개인정보(이름, 생년월일)를 평문으로 반환합니다. 모든 요청은 자동으로 감사 로그에 기록되며, 비정상적인 접근 패턴은 보안 검토 대상이 됩니다.
</Warning>

***

## Path 파라미터

<ParamField path="id" type="string" required>
  조회할 프로필의 ID입니다. `prf_` 접두사로 시작합니다.
</ParamField>

***

## Response

### 성공

프로필 복호화 조회에 성공하면 마스킹되지 않은 원본 데이터가 포함된 Profile 객체가 반환됩니다.

### 실패

| 상태 코드 | 에러 타입                  | 설명             |
| ----- | ---------------------- | -------------- |
| 401   | `authentication_error` | API 키가 유효하지 않음 |
| 403   | `forbidden`            | 복호화 권한이 없음     |
| 404   | `not_found`            | 프로필을 찾을 수 없음   |
| 429   | `rate_limited`         | 요청 한도 초과       |

***

## 요청 예시

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET https://api.sajuapi.dev/v1/profiles/prf_abc123def456/unmasked \
    -H "X-API-Key: bs_live_xxx"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.sajuapi.dev/v1/profiles/prf_abc123def456/unmasked',
    {
      headers: {
        'X-API-Key': 'bs_live_xxx'
      }
    }
  );

  const profile = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.sajuapi.dev/v1/profiles/prf_abc123def456/unmasked',
      headers={'X-API-Key': 'bs_live_xxx'}
  )

  profile = response.json()
  ```
</CodeGroup>

***

## 응답 예시

```json theme={null}
{
  "id": "prf_abc123def456",
  "external_id": "user_12345",
  "name": "김철수",
  "birth_year": 1990,
  "birth_month": 3,
  "birth_day": 15,
  "birth_hour": 14,
  "gender": "male",
  "day_master": "병화",
  "day_master_element": "fire",
  "weakest_element": "water",
  "saju": {
    "pillars": {
      "year": {
        "stem": "경",
        "stem_hanja": "庚",
        "branch": "오",
        "branch_hanja": "午",
        "element": "metal"
      },
      "month": {
        "stem": "기",
        "stem_hanja": "己",
        "branch": "묘",
        "branch_hanja": "卯",
        "element": "earth"
      },
      "day": {
        "stem": "병",
        "stem_hanja": "丙",
        "branch": "인",
        "branch_hanja": "寅",
        "element": "fire"
      },
      "hour": {
        "stem": "을",
        "stem_hanja": "乙",
        "branch": "미",
        "branch_hanja": "未",
        "element": "wood"
      }
    },
    "day_master": {
      "name": "병화",
      "hanja": "丙火",
      "element": "fire",
      "description": "태양과 같은 밝고 뜨거운 기운을 가진 일주입니다."
    },
    "elements": {
      "wood": 2,
      "fire": 3,
      "earth": 1,
      "metal": 1,
      "water": 1
    },
    "weakest_element": "water",
    "strongest_element": "fire"
  },
  "created_at": "2025-01-15T09:00:00Z",
  "updated_at": "2025-01-15T09:00:00Z"
}
```

***

## Unmasked Profile 객체

일반 Profile 조회와 달리 다음 필드가 원본 값으로 반환됩니다.

| 필드            | 타입      | 설명                            |
| ------------- | ------- | ----------------------------- |
| `name`        | string  | 사용자 이름 원본입니다. (마스킹 없음)        |
| `birth_year`  | integer | 출생 연도 원본입니다.                  |
| `birth_month` | integer | 출생 월 원본입니다.                   |
| `birth_day`   | integer | 출생 일 원본입니다.                   |
| `birth_hour`  | integer | 출생 시 원본입니다. 값이 없으면 `null`입니다. |
| `saju`        | object  | 완전한 사주팔자 정보입니다.               |

***

## Saju 객체

| 필드                  | 타입     | 설명                                         |
| ------------------- | ------ | ------------------------------------------ |
| `pillars`           | object | 사주(四柱) 정보입니다. 연주, 월주, 일주, 시주를 포함합니다.       |
| `pillars.year`      | object | 연주(年柱) 정보입니다.                              |
| `pillars.month`     | object | 월주(月柱) 정보입니다.                              |
| `pillars.day`       | object | 일주(日柱) 정보입니다.                              |
| `pillars.hour`      | object | 시주(時柱) 정보입니다. `birth_hour`가 없으면 `null`입니다. |
| `day_master`        | object | 일간(日干) 정보입니다.                              |
| `elements`          | object | 오행별 분포입니다.                                 |
| `weakest_element`   | string | 가장 약한 오행입니다.                               |
| `strongest_element` | string | 가장 강한 오행입니다.                               |

***

## 감사 로그

모든 복호화 요청은 자동으로 감사 로그에 기록됩니다.

```json theme={null}
{
  "action": "profile.unmasked",
  "resource_type": "profile",
  "resource_id": "prf_abc123def456",
  "actor_ip": "203.0.113.42",
  "actor_api_key": "bs_live_xxx...",
  "request_id": "req_xyz789",
  "created_at": "2025-01-16T15:00:00Z"
}
```

<Note>
  복호화 요청 빈도가 비정상적으로 높은 경우 보안 알림이 발생할 수 있습니다. 필요한 경우에만 이 엔드포인트를 사용하고, 가능하면 마스킹된 데이터를 사용하세요.
</Note>
