Embedded Wallets
How to
Wallet Operation
Refresh Token

Refresh Token

API Documentation: Refresh Token

Overview

This API endpoint allows you to refresh the user walletToken and refreshToken.

  • The user walletToken is a single use token that is used to access the Wallet Operation endpoint. After the token is used, it will be expired and user need to refresh the token to get a new one. If the user walletToken is not used within 1 day, it will be automatically expired.
  • The user refreshToken is a single use token that is used to get a new walletToken and refreshToken. The refreshToken will be expired after it is used to get a new walletToken and refreshToken or will be automatically expired after 7 days from the time it was generated.
⚠️

The Refresh Token API endpoint is only available for version 2. The version 1 does not support this feature.

  • HTTP Method: POST
  • Endpoint: /api/v2/wallet/refresh

Request Body Parameters

Example Request Body

{
    "refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0YjUxNGY0MzU4ZGVjY2FkYWY4MDA5MSIsImVtYWlsIjoiZGVuZGl0b3BydG1AZ21haWwuY29tIiwibmFtZSI6IkRlbmRpdG8gUHJhdGFtYSIsInJvbGUiOiJhZG1pbiIsInBvbGljeSI6IjY0OTE0YTY3Z..."
}

Request

Request Headers

  • x-client-secret (required): Client secret which was generated when register in Xellar Embedded Wallet API Service Dashboard.

Example Request Syntax

curl -X POST -H "Content-Type: application/json" -H "x-client-secret: $YOUR_CLIENT_SECRET" -d '{
    "refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6I..."
}' <BASE_URL>/api/v2/wallet/refresh

Response

The response will include a JSON object with the following properties:

  • status (number): The HTTP status code of the response (e.g., 200 for success).
  • message (string): A message providing additional information about the operation.
  • data (object): An object containing the user wallet token & refresh token.
    • walletToken : JWT token used to access the Wallet Operation endpoint.
    • refreshToken : JWT token used to refresh or get a new wallet token.

Example Response

{
    "status": 200,
    "message": "Refresh Success",
    "data": {
        "walletToken": "your_wallet_token_here",
        "refreshToken": "your_refresh_token_here",
    }
}