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

# 거래 내역 조회

> 사용자 크레딧 거래 내역을 반환하는 엔드포인트입니다.

## GET /credits/history

인증된 사용자의 크레딧 거래(구매, 사용, 환불 등) 목록을 반환합니다. 세션 기반 인증(JWT 액세스 토큰)이 필요합니다.

<Note>
  **서드파티 연동:** API 키 인증을 사용할 때는 대신 `GET /credits/history/api`를 사용하세요.
</Note>

### 쿼리 매개변수

<ParamField query="limit" type="number" default="20">
  반환할 거래 건수입니다(최대 100).
</ParamField>

<ParamField query="offset" type="number" default="0">
  페이지네이션을 위해 건너뛸 거래 건수입니다.
</ParamField>

<ParamField query="type" type="string">
  거래 유형으로 필터링합니다: `purchase`, `usage`, 또는 `refund`.
</ParamField>

### 응답

<ResponseField name="transactions" type="array">
  거래 객체 배열입니다.

  <Expandable title="거래 속성">
    <ResponseField name="id" type="string">
      거래 고유 식별자입니다.
    </ResponseField>

    <ResponseField name="type" type="string">
      거래 유형: `purchase`, `usage`, 또는 `refund`입니다.
    </ResponseField>

    <ResponseField name="amount" type="number">
      크레딧 수(추가는 양수, 사용은 음수)입니다.
    </ResponseField>

    <ResponseField name="description" type="string">
      거래 설명입니다.
    </ResponseField>

    <ResponseField name="siteId" type="string">
      연결된 사이트 ID입니다(사용 거래 등).
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      거래 시각(ISO 8601)입니다.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="number">
  거래 총 건수입니다.
</ResponseField>

<ResponseField name="hasMore" type="boolean">
  추가로 더 가져올 거래가 있는지 여부입니다.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.llmgenerator.com/api/v1/credits/history?limit=10" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.llmgenerator.com/api/v1/credits/history?limit=10&type=usage',
    {
      headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
    }
  );

  const history = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "transactions": [
      {
        "id": "txn_abc123",
        "type": "purchase",
        "amount": 500,
        "description": "Purchased Professional Pack",
        "siteId": null,
        "createdAt": "2026-01-15T10:00:00.000Z"
      },
      {
        "id": "txn_def456",
        "type": "usage",
        "amount": -50,
        "description": "llms.txt generation for example.com (enhanced)",
        "siteId": "550e8400-e29b-41d4-a716-446655440000",
        "createdAt": "2026-01-20T14:30:00.000Z"
      },
      {
        "id": "txn_ghi789",
        "type": "usage",
        "amount": -25,
        "description": "llms.txt generation for another-site.com (simple)",
        "siteId": "660e8400-e29b-41d4-a716-446655440001",
        "createdAt": "2026-01-22T09:15:00.000Z"
      }
    ],
    "total": 47,
    "hasMore": true
  }
  ```
</ResponseExample>

***

## GET /credits/history/api

API 키 인증으로 사용자의 크레딧 거래 내역을 반환합니다. 서드파티 연동에 적합합니다.

### 인증

API 키 인증이 필요합니다. `Authorization` 헤더에 API 키를 넣습니다:

```
Authorization: Bearer llmgen_your_api_key_here
```

### 쿼리 매개변수

`/credits/history`와 동일합니다.

### 응답

`/credits/history`와 동일합니다.

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.llmgenerator.com/api/v1/credits/history/api?limit=10" \
    -H "Authorization: Bearer llmgen_your_api_key_here"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.llmgenerator.com/api/v1/credits/history/api?limit=10&type=usage',
    {
      headers: { 'Authorization': 'Bearer llmgen_your_api_key_here' }
    }
  );

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

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

  response = requests.get(
      'https://api.llmgenerator.com/api/v1/credits/history/api',
      headers={'Authorization': 'Bearer llmgen_your_api_key_here'},
      params={'limit': 10, 'type': 'usage'}
  )

  history = response.json()
  ```
</RequestExample>
