Nhất Tín LogisticsDevelopers
Get started

JWT authentication

How to sign in, call APIs with JWT, and refresh tokens.

Follow these steps to authenticate and call the API.

1. Sign in to get tokens

Nhất Tín provides credentials for each environment.

curl --request POST \
--url https://apisandbox.ntlogistics.vn/v1/auth/sign-in \
--header "Content-Type: application/json" \
--data '{"username":"your_account","password":"your_password"}'

Successful sign-in response:

{
  "success": true,
  "data": {
    "jwt_token": "<access_token>",
    "token_type": "Bearer",
    "token_expires_in": "1m",
    "refresh_token": "<refresh_token>",
    "refresh_expires_in": "2m"
  }
}

Keep refresh_token private. Use it to extend access when the access token expires.

2. Call APIs with the access token

Send the Authorization header with the access token on every request:

GET /v3/your-endpoint
Authorization: Bearer <access_token>

If you receive 401 because the token has expired, refresh the token and retry the request.

3. Refresh the access token

curl --request POST \
--url https://apisandbox.ntlogistics.vn/v1/auth/refresh-token \
--header "Content-Type: application/json" \
--data '{"refresh_token":"<refresh_token>"}'

Successful refresh response:

{
  "success": true,
  "data": {
    "jwt_token": "<new_access_token>",
    "token_type": "Bearer",
    "token_expires_in": "1m",
    "refresh_token": "<new_refresh_token>",
    "refresh_expires_in": "2m"
  }
}

Common errors

LỗiTrạng tháiKhi nào xảy raCách khắc phục
Authentication required401Missing Authorization headerAdd Authorization: Bearer <access_token>
Invalid header format401Header is not in Bearer <token> formatUse the correct Bearer format
Token expired401The access token has expiredRefresh the token and retry
Authentication failed401The token is invalidSign in again to get a new token
Missing refresh token400refresh_token is missing in the refresh requestAdd refresh_token to the request body

Updated from the legacy docs on 16/09/2025 by Nhất Tín Logistics.

On this page