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

# 청구 집계

> 기간 지출을 일·App·자격 증명별 내역.

**`GET`** `https://api-datahub.octoparse.com/v1/billing`

인증: API 키 필요(`Authorization: Bearer <API Key>`).

기간에 얼마를 어디에 썼는지. 계정 정보 엔드포인트와 독립.

시간 범위 어휘는 <a href="/docs/ko/datahub/api/reference/runs/list-runs">실행 목록</a>: `created_from` / `created_to` 는 실행 **시작** 시각 기준 inclusive/exclusive ISO-8601 절대 시각. 같은 경계를 실행 목록에 넘기면 그룹 합계 뒤를 드릴다운. `tz_offset`은 일 버킷 로컬 일만 정하며 금액·절대 범위는 바꾸지 않음.

집계는 데이터 요금만. 일 그룹은 대사 쉬운 오름차순, App·자격 증명은 금액 내림차순으로 최대가 먼저.

`credential` 내역은 「내 키별 지출」. 키는 비민감 안정 자격 증명 id이며 실행 목록 `credential` 필터와 같은 값. 범위는 항상 본인 계정.

## 요청

### 쿼리 파라미터

<ParamField query="group_by" type="string" default="day">
  내역 차원: `day`(기본) / `data_app` / `credential`.
</ParamField>

<ParamField query="created_from" type="string">
  시작(inclusive). 생략 시 가장 이름부터.
</ParamField>

<ParamField query="created_to" type="string">
  끝(exclusive). 생략 시 현재까지.
</ParamField>

<ParamField query="tz_offset" type="integer" default="0">
  일 버킷 UTC 기준 분 오프셋. 중국 표준시 `480`. 기본 `0`은 UTC 일. 고정 오프셋만(DST 없음). 드릴다운 `created_from`/`created_to`도 동일 오프셋. 범위 -720\~840.
</ParamField>

### 요청 예시

```bash theme={null}
curl \
  -H "Authorization: Bearer $OCTOPARSE_API_KEY" \
  "https://api-datahub.octoparse.com/v1/billing?group_by=day&created_from=2026-09-01T00:00:00%2B00:00&created_to=2026-10-01T00:00:00%2B00:00&tz_offset=0"
```

## 응답

### 200 성공

```json theme={null}
{
  "data": {
    "total": 0.08,
    "currency": "USD",
    "group_by": "day",
    "groups": [
      {
        "day": "2026-07-01",
        "namespace": null,
        "app_name": null,
        "credential": null,
        "credential_name": null,
        "runs": 2,
        "amount": 0.04
      }
    ]
  }
}
```

페이로드는 `data`로 감쌉니다. 필드:

<ResponseField name="total" type="number">
  기간 합계. 그룹 `amount` 합과 같음.
</ResponseField>

<ResponseField name="currency" type="string">
  통화.
</ResponseField>

<ResponseField name="group_by" type="string">
  실제로 사용된 차원.
</ResponseField>

<ResponseField name="groups" type="object[]">
  그룹 행. 모든 차원 필드 있음, 미사용 `null`.

  <Expandable title="fields">
    <ResponseField name="day" type="string">
      `group_by=day` 키. `YYYY-MM-DD`.
    </ResponseField>

    <ResponseField name="namespace" type="string">
      `group_by=data_app`일 때 게시자 이름.
    </ResponseField>

    <ResponseField name="app_name" type="string">
      `group_by=data_app`일 때 App 이름.
    </ResponseField>

    <ResponseField name="credential" type="string">
      `group_by=credential`일 때 안정 자격 증명 id.
    </ResponseField>

    <ResponseField name="credential_name" type="string">
      자격 증명 표시 이름(있을 때).
    </ResponseField>

    <ResponseField name="runs" type="integer">
      그룹 내 실행 수.
    </ResponseField>

    <ResponseField name="amount" type="number">
      그룹 데이터 요금 합계.
    </ResponseField>
  </Expandable>
</ResponseField>

### 오류

| HTTP | `code`          | `category`      | 설명              |
| ---- | --------------- | --------------- | --------------- |
| 400  | `invalid-input` | `invalid_input` | 파라미터 무효.        |
| 401  | `unauthorized`  | `forbidden`     | API 키 누락 또는 무효. |

오류 응답은 `{"error": {code, category, message, retryable}}`입니다. <a href="/docs/ko/datahub/api/reference/introduction#errors">오류</a> 참고.

## 클라이언트 라이브러리

<CodeGroup>
  ```python Python theme={null}
  print(client.billing(group_by="data_app", tz_offset=0))
  ```

  ```js JavaScript theme={null}
  console.log(await client.billing({ groupBy: "data_app", tzOffset: 0 }));
  ```
</CodeGroup>
