> ## Documentation Index
> Fetch the complete documentation index at: https://www.helius.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# getTokenAccountBalance

> Trả về số dư token của một tài khoản SPL Token.

## Tham số yêu cầu

<ParamField body="address" type="string" required>
  Địa chỉ tài khoản token SPL Solana cần truy vấn thông tin số dư, dưới dạng chuỗi được mã hóa base-58.
</ParamField>

<ParamField body="commitment" type="string">
  Mức độ commitment cho yêu cầu.

  * `confirmed`
  * `finalized`
  * `processed`
</ParamField>


## OpenAPI

````yaml vi/openapi/rpc-http/getTokenAccountBalance.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: >-
    API truy xuất số dư token SPL Solana nhanh chóng và đáng tin cậy, dùng để
    truy cập số dư token có thể thay thế và NFT với định dạng thập phân chính
    xác cùng số tiền dễ đọc.
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://mainnet.helius-rpc.com
    description: Điểm cuối RPC Mainnet
  - url: https://devnet.helius-rpc.com
    description: Điểm cuối RPC Devnet
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: getTokenAccountBalance
      description: >
        Truy xuất số dư token SPL từ bất kỳ tài khoản token Solana nào với định
        dạng thập phân chính xác.

        API thiết yếu này cung cấp quyền truy cập vào số dư token có thể thay
        thế, lượng NFT nắm giữ và dữ liệu

        token SPL khác, đồng thời hỗ trợ số chữ số thập phân riêng của từng
        token để hiển thị chính xác.

        Trả về cả số dư thô và số dư đã định dạng với số tiền dễ đọc, rất cần
        thiết cho

        ví, ứng dụng DeFi, sàn giao dịch và mọi dịch vụ cần hiển thị

        số dư token cho người dùng.
      operationId: getTokenAccountBalance
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: Phiên bản giao thức JSON-RPC.
                  example: '2.0'
                  default: '2.0'
                id:
                  type: string
                  description: Mã định danh duy nhất cho yêu cầu.
                  example: '1'
                  default: '1'
                method:
                  type: string
                  enum:
                    - getTokenAccountBalance
                  description: Tên của phương thức RPC cần gọi.
                  example: getTokenAccountBalance
                  default: getTokenAccountBalance
                params:
                  type: array
                  description: Các tham số để truy vấn số dư tài khoản token.
                  default:
                    - 3emsAVdmGKERbHjmGfQ6oZ1e35dkf5iYcS6U4CPKFVaa
                  items:
                    oneOf:
                      - type: string
                        description: >-
                          Địa chỉ tài khoản token SPL Solana cần truy vấn thông
                          tin số dư, dưới dạng chuỗi được mã hóa base-58.
                        example: 3emsAVdmGKERbHjmGfQ6oZ1e35dkf5iYcS6U4CPKFVaa
                      - type: object
                        description: Các tùy chọn cấu hình.
                        properties:
                          commitment:
                            type: string
                            description: Mức cam kết cho yêu cầu.
                            enum:
                              - confirmed
                              - finalized
                              - processed
                            example: finalized
      responses:
        '200':
          description: Đã truy xuất thành công số dư tài khoản token.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: Phiên bản giao thức JSON-RPC.
                    enum:
                      - '2.0'
                    example: '2.0'
                  id:
                    type: string
                    description: Mã định danh khớp với yêu cầu.
                    example: '1'
                  result:
                    type: object
                    description: Ngữ cảnh và thông tin chi tiết về số dư tài khoản token.
                    properties:
                      context:
                        type: object
                        description: Ngữ cảnh của phản hồi.
                        properties:
                          slot:
                            type: integer
                            description: Slot mà dữ liệu được truy xuất.
                            example: 1114
                      value:
                        type: object
                        description: Thông tin chi tiết về số dư tài khoản token.
                        properties:
                          amount:
                            type: string
                            description: >-
                              Số dư token Solana thô dưới dạng chuỗi số nguyên
                              không có định dạng thập phân.
                            example: '9864'
                          decimals:
                            type: integer
                            description: >-
                              Số chữ số thập phân do mint của token xác định để
                              định dạng hiển thị chính xác.
                            example: 2
                          uiAmount:
                            type: number
                            description: >-
                              Số dư token Solana dễ đọc với định dạng thập phân
                              chính xác (không còn được khuyến nghị).
                            example: 98.64
                          uiAmountString:
                            type: string
                            description: >-
                              Biểu diễn chuỗi chuẩn của số dư token với số chữ
                              số thập phân chính xác.
                            example: '98.64'
              examples:
                default:
                  $ref: '#/components/examples/getTokenAccountBalanceResponse'
        '400':
          description: >-
            Yêu cầu không hợp lệ - Tham số yêu cầu không hợp lệ hoặc yêu cầu có
            định dạng sai.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Invalid params
                id: '1'
        '401':
          description: Không được phép - Khóa API không hợp lệ hoặc bị thiếu.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Unauthorized
                id: '1'
        '429':
          description: Quá nhiều yêu cầu - Đã vượt quá giới hạn tốc độ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: Too many requests
                id: '1'
        '500':
          description: Lỗi máy chủ nội bộ - Đã xảy ra lỗi trên máy chủ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: Internal error
                id: '1'
        '503':
          description: Dịch vụ không khả dụng - Dịch vụ tạm thời không khả dụng.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: Service unavailable
                id: '1'
        '504':
          description: Cổng kết nối hết thời gian chờ - Yêu cầu đã hết thời gian chờ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: Gateway timeout
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  examples:
    getTokenAccountBalanceResponse:
      value:
        jsonrpc: '2.0'
        id: '1'
        result:
          context:
            slot: 1114
          value:
            amount: '9864'
            decimals: 2
            uiAmount: 98.64
            uiAmountString: '98.64'
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          description: Phiên bản giao thức JSON-RPC.
          enum:
            - '2.0'
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: Mã lỗi.
              example: -32602
            message:
              type: string
              description: Thông báo lỗi.
            data:
              type: object
              description: Dữ liệu bổ sung về lỗi.
        id:
          type: string
          description: Mã định danh khớp với yêu cầu.
          example: '1'
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: >-
        Khóa API Helius của bạn. Bạn có thể nhận khóa miễn phí trong [bảng điều
        khiển](https://dashboard.helius.dev/api-keys).

````