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

프로필 관련 통계를 조회합니다. 일주 분포, 오행 분석, 성별 비율 등을 확인할 수 있습니다.

***

## Query 파라미터

<ParamField query="start_date" type="string">
  조회 시작 날짜입니다. ISO 8601 형식(YYYY-MM-DD)입니다. 프로필 생성일 기준입니다.
</ParamField>

<ParamField query="end_date" type="string">
  조회 종료 날짜입니다. ISO 8601 형식(YYYY-MM-DD)입니다.
</ParamField>

***

## Response

### 성공

프로필 통계 조회에 성공하면 ProfileReport 객체가 반환됩니다.

### 실패

| 상태 코드 | 에러 타입                  | 설명             |
| ----- | ---------------------- | -------------- |
| 401   | `authentication_error` | API 키가 유효하지 않음 |
| 429   | `rate_limited`         | 요청 한도 초과       |

***

## 요청 예시

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

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

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

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

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

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

***

## 응답 예시

```json theme={null}
{
  "total_profiles": 5420,
  "active_profiles": 5180,
  "deleted_profiles": 240,
  "gender_distribution": {
    "male": {
      "count": 2580,
      "percentage": 47.6
    },
    "female": {
      "count": 2840,
      "percentage": 52.4
    }
  },
  "day_master_distribution": {
    "갑목": { "count": 520, "percentage": 9.6 },
    "을목": { "count": 485, "percentage": 8.9 },
    "병화": { "count": 612, "percentage": 11.3 },
    "정화": { "count": 498, "percentage": 9.2 },
    "무토": { "count": 545, "percentage": 10.1 },
    "기토": { "count": 502, "percentage": 9.3 },
    "경금": { "count": 578, "percentage": 10.7 },
    "신금": { "count": 490, "percentage": 9.0 },
    "임수": { "count": 598, "percentage": 11.0 },
    "계수": { "count": 592, "percentage": 10.9 }
  },
  "element_distribution": {
    "wood": { "count": 1005, "percentage": 18.5 },
    "fire": { "count": 1110, "percentage": 20.5 },
    "earth": { "count": 1047, "percentage": 19.3 },
    "metal": { "count": 1068, "percentage": 19.7 },
    "water": { "count": 1190, "percentage": 22.0 }
  },
  "weakest_element_distribution": {
    "wood": { "count": 1150, "percentage": 21.2 },
    "fire": { "count": 980, "percentage": 18.1 },
    "earth": { "count": 1020, "percentage": 18.8 },
    "metal": { "count": 1180, "percentage": 21.8 },
    "water": { "count": 1090, "percentage": 20.1 }
  },
  "birth_year_distribution": {
    "1950-1959": 120,
    "1960-1969": 380,
    "1970-1979": 720,
    "1980-1989": 1450,
    "1990-1999": 1820,
    "2000-2009": 780,
    "2010-2019": 150
  },
  "creation_trend": [
    {
      "date": "2025-01-10",
      "new_profiles": 45,
      "deleted_profiles": 3
    },
    {
      "date": "2025-01-11",
      "new_profiles": 52,
      "deleted_profiles": 2
    },
    {
      "date": "2025-01-12",
      "new_profiles": 38,
      "deleted_profiles": 5
    }
  ]
}
```

***

## ProfileReport 객체

| 필드                             | 타입      | 설명              |
| ------------------------------ | ------- | --------------- |
| `total_profiles`               | integer | 전체 프로필 수입니다.    |
| `active_profiles`              | integer | 활성 프로필 수입니다.    |
| `deleted_profiles`             | integer | 삭제된 프로필 수입니다.   |
| `gender_distribution`          | object  | 성별 분포입니다.       |
| `day_master_distribution`      | object  | 일주 분포입니다.       |
| `element_distribution`         | object  | 오행 분포입니다.       |
| `weakest_element_distribution` | object  | 가장 약한 오행 분포입니다. |
| `birth_year_distribution`      | object  | 출생 연도대별 분포입니다.  |
| `creation_trend`               | array   | 프로필 생성 추이입니다.   |

***

## 활용 사례

### 마케팅 분석

일주와 오행 분포를 분석하여 사용자 그룹을 세분화하고, 맞춤형 콘텐츠를 제공할 수 있습니다.

```javascript theme={null}
// 가장 많은 일주 확인
const report = await fetch('/v1/reports/profiles').then(r => r.json());

const topDayMaster = Object.entries(report.day_master_distribution)
  .sort((a, b) => b[1].count - a[1].count)[0];

console.log(`가장 많은 일주: ${topDayMaster[0]} (${topDayMaster[1].percentage}%)`);
```
