Get Token API
API Overview
You need to obtain a token before requesting other APIs (valid for 24 hours)
| Protocol | Endpoint | Method | Auth | Request Format | Response Format |
|---|---|---|---|---|---|
| HTTP | /open-api/v1/auth/token | POST | Basic | application/json | application/json |
Request Headers
| Parameter | Value | Description |
|---|---|---|
| Authorization | Basic base64(client_id:client_secret) | Basic authentication with Base64 encoded client credentials |
| Content-Type | application/json | Request body type |
c
String client_id = "kqJeYqXfV4H8pSt4LyxnR_cM3Z1kJTuNeqbCMwKxTSI87yfTrdzu766Dx8t5-6oP";
String client_secret = "+3bZoDrT31n2Qs+hsOxuPMzh40lC7+NdzIGgmntIhbe34cWxr1scIeZPcmZnMOx6";
String basicAuth = "Basic " + Base64.getEncoder().encodeToString(
(client_id + ":" + client_secret).getBytes(StandardCharsets.UTF_8)
);Request Body
plain
POST /open-api/v1/auth/token HTTP/1.1
Host: http://api.hitem3d.com
Authorization: Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ=
Content-Type: application/jsonResponse Body
| Parameter | Field | Type | Description |
|---|---|---|---|
| code | - | String | Error code, see error code table |
| data | accessToken | String | Access token for subsequent API calls |
| tokenType | String | Token type: Bearer | |
| nonce | String | Random number for security validation | |
| msg | - | String | Detailed error message |
bash
HTTP/1.1 200 OK
Content-Type: application/json
{
"code": 200,
"message": "success",
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"tokenType": "Bearer",
"nonce": "1623456789000hitem3d"
}
}json
HTTP/1.1 200 OK
Content-Type: application/json
{
"code": 40010000,
"message": "client credentials are invalid",
"data": {}
}Error Codes
Error codes are returned in JSON structure, including code and msg fields. We will expand the corresponding field values with version updates.
json
{
"code": 40010000,
"data": {},
"msg": "client credentials are invalid"
}| Error Code | Error Message | Error Description |
|---|---|---|
| 40010000 | client credentials are invalid | Invalid client_id or client_secret |
| 10000000 | system error | Internal server error |
Request Examples (Shell & Python)
Shell
shell
curl --location --request POST 'https://api.hitem3d.ai/open-api/v1/auth/token' \
--header 'Authorization: Basic xxx' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Host: api.hitem3d.ai' \
--header 'Connection: keep-alive'Python
python
import requests
import json
url = "https://api.hitem3d.ai/open-api/v1/auth/token"
payload={}
headers = {
'Authorization': 'Basic xxx',
'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
'Content-Type': 'application/json',
'Accept': '*/*',
'Host': 'api.hitem3d.ai',
'Connection': 'keep-alive'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)