Skip to content

Get Token API

API Overview

You need to obtain a token before requesting other APIs (valid for 24 hours)

ProtocolEndpointMethodAuthRequest FormatResponse Format
HTTP/open-api/v1/auth/tokenPOSTBasicapplication/jsonapplication/json

Request Headers

ParameterValueDescription
AuthorizationBasic base64(client_id:client_secret)Basic authentication with Base64 encoded client credentials
Content-Typeapplication/jsonRequest 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/json

Response Body

ParameterFieldTypeDescription
code-StringError code, see error code table
dataaccessTokenStringAccess token for subsequent API calls
tokenTypeStringToken type: Bearer
nonceStringRandom number for security validation
msg-StringDetailed 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 CodeError MessageError Description
40010000client credentials are invalidInvalid client_id or client_secret
10000000system errorInternal 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)