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 — account (3/3)

API reference for XRP. All methods ->

Part 3 of 3: 1 · 2 · 3

account_tx

Retrieves a list of transactions affecting an account.

The account_tx method retrieves a list of validated transactions that involve a given account.

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; required): the unique identifier of the account, typically its address.
    • tx_type (string; optional): (Clio only) filters results to a specific transaction type (for example "Clawback", "AccountSet", "AccountDelete"). Case-insensitive. See Transaction Types.
    • ledger_index_min (integer; optional): earliest ledger index to include transactions from. A value of -1 uses the earliest validated ledger available.
    • ledger_index_max (integer; optional): most recent ledger index to include transactions from. A value of -1 uses the most recent validated ledger available.
    • ledger_hash (string — hash; optional): specifies a single ledger by its unique hash (see Specifying Ledgers).
    • ledger_index (string or unsigned integer; optional): specifies a single ledger by its index or a shortcut keyword (see Specifying Ledgers).
    • binary (boolean; optional): if true, returns transactions as hex strings instead of JSON. Default: false.
    • forward (boolean; optional): if true, returns results indexed with the oldest ledger first; otherwise, the newest ledger first. Each page may not be internally ordered, but pages overall follow the chosen order. Default: false.
    • limit (integer; optional): limits the number of transactions to retrieve. The default varies depending on server configuration. The server is not required to honor this value.
    • marker (string — marker; optional): value from a previous paginated response; resumes retrieving data where that response left off. Stable even if the server’s available ledger range changes.

Iterating over queried data:

As with other paginated methods, you can use the marker field to return multiple pages of data.

In the time between requests, "ledger_index_min": -1 and "ledger_index_max": -1 may change to refer to different ledger versions than they did before. The marker field can safely paginate even if there are changes in the ledger range from the request, so long as the marker does not indicate a point outside the range of ledgers specified in the request.

Returns

API v2

  • account (string): Unique Address identifying the related account.
  • ledger_index_min (integer — ledger index): The ledger index of the earliest ledger actually searched for transactions.
  • ledger_index_max (integer — ledger index): The ledger index of the most recent ledger actually searched for transactions.
  • limit (integer): The limit value used in the request. (This may differ from the actual limit value enforced by the server.)
  • marker (string — marker): Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off.
  • transactions (array): Array of transactions matching the request's criteria, as explained below.
  • validated (boolean): If included and set to true, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change.
tip

The server may respond with different values of ledger_index_min and ledger_index_max than you provided in the request, for example if it did not have the versions you specified on hand.

Each transaction object includes the following fields, depending on whether it was requested in JSON or hex string ("binary": true) format:

  • close_time_iso (string): The ledger close time represented in ISO 8601 time format.
  • hash (string): The unique hash identifier of the transaction.
  • ledger_hash (string): A hex string of the ledger version that included this transaction.
  • ledger_index (integer): The ledger index of the ledger version that included this transaction.
  • tx_json (object — JSON): (JSON mode) JSON object defining the transaction.
  • tx_blob (string — binary): (Binary mode) A unique hex string defining the transaction.
  • meta (object — JSON): (JSON mode) The transaction results metadata in JSON.
  • meta_blob (string — binary): (Binary mode) The transaction results metadata as a hex string.
  • validated (boolean): Whether the transaction is included in a validated ledger or not. Any transaction not yet in a validated ledger is subject to change.

API v1

  • account (string): Unique Address identifying the related account.
  • ledger_index_min (integer — ledger index): The ledger index of the earliest ledger actually searched for transactions.
  • ledger_index_max (integer — ledger index): The ledger index of the most recent ledger actually searched for transactions.
  • limit (integer): The limit value used in the request. (This may differ from the actual limit value enforced by the server.)
  • marker (string — marker): Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off.
  • transactions (array): Array of transactions matching the request's criteria, as explained below.
  • validated (boolean): If included and set to true, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change.
tip

The server may respond with different values of ledger_index_min and ledger_index_max than you provided in the request, for example if it did not have the versions you specified on hand.

Each transaction object includes the following fields, depending on whether it was requested in JSON or hex string ("binary": true) format.

  • ledger_index (integer): The ledger index of the ledger version that included this transaction.
  • tx (object — JSON): (JSON mode) JSON object defining the transaction.
  • tx_blob (string — binary): (Binary mode) Hex string representing the transaction.
  • meta (object — JSON or string — binary): If binary is true, then this is a hex string of the transaction results metadata. Otherwise, the transaction results metadata is included in JSON format.
  • validated (boolean): Whether the transaction is included in a validated ledger or not. Any transaction not yet in a validated ledger is subject to change.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "account_tx",
"params": [
{
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
"binary": false,
"forward": false,
"ledger_index_max": -1,
"ledger_index_min": -1,
"limit": 2,
"api_version": 2
}
]
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
"ledger_index_max": 100184671,
"ledger_index_min": 99766025,
"limit": 2,
"status": "success",
"transactions": [],
"validated": true
}
}