XRP Ledger API Guide: How to Use account_info to Query Account Data

·

The account_info command is a fundamental tool for developers and analysts working with the XRP Ledger. It allows you to retrieve detailed information about a specific account, including XRP balance, transaction sequence, ownership status, and pending transactions. All returned data is relative to a specified ledger version, making it ideal for real-time blockchain monitoring and debugging.

Whether you're building decentralized applications, auditing wallets, or analyzing network activity, understanding how to effectively use the account_info API is essential. This guide walks you through request formats, response structures, key parameters, and practical use cases—optimized for clarity, technical accuracy, and search intent.


Understanding the account_info Command

The account_info method retrieves the current state of an account on the XRP Ledger. This includes:

All responses are tied to a specific ledger version, ensuring consistency and traceability across distributed nodes.

👉 Discover how blockchain APIs power next-generation financial tools


Supported Request Methods

You can query account information using three primary interfaces: WebSocket, JSON-RPC, and command-line interface (CLI). Each serves different development needs—from live monitoring to script automation.

WebSocket Request Example

Ideal for real-time applications that require persistent connections.

{
  "id": 2,
  "command": "account_info",
  "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
  "strict": true,
  "ledger_index": "current",
  "queue": true
}

JSON-RPC Request Example

Best for server-side integrations and HTTP-based services.

{
  "method": "account_info",
  "params": [
    {
      "account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
      "strict": true,
      "ledger_index": "current",
      "queue": true
    }
  ]
}

Command Line Request Example

Useful for testing and manual queries via rippled.

# Syntax: account_info account [ledger_index|ledger_hash] [strict]
rippled account_info r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59 true

Request Parameters Explained

ParameterTypeDescription
accountStringThe unique identifier (address) of the account to query. Required.
strictBooleanEnforces strict address validation; rejects aliases. Optional.
ledger_hashStringSpecific ledger hash to reference. Optional.
ledger_indexNumber/StringLedger index or shortcut (current, closed, validated). Optional.
queueBooleanIf true, includes details about queued transactions not yet confirmed. Optional.
signer_listsBooleanReturns associated multi-signer configurations if enabled. Optional.

Using ledger_index: "validated" ensures your results come from a fully confirmed ledger—critical for audit-grade accuracy.


Interpreting the API Response

Responses vary slightly between WebSocket and JSON-RPC but contain the same core data.

Sample WebSocket Response

{
  "id": 5,
  "status": "success",
  "type": "response",
  "result": {
    "account_data": {
      "Account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
      "Balance": "999999999960",
      "Flags": 8388608,
      "LedgerEntryType": "AccountRoot",
      "OwnerCount": 0,
      "PreviousTxnID": "4294BEBE5B569A18C0A2702387C9B1E7146DC3A5850C1E87204951C6FDAA4C42",
      "PreviousTxnLgrSeq": 3,
      "Sequence": 6,
      "index": "92FA6A9FC8EA6018D5D16532D7795C91BFB0831355BDFDA177E86C8BF997985F"
    },
    "ledger_current_index": 4,
    "queue_data": {
      "auth_change_queued": true,
      "highest_sequence": 10,
      "lowest_sequence": 6,
      "max_spend_drops_total": "500",
      "transactions": [
        {
          "auth_change": false,
          "fee": "100",
          "fee_level": "2560",
          "max_spend_drops": "100",
          "seq": 6
        }
      ],
      "txn_count": 5
    },
    "validated": false
  }
}

Key Response Fields

⚠️ If "validated": false, the data may change as new consensus occurs. For finality, always check against "validated" ledgers.

Decoding queue_data: Monitoring Pending Transactions

When "queue": true is set, the API returns queue_data, which helps monitor unconfirmed transactions.

queue_data Structure

Each transaction includes:

This data is invaluable for wallet developers detecting stuck transactions or estimating confirmation delays.

👉 Learn how real-time blockchain data drives smarter trading decisions


Practical Use Cases

1. Balance Verification in Wallet Apps

Integrate account_info to display accurate XRP balances in user wallets. Use Balance field and convert from drops to XRP.

2. Detecting Stuck Transactions

Monitor queue_data to identify high-fee or out-of-sequence transactions that haven’t confirmed—common during network congestion.

3. Auditing Account Activity

Compare PreviousTxnID and PreviousTxnLgrSeq across time intervals to detect unauthorized changes.

4. Multi-Signature Setup Validation

Use signer_lists parameter to verify complex signing configurations for enterprise custody solutions.


Core Keywords for SEO Optimization

To align with user search intent and improve discoverability, these keywords are naturally integrated throughout:

These terms reflect common developer queries and technical troubleshooting scenarios.


Frequently Asked Questions (FAQ)

Q: What does “Balance” represent in the response?
A: The balance is shown in drops (1 XRP = 1,000,000 drops). For example, "Balance": "999999999960" equals approximately 999,999.99996 XRP.

Q: Why is my response not validated?
A: When "validated": false, the result comes from a provisional ledger. Wait for ledger closure or query with "ledger_index": "validated" for finality.

Q: How do I convert drops to XRP?
A: Divide the drop amount by 1,000,000. For instance, 10,000,000 drops = 10 XRP.

Q: What is the purpose of the Sequence number?
A: The sequence number tracks how many transactions the account has sent. Each outgoing transaction must increment this value by one.

Q: Can I use this API to check token balances?
A: No—account_info only returns XRP balances. For issued tokens (IOUs), use the account_lines command instead.

Q: How often should I poll account_info for updates?
A: Avoid excessive polling. Instead, use WebSocket subscriptions (subscribe command) for real-time event-driven updates.

👉 Access powerful tools to analyze blockchain activity in real time


By mastering the account_info command, developers gain deep visibility into account states on the XRP Ledger. From debugging transaction issues to building secure financial applications, this API endpoint is a cornerstone of effective blockchain integration.