HyperGPT
  • Overview
    • 🟣HyperGPT
    • ⛓️AI & Blockchain
    • 🛠️Problems & Solutions
    • 🤖HyperSolutions
      • HyperX Pad
      • HyperAgent
      • HyperStore
      • HyperSDK
      • HyperNFT
    • 👾Products
    • ⚙️HyperSDK
      • 1. User
        • 1.1 How to Get API Key
        • 1.2 Get Token
        • 1.3 Get Balance
      • 2. AI
        • 2.1 Hyper Portraits
        • 2.2 Hyper Art
        • 2.3 Hyper Ocr
        • 2.4 Hyper Extract
        • 2.5 Hyper Contracts
        • 2.6 Hyper Post
        • 2.7 Hyper Code
        • 2.8 Hyper Chat
        • 2.9 Hyper Pdf
        • 2.10 Hyper Images
    • 🧑‍🔬Incubation
      • 🪐Pluton
    • 🌎Market
    • 🎯Roadmap
    • 👋Contact
    • 🏳️Disclaimer
  • HyperBUIDL Program
    • 🚧HyperBUIDL | Phase #1
  • Ambassador Program
    • 🥇HyperGPT Presents the Ambassador Program
  • HyperDAO
    • 📥About HyperDAO
    • 🤖HyperDAO Roles
  • $HGPT Token
    • 🪙Token Utility
    • 📈$HGPT Tokenomics
      • Token Sale (IDO)
    • 🔥Burn Mechanism
    • 🧑‍🌾Staking & Farming
    • 💰Buy $HGPT Token
    • 🛡️Audit
  • Airdrop Campaigns
    • 🏆HyperGPT Zealy Campaign - $10,000 - [Ended]
    • 🔥Airdrop Campaign - $20,000 - HyperGPT [Ended]
Powered by GitBook
On this page
  1. Overview
  2. HyperSDK
  3. 1. User

1.3 Get Balance

The Get Balance endpoint retrieves the balance of a user. It requires a valid JWT token for authentication and authorization.

Method: POST

Endpoint:

https://sdk.hypergpt.ai/user/getBalance

Parameters:

  • token (str): The JWT (JSON Web Token) used for authenticating the user. This token is processed by the JWTBearer dependency to ensure its validity.

Return Value:

  • balance (float or dict): The balance of the user. The format may vary depending on the implementation of the getbalance_ function.

Example Request:

headers = {
    "Authorization": "Bearer " + bearer_token,

}
params = {
    "token": bearer_token
}

response = requests.get(
    "https://sdk.hypergpt.ai/user/getBalance",
    headers=headers,
    params=params
)

return response.json()

Example Response:

[
  100
]

Example Response (Token Invalid):

{
    "Status": 400,
    "Description": "Token invalid"
}

Overview The Get Balance endpoint enables users to retrieve their balance by providing a valid JWT token. The token is validated and decoded to extract the user's ID, which is then used to fetch the balance. If the token is invalid, an appropriate error message is returned to inform the user of the issue.

Previous1.2 Get TokenNext2. AI

Last updated 4 months ago

⚙️