# 容量与文件数

`GET /s4/data/{bucket}/usage`

查询存储桶当前的存储容量与文件数，按文件类型（Content-Type）分类返回。

容量单位是字节。`total_*` 等于其余五类之和。

Base URL: https://api.bitiful.com

Authentication: API key in header `Authorization`

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `bucket` | string | yes | 存储桶名称。只能查询当前账户自己的桶。 |

## Example request

```bash
curl -X GET https://api.bitiful.com/s4/data/my-bucket/usage
```

## Responses

- **200**: 存储桶的容量与文件数。
- **401**: 缺少 API Token，或 Token 无效。
- **403**: 存储桶不属于当前账户，或账户被限制。
- **500**: 服务端错误，请稍后重试。

### Example response (200)

```json
{
  "total_files": 1290,
  "total_bytes": 5368709120,
  "image_files": 1024,
  "image_bytes": 1073741824,
  "video_files": 12,
  "video_bytes": 4026531840,
  "audio_files": 4,
  "audio_bytes": 52428800,
  "tmp_files": 0,
  "tmp_bytes": 0,
  "other_files": 250,
  "other_bytes": 216006656
}
```
