---
url: /zh/develops/openapi.md
description: 介绍 CNB 平台 Open API 的服务地址、API 文档入口及调用方式，包括 Authorization Header 格式和 curl 请求示例。
---
## API 服务地址

API 服务与文档地址为 `https://api.cnb.build`。

## 调用方式

### Header 信息

* `Authorization`：用于身份验证，格式为 `Bearer ${token}`，其中 `${token}` 为[访问令牌](../guide/access-token.md)。
* `Accept`：根据 API 文档中 **Response content type** 列举的可选类型填写，如：`application/json`。

### 请求示例

curl 请求示例：

```shell
curl  -X "GET" \
      -H "accept: application/json" \
      -H "Authorization: Bearer 1Z00000000000000000000000vA" \
  "https://api.cnb.build/user/groups?page=1&page_size=10"
```

返回示例：

```json
[
  {
    "id": 1816756487609032700,
    "name": "test",
    "remark": "测试组织",
    "description": "",
    "site": "",
    "email": "",
    "freeze": false,
    "wechat_mp": "hello-world",
    "created_at": "2024-07-26T08:44:35Z",
    "updated_at": "2024-08-13T07:32:13Z",
    "follow_count": 0,
    "member_count": 4,
    "all_member_count": 4,
    "sub_group_count": 5,
    "sub_repo_count": 7,
    "sub_mission_count": 1,
    "all_sub_group_count": 13,
    "all_sub_repo_count": 12,
    "all_sub_mission_count": 1,
    "has_sub_group": true,
    "path": "test",
    "access_role": "Owner"
  }
]
```

仓库动态接口详见[仓库动态](./openapi-event.md)。
