Skip to main content
Generate a new API access token using your login token. API tokens are long-lived access tokens (no expiry) that can be used to authenticate API requests. These tokens are generated from your login session token and are tied to your user account, company, and workspace.

API Endpoint

Endpoint: POST /api/v1/global/generate-token Content-Type: application/json Authentication: Required (Login token in token header)

Authentication

This endpoint requires a login token to authenticate your requests.

Obtaining Your Login Token

You will receive a login token when you:
  • Log in to your account
  • Create a new account
After logging in or creating your account, the login token is available in the request header of any API call you make. When you make authenticated API requests, the login token is sent in the request header as:
token: <your_login_token>
This token is your session token that identifies your authenticated session and is automatically included in request headers for authenticated API calls. Important: The token must be provided in the token request header. Request body or query parameters are not supported.

Request Headers

Content-Type: application/json
token: <your_login_token>
Required: The token header must contain your login token.

Request Body

No request body is required. You can send an empty body:
{}

cURL Example

curl -X POST https://www.tryunleashx.com/api/v1/global/generate-token \
  -H "Content-Type: application/json" \
  -H "token: your_login_token_here" \
  -d '{}'

Response

Success Response

Status Code: 200 OK
{
  "message": "API token generated successfully",
  "token": "359b83f43a5f5702cfbdedad269bd4f1d726fc576c48cdc65b594ce57896f0f9"
}

Error Responses

Missing Login Token

Status Code: 400 Bad Request
{
  "error": true,
  "message": "LOGIN_TOKEN_REQUIRED"
}

Invalid or Expired Login Token

Status Code: 401 Unauthorized
{
  "error": true,
  "message": "INVALID_LOGIN_TOKEN"
}
or
{
  "error": true,
  "message": "SESSIONEXPIRED"
}

Error Codes

Status CodeError CodeDescription
200-Success
400LOGIN_TOKEN_REQUIREDLogin token is missing in request header
401INVALID_LOGIN_TOKENInvalid or expired login token
401SESSIONEXPIREDLogin session has expired

Important Notes

  • Each call generates a new API token
  • API tokens never expire (no expiry date)
  • The token is tied to your user account, company, and workspace
  • Store the returned token securely as it cannot be retrieved later (you can generate a new one)
  • The token must be provided in the token request header, not in the request body or query parameters

Workflow Example

Step 1: Login or Create Account to Get Login Token

# Login endpoint (example)
curl -X POST https://www.tryunleashx.com/api/login \
  -H "Content-Type: application/json" \
  -d '{
    "username": "user@example.com",
    "otp: "otp received on your mail"
  }'

# Response includes login token in response body
{
  "auth": {...},
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "message": "LOGGEDIN"
}
Note: To generate the OTP, invoke the login API using only the username. After receiving the OTP, invoke the login API again with both the username and the OTP Note: After logging in or creating your account, when you make any authenticated API call, the login token will be available in the request header (token) of that API call. You can extract it from the request header to use with this token generation endpoint.

Step 2: Generate API Token

curl -X POST https://www.tryunleashx.com/api/v1/global/generate-token \
  -H "Content-Type: application/json" \
  -H "token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -d '{}'

# Response
{
  "message": "API token generated successfully",
  "token": "359b83f43a5f5702cfbdedad269bd4f1d726fc576c48cdc65b594ce57896f0f9"
}

Step 3: Use API Token for Authenticated Requests

curl -X POST https://www.tryunleashx.com/api/v1/global/verify \
  -H "Content-Type: application/json" \
  -H "token: 359b83f43a5f5702cfbdedad269bd4f1d726fc576c48cdc65b594ce57896f0f9" \
  -d '{}'