获取 Token
使用本站Access Key和Secret Key获取访问令牌。client_id对应Access Key,client_secret对应Secret Key。
业务接口使用响应中的 data.accessToken,通过请求头 Authorization: Bearer <accessToken> 鉴权。完整流程见快速开始。
POST https://api.hitem3d.ai/open-api/v1/auth/token
| Header | 值 |
|---|---|
| Authorization | Basic base64(client_id:client_secret) |
| Content-Type | application/json |
请求体
无需业务请求体;凭据通过 Authorization 请求头传入。
响应体
| Field | Type | 说明 |
|---|---|---|
code | int | 接口响应码。 |
data.accessToken | String | 用于后续API调用的令牌 |
data.tokenType | String | Bearer |
data.nonce | String | 随机数 |
msg | String | 消息字段,现有示例也出现message |
请求示例
bash
curl --request POST 'https://api.hitem3d.ai/open-api/v1/auth/token' \
--user "$HI3D_ACCESS_KEY:$HI3D_SECRET_KEY" \
--header 'Content-Type: application/json'python
import os
import requests
response = requests.post(
"https://api.hitem3d.ai/open-api/v1/auth/token",
auth=(os.environ["HI3D_ACCESS_KEY"], os.environ["HI3D_SECRET_KEY"]),
headers={"Content-Type": "application/json"},
)
response.raise_for_status()
print(response.json())响应示例
json
{
"code": 200,
"message": "success",
"data": {
"accessToken": "<TOKEN>",
"tokenType": "Bearer",
"nonce": "<NONCE>"
}
}API 密钥管理
在 API 密钥页创建凭据,单账户最多 10 个。创建时保存 Secret Key,之后不再展示。密钥可改名、启用或禁用;已禁用的密钥才能删除,删除不可恢复,依赖该密钥的调用会立即失效。
错误码
| code | message | 说明 |
|---|---|---|
| 40010000 | client credentials are invalid | client_id或client_secret错误 |
| 10000000 | system error | 服务器内部错误 |
技术支持:apicontact@hi3d.ai