For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

XRP — gateway, noripple, Methods, ledger (1/2)

API reference for XRP. All methods ->

Part 1 of 2: 1 · 2

gateway_balances

Calculates total amounts issued by an account.

The gateway_balances method calculates the total balances issued by a given account, optionally excluding amounts held by operational addresses.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • account (string): The Address to check. This should be the issuing address.
    • strict (boolean; optional): If true, only accept an address or public key for the account parameter. Defaults to false.
    • hotwallet (string or array; optional): An operational address to exclude from the balances issued, or an array of such addresses.
    • ledger_hash (string; optional): The unique hash of the ledger version to use. (See Specifying Ledgers.)
    • ledger_index (string or unsigned integer; optional): The ledger index of the ledger version to use, or a shortcut string to choose a ledger automatically. (See Specifying Ledgers.)

Returns

The response follows the standard format, with a successful result containing the following fields:

  • account (string — address): The address of the account that issued the balances.
  • obligations (object; omitted if empty): Total amounts issued to addresses not excluded, as a map of currencies to the total value issued.
  • balances (object; omitted if empty): Amounts issued to the hotwallet addresses from the request. The keys are addresses and the values are arrays of currency amounts they hold.
  • assets (object; omitted if empty): Total amounts held that are issued by others. In the recommended configuration, the issuing address should have none.
  • ledger_hash (string — hash; optional): The identifying hash of the ledger version that was used to generate this response.
  • ledger_index (number — ledger index; optional): The ledger index of the ledger version that was used to generate this response.
  • ledger_current_index (number — ledger index; optional): (Omitted if ledger_current_index is provided). The ledger index of the current in-progress ledger version, which was used to retrieve this information.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "gateway_balances",
"params": [
{
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
"hotwallet": [
"rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ",
"ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt"
],
"ledger_index": "validated",
"strict": true
}
]
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
"assets": {
"r9F6wk8HkXrgYWoJ7fsv4VrUBVoqDVtzkH": [
{
"currency": "BTC",
"value": "5444166510000000e-26"
}
],
"rPU6VbckqCLW4kb51CWqZdxvYyQrQVsnSj": [
{
"currency": "BTC",
"value": "1029900000000000e-26"
}
],
"rpR95n1iFkTqpoy1e878f4Z1pVHVtWKMNQ": [
{
"currency": "BTC",
"value": "4000000000000000e-30"
}
],
"rwmUaXsWtXU4Z843xSYwgt1is97bgY8yj6": [
{
"currency": "BTC",
"value": "8700000000000000e-30"
}
]
},
"balances": {
"rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ": [
{
"currency": "EUR",
"value": "144816.1965999999"
}
],
"ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt": [
{
"currency": "USD",
"value": "6677.38614"
}
]
},
"frozen_balances": {
"r4keXr5myiU4iTLh68ZqZ2CgsJ8dM9FSW6": [
{
"currency": "BTC",
"value": "0.091207822800868"
}
]
},
"ledger_hash": "9F04F45FC6A7B4BE8DA04580F7E4E23DCCE58A9FD73178296CA70319C5B799F1",
"ledger_index": 100185180,
"obligations": {
"BTC": "1761.964986208178",
"EUR": "813788.3511514511",
"GBP": "4973.797603049582",
"USD": "6734902.401181124"
},
"status": "success",
"validated": true
}
}

noripple_check

Gets recommended changes to an account's Default Ripple and No Ripple settings.

The noripple_check command provides a quick way to check the status of the Default Ripple field for an account and the No Ripple flag of its trust lines, compared with the recommended settings.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • account (string): A unique identifier for the account, most commonly the account's address.
    • role (string): Whether the address refers to a gateway or user. Recommendations depend on the role of the account. Issuers must have Default Ripple enabled and must disable No Ripple on all trust lines. Users should have Default Ripple disabled, and should enable No Ripple on all trust lines.
    • transactions (boolean; optional): If true, include an array of suggested transactions, as JSON objects, that you can sign and submit to fix the problems. The default is false.
    • limit (unsigned integer; optional): The maximum number of trust line problems to include in the results. Defaults to 300.
    • ledger_hash (string; optional): The unique hash of the ledger version to use. (See Specifying Ledgers.)
    • ledger_index (string or unsigned integer; optional): The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. (See Specifying Ledgers.)

Returns

The response follows the standard format, with a successful result containing the following fields:

  • ledger_current_index (number): The ledger index of the ledger used to calculate these results.
  • problems (array): Array of strings with human-readable descriptions of the problems. This includes up to one entry if the account's Default Ripple setting is not as recommended, plus up to limit entries for trust lines whose No Ripple setting is not as recommended.
  • transactions (array; optional): If the request specified transactions as true, this is an array of JSON objects, each of which is the JSON form of a transaction that should fix one of the described problems. The length of this array is the same as the problems array, and each entry is intended to fix the problem described at the same index into that array.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "noripple_check",
"params": [
{
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"ledger_index": "current",
"limit": 2,
"role": "gateway",
"transactions": true
}
]
}'

Response example

{
"result": {
"ledger_current_index": 100203014,
"problems": [
"You should immediately set your default ripple flag",
"You should clear the no ripple flag on your USD line to rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
"You should clear the no ripple flag on your EUR line to rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
"You should clear the no ripple flag on your CNY line to rnuF96W4SZoCJmbHYBFoJZpR8eCaxNvekK",
"You should clear the no ripple flag on your XAU line to r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
"You should clear the no ripple flag on your 015841551A748AD2C1F76FF6ECB0CCCD00000000 line to rs9M85karFkCRjvc6KMWn8Coigm9cbcgcx",
"You should clear the no ripple flag on your AUX line to r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
"You should clear the no ripple flag on your CNY line to razqQKzJRdB4UxFPWf5NEpEG3WMkmwgcXA",
"You should clear the no ripple flag on your JPY line to rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"You should clear the no ripple flag on your USD line to rfF3PNkwkq1DygW2wum2HK3RGfgkJjdPVD",
"You should clear the no ripple flag on your USD line to r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X"
],
"status": "success",
"transactions": [
{
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"Fee": 10,
"Sequence": 1406,
"SetFlag": 8,
"TransactionType": "AccountSet"
},
{
"Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"Fee": 10,
"Flags": 262144,
"LimitAmount": {
"currency": "USD",
"issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
"value": "5"
},
"Sequence": 1407,
"TransactionType": "TrustSet"
}
],
"validated": false
}
}

Ledger Methods:

A ledger version contains a header, a transaction tree, and a state tree, which contain account settings, trustlines, balances, transactions, and other data. Use these methods to retrieve ledger info.

ledger

Retrieves info on the ledger.

Retrieves information about the public ledger.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • ledger_hash (string — hash; optional): A 32-byte hex string for the ledger version to use. (See Specifying Ledgers).
    • ledger_index (number or string; optional): The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. (See Specifying Ledgers).
    • transactions (boolean; optional): If true, return information on transactions in the specified ledger version. The default is false. Ignored if you did not specify a ledger version.
    • expand (boolean; optional): Provide full JSON-formatted information for transaction/account information instead of only hashes. The default is false. Ignored unless you request transactions, accounts, or both.
    • owner_funds (boolean; optional): If true, include owner_funds field in the metadata of OfferCreate transactions in the response. The default is false. Ignored unless transactions are included and expand is true.
    • binary (boolean; optional): If true, and transactions and expand are both also true, return transaction information in binary format (hexadecimal string) instead of JSON format.
    • queue (boolean; optional): If true, and the command is requesting the current ledger, includes an array of queued transactions in the results.

Returns

The response follows the standard format, with a successful result containing information about the ledger, including the following fields:

  • ledger (object): The complete ledger header data of this ledger, with some additional fields added for convenience.
  • ledger.account_hash (string): Hash of all account state information in this ledger, as hexadecimal.
  • ledger.close_flags (number): A bit-map of flags relating to the closing of this ledger.
  • ledger.close_time (number): The time this ledger was closed, in seconds since the Ripple Epoch.
  • ledger.close_time_human (string): The time this ledger was closed, in human-readable format. Always uses the UTC time zone.
  • ledger.close_time_resolution (number): Ledger close times are rounded to within this many seconds.
  • ledger.closed (boolean): Whether this ledger has been closed or not.
  • ledger.ledger_hash (string): Unique identifying hash of the entire ledger.
  • ledger.ledger_index (string — API v1; number — API v2): The Ledger Index of this ledger.
  • ledger.parent_close_time (number): The time at which the previous ledger was closed.
  • ledger.parent_hash (string): The unique identifying hash of the ledger that came immediately before this one, as hexadecimal.
  • ledger.total_coins (string): Total number of XRP drops in the network, as a quoted integer. (This decreases as transaction costs destroy XRP.)
  • ledger.transaction_hash (string): Hash of the transaction information included in this ledger.
  • ledger.transactions (array; optional): Transactions applied in this ledger version. By default, members are the transactions’ identifying Hash strings. If the request specified expand as true, members are full representations of the transactions instead, in either JSON or binary depending on whether the request specified binary as true.
  • ledger_hash (string): The unique identifying hash of the entire ledger, as hexadecimal.
  • ledger_index (number): The Ledger Index of this ledger.
  • validated (boolean; optional): If true, this is a validated ledger version. If omitted or set to false, this ledger’s data is not final.
  • queue_data (array; optional): (Omitted unless requested with the queue parameter) Array of objects describing queued transactions, in the same order as the queue. If the request specified expand as true, members contain full representations of the transactions, in either JSON or binary depending on whether the request specified binary as true.

Each member of the queue_data array represents one transaction in the queue. Some fields of this object may be omitted because they have not yet been calculated. The fields of this object are as follows:

  • account (string): The Address of the sender for this queued transaction.
  • tx (string or object): By default, this is a string containing the identifying hash of the transaction. If transactions are expanded in binary format, this is an object whose only field is tx_blob, containing the binary form of the transaction as a decimal string. If transactions are expanded in JSON format, this is an object containing the transaction object including the transaction's identifying hash in the hash field.
  • retries_remaining (number): How many times this transaction can be retried before being dropped.
  • preflight_result (string): The tentative result from preliminary transaction checking. This is always tesSUCCESS.
  • last_result (string; optional): If this transaction was left in the queue after getting a retriable (ter) result, this is the exact ter result code it got.
  • auth_change (boolean; optional): Whether this transaction changes this address's ways of authorizing transactions.
  • fee (string; optional): The Transaction Cost of this transaction, in drops of XRP.
  • fee_level (string; optional): The transaction cost of this transaction, relative to the minimum cost for this type of transaction, in fee levels.
  • max_spend_drops (string; optional): The maximum amount of XRP, in drops, this transaction could potentially send or destroy.

If the request specified "owner_funds": true and expanded transactions, the response has a field owner_funds in the metaData object of each OfferCreate transaction. The purpose of this field is to make it easier to track the funding status of offers with each new validated ledger. This field is defined slightly differently than the version of this field in Order Book subscription streams:

  • owner_funds (string): Numeric amount of the TakerGets currency that the Account sending this OfferCreate transaction has after the execution of all transactions in this ledger. This does not check whether the currency amount is frozen.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger",
"params": [
{
"ledger_index": "validated",
"transactions": false,
"expand": false,
"owner_funds": false
}
]
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ledger": {
"account_hash": "E8C6EF996B38EFC2E297B3165F6B687433B1DF137BDCF804C0B0F9E393E0D045",
"close_flags": 0,
"close_time": 816442750,
"close_time_human": "2025-Nov-14 13:39:10.000000000 UTC",
"close_time_iso": "2025-11-14T13:39:10Z",
"close_time_resolution": 10,
"closed": true,
"ledger_hash": "344AC8FCFC579E9EAC59CAFEBCC1E2EA36A261F4EB2A6CC649380C351F402397",
"ledger_index": "100204822",
"parent_close_time": 816442741,
"parent_hash": "ADA5D8A5A554881A9E45A8EC88FBDADD5D4D47213F0FFBCE23001AD7E37B5768",
"total_coins": "99985759346884737",
"transaction_hash": "03E26EC74BFBEEFEBD19FD512A16809C1A165B1A2F9CFF4BFD987994FCA60334"
},
"ledger_hash": "344AC8FCFC579E9EAC59CAFEBCC1E2EA36A261F4EB2A6CC649380C351F402397",
"ledger_index": 100204822,
"status": "success",
"validated": true
}
}