> ## 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.

# getBalance

> Trả về số dư lamport của tài khoản có Pubkey được cung cấp.

## Tham số yêu cầu

<ParamField body="address" type="string" required>
  Pubkey của tài khoản cần truy vấn (chuỗi được mã hóa base-58).
</ParamField>

<ParamField body="commitment" type="string">
  Mức cam kết cho yêu cầu.

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

<ParamField body="minContextSlot" type="number">
  Slot tối thiểu mà tại đó yêu cầu có thể được đánh giá.
</ParamField>


## OpenAPI

````yaml vi/openapi/rpc-http/getBalance.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: >-
    API truy xuất số dư ví Solana nhanh chóng và đáng tin cậy để lấy số dư SOL
    của tài khoản, với các mức độ cam kết có thể cấu hình nhằm đáp ứng các đảm
    bảo về tính hoàn tất khác nhau.
  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: getBalance
      description: >
        Truy xuất số dư SOL gốc cho bất kỳ địa chỉ ví Solana nào với các mức độ
        hoàn tất có thể cấu hình.

        API thiết yếu này cung cấp khả năng truy cập nhanh vào số dư tài khoản
        theo đơn vị lamport (1 SOL = 1.000.000.000 lamport),

        hỗ trợ nhiều mức độ cam kết khác nhau để cân bằng giữa tốc độ và đảm bảo
        tính hoàn tất.

        Đây là API quan trọng đối với ví, ứng dụng tài chính, nền tảng giao dịch
        và mọi dịch vụ cần

        theo dõi số dư tài khoản Solana theo thời gian thực.
      operationId: getBalance
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: Phiên bản giao thức JSON-RPC.
                  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:
                    - getBalance
                  description: Tên phương thức RPC cần gọi.
                  default: getBalance
                params:
                  type: array
                  description: Các tham số của yêu cầu.
                  default:
                    - 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri
                  items:
                    oneOf:
                      - type: string
                        description: >-
                          Pubkey của tài khoản cần truy vấn (chuỗi được mã hóa
                          base-58).
                        example: 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri
                      - type: object
                        description: Các tùy chọn cấu hình bổ sung cho yêu cầu.
                        properties:
                          commitment:
                            type: string
                            description: Mức độ cam kết cho yêu cầu.
                            enum:
                              - processed
                              - confirmed
                              - finalized
                            example: finalized
                          minContextSlot:
                            type: integer
                            description: >-
                              Slot tối thiểu mà tại đó yêu cầu có thể được đánh
                              giá.
                            example: 1
      responses:
        '200':
          description: Đã truy xuất thành công số dư tài khoản.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                  result:
                    type: object
                    properties:
                      context:
                        type: object
                        properties:
                          slot:
                            type: integer
                            description: Slot của thông tin được trả về.
                            example: 1
                      value:
                        type: integer
                        description: Số dư tài khoản theo đơn vị lamport.
                        example: 0
        '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: Tham số không hợp lệ
                id: '1'
        '401':
          description: Không được ủy quyền - 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: Không được ủy quyền
                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: Quá nhiều yêu cầu
                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: Lỗi nội bộ
                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: Dịch vụ không khả dụng
                id: '1'
        '504':
          description: Hết thời gian chờ cổng kết nối - 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: Hết thời gian chờ cổng kết nối
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          enum:
            - '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
        id:
          type: string
  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).

````