Create API Token

This API allows you to generate a new API token for user authentication.

Endpoint Information

  • Request Method: GET

  • Request Path: /v2/token/generate

  • Authorization Required: Yes

Request Headers

  • X-BH-APIKEY: Your API key.

Query Parameters

  • timestamp: The current time in milliseconds since the epoch.

  • signature: The HMAC signature for the request.

Response Structure

The response will include the following fields:

{
  "code": 200,                      // (number: response code)
  "msg": "SUCCESS",                 // (string: message)
  "data": {                         // (object: token details)
    "token": "09ef3523-6242-4a8d-80e2-24cfbdb35851", // (string: generated token)
    "expireTime": "1740568725231"  // (string: timestamp of the expiration time in milliseconds)
  }
}

Signature Generation Process

To generate the signature, follow these steps:

  1. Prepare the Message: Create a string with the current timestamp: "timestamp=1740568725231".

  2. Prepare the Key: Use your API_SECRET as the key.

  3. Generate the Signature: Use HMAC-SHA256 to create a hex string signature from the message and the key.

Example Code for Signature Generation

Python

Java

JavaScript (Node.js)

Go

Rust

Notes

  • Ensure that you replace "xxxx" with your actual API_SECRET.

  • The generated token will have an expiration time, which is provided in the response.