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

API reference for XRP. All methods ->

Part 2 of 3: 1 · 2 · 3

account_lines

Retrieves info on the account's trust lines.

The account_lines method returns information about an account's trust lines, which contain balances in all non-XRP currencies and assets. All information retrieved is relative to a particular version of the 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):

    • account (string — address; required): look up trust lines connected to this account, from this account’s perspective.
    • ignore_default (boolean; optional): if true, omits trust lines where this account’s side is in the default state. Default: false.
    • ledger_hash (string — hash; optional): the unique hash of the ledger version to use (see Specifying Ledgers).
    • ledger_index (number or string; optional): the ledger index of the ledger version to use, or a shortcut string to choose a ledger automatically (see Specifying Ledgers).
    • limit (number; optional): limits the number of trust lines to retrieve. Must be between 10 and 400. Values outside this range are adjusted to the nearest valid option. Default: 200.
    • marker (string — marker; optional): value from a previous paginated response; resumes retrieving data where that response left off.
    • peer (string — address; optional): a second account; if provided, filters results to trust lines connecting the two accounts.

Returns

The response follows the standard format, with a successful result containing the address of the account and an array of trust line objects. Specifically, the result object contains the following fields:

  • account (string): the unique address of the account this request corresponds to — the perspective account for the listed trust lines.

  • lines (array of objects): array of trust line objects associated with the specified account. If the number of trust lines is large, only returns up to the limit at a time. Each object contains the following fields:

    • account (string — address): the counterparty to this trust line.
    • balance (string — number): the current balance held on this line.
      • A positive balance indicates that the perspective account holds value.
      • A negative balance indicates that the perspective account owes value.
    • currency (string — currency code): the currency code of the token that this trust line represents.
    • limit (string — number): the maximum amount of the given currency that this account is willing to owe the peer account.
    • limit_peer (string — number): the maximum amount of the given currency that the counterparty is willing to owe the perspective account.
    • quality_in (number): rate at which the account values incoming balances on this trust line, as a ratio of this value per 1 billion units. For example, a value of 500 million represents a 0.5:1 ratio. As a special case, 0 is treated as a 1:1 ratio.
    • quality_out (number): rate at which the account values outgoing balances on this trust line, as a ratio of this value per 1 billion units. For example, a value of 500 million represents a 0.5:1 ratio. As a special case, 0 is treated as a 1:1 ratio.
    • no_ripple (boolean; optional): if true, this account has enabled the No Ripple flag for this trust line. If false, the flag is disabled, but this is not considered default when Default Ripple is also disabled. If omitted, No Ripple is disabled and Default Ripple is enabled.
    • no_ripple_peer (boolean; optional): if true, the peer account has enabled the No Ripple flag for this trust line. If false, the flag is disabled, but this is not considered default when Default Ripple is also disabled. If omitted, No Ripple is disabled and Default Ripple is enabled.
    • authorized (boolean; optional): if true, the perspective account has authorized this trust line. Default: false.
    • peer_authorized (boolean; optional): if true, the counterparty has authorized this trust line. Default: false.
    • freeze (boolean; optional): if true, the perspective account has frozen this trust line. Default: false.
    • freeze_peer (boolean; optional): if true, the counterparty has frozen this trust line. Default: false.
  • ledger_current_index (integer; optional): the ledger index used when retrieving this data. Present only when using an open ledger version.

  • ledger_index (integer; optional): the ledger index used when retrieving this data. Present only when using a closed ledger version.

  • ledger_hash (string — hash; optional): the identifying hash of the ledger version used when retrieving this data. This field is only provided when using a closed ledger version.

  • marker (string — marker; optional): server-defined value indicating pagination; pass this to the next call to resume retrieving results from where this response ended. Omitted when there are no additional pages.

  • limit (number; optional): the maximum number of trust lines retrieved. The server may return fewer than the specified limit even if more results are available. Default: 200.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "account_lines",
"params": [
{
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"api_version": 2
}
]
}'

Response example

{
"result": {
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"ledger_current_index": 99673270,
"lines": [
{
"account": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
"balance": "0",
"currency": "ASP",
"limit": "0",
"limit_peer": "10",
"quality_in": 0,
"quality_out": 0
},
{
"account": "rE6R3DWF9fBD7CyiQciePF9SqK58Ubp8o2",
"balance": "0",
"currency": "JOE",
"limit": "0",
"limit_peer": "100",
"no_ripple_peer": true,
"quality_in": 0,
"quality_out": 0
}
],
"status": "success",
"validated": false
}
}

account_nfts

Retrieves a list of all NFTs for an account.

The account_nfts method returns a list of NFToken objects for the specified 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 an account (typically, address). Returns a list of NFTs owned by this account.
    • ledger_hash (string; optional): the unique hash of the ledger version to use (see Specifying Ledgers).
    • ledger_index (string or number; optional): the ledger index of the ledger version to use, or a shortcut string to choose a ledger automatically (see Specifying Ledgers).
    • limit (integer; optional): limits the number of token pages to retrieve. Each page can contain up to 32 NFTs.
      • Must be between 20 and 400; values outside this range are adjusted to the nearest valid option.
      • Default: 100.
    • marker (string — marker; optional): value from a previous paginated response; resumes retrieving data where that response left off.

Returns

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

  • account (string): the account that owns the list of NFTs.
  • account_nfts (array of objects): list of NFTs owned by the account. Each object represents one NFToken and includes the following fields:
    • Flags (number): a bitmap of boolean flags enabled for this NFToken. See NFToken Flags for possible values.
    • Issuer (string — address): the account that issued this NFToken.
    • NFTokenID (string): the unique identifier of this NFToken, represented as a hexadecimal string.
    • NFTokenTaxon (number): the unscrambled version of this token’s taxon. Tokens sharing the same taxon may represent multiple instances of a limited series.
    • URI (string): the URI data associated with this NFToken, represented in hexadecimal format.
    • nft_serial (number): the token sequence number of this NFToken, unique per issuer.
  • ledger_hash (string; optional): the identifying hash of the ledger version used to generate this response.
  • ledger_index (number; optional): the ledger index of the ledger version used to generate this response.
  • ledger_current_index (number; optional): the ledger index of the current in-progress ledger version used to generate this response.
  • validated (boolean): if true, the information in this response comes from a validated ledger version; otherwise, the information is subject to change.
  • marker (string — marker; optional): server-defined value indicating pagination. Pass this to the next call to resume fetching results from where this response ended. Omitted when there are no additional pages.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "account_nfts",
"params": [
{
"account": "rpoYSH7mntUSWF41gD7RhJQzrNHxogAb6W"
}
]
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"account": "rpoYSH7mntUSWF41gD7RhJQzrNHxogAb6W",
"account_nfts": [],
"ledger_current_index": 99893274,
"status": "success",
"validated": false
}
}

account_objects

Retrieves all ledger objects owned by an account.

The account_objects command returns all ledger entries owned by an account, in their raw ledger format.

There are other API methods that are specialized for getting certain types of ledger entry, such as the account_lines method for trust lines, or account_offers method for offers. These methods provide a processed view of the data that is more suitable for typical use cases. Use account_objects if you want to get ledger entries of types that don't have a specialized method, or if you want to get the entries in their canonical format.

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 — address; required): retrieves ledger entries associated with this account.
    • deletion_blockers_only (boolean; optional): if true, returns only ledger entries that would prevent this account from being deleted. Default: false.
    • ledger_hash (string — hash; optional): the unique hash of the ledger version to use (see Specifying Ledgers).
    • ledger_index (number or string; optional): the ledger index of the ledger version to use, or a shortcut string to choose a ledger automatically (see Specifying Ledgers).
    • limit (number; optional): the maximum number of ledger entries to include in the results. Must be between 10 and 400 for non-admin connections. Default: 200.
    • marker (string — marker; optional): value from a previous paginated response; resumes retrieving data where that response left off.
    • type (string; optional): filters results by a specific type of ledger entry. Accepts canonical or short names of ledger entry types (case-insensitive). Ledger entry types that cannot appear in an owner directory are not allowed. If omitted, all types are returned.

Returns

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

  • account (string — address): the account this request corresponds to.
  • account_objects (array of objects): array of ledger entries found in this account’s owner directory. Includes both:
    • Entries owned directly by this account, and
    • Entries linked to this account but owned by others (for example, escrows where this account is the destination).
    • Each member is a ledger entry in its raw ledger format. The number of entries may be fewer than the value specified in limit.
  • ledger_hash (string; optional): the identifying hash of the ledger used to generate this response.
  • ledger_index (number; optional): the ledger index of the ledger version used to generate this response.
  • ledger_current_index (number; optional): the ledger index of the open ledger version used to generate this response.
  • limit (number; optional): the limit value that was applied in this request, if specified.
  • marker (string — marker; optional): server-defined value indicating pagination. Pass this to the next call to resume retrieving data where this response ended. Omitted when there are no additional pages.
  • validated (boolean; optional): if true, the data in this response originates from a validated ledger version; otherwise, it may be subject to change.
warning

The account_objects array may be empty even if there are additional ledger entries to retrieve. This is especially likely when using type to filter ledger entry types. If the response includes a marker field, there are additional pages of data; if the response does not include a marker, then this is the end of the data. This behavior is a consequence of how the API method iterates through the account's owner directory, and a precaution against requests putting excessive load on the server.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "account_objects",
"params": [
{
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"ledger_index": "validated",
"type": "state",
"deletion_blockers_only": false,
"limit": 10
}
]
}'

Response example

{
"result": {
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"account_objects": [
{
"Balance": {
"currency": "ASP",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "0"
},
"Flags": 65536,
"HighLimit": {
"currency": "ASP",
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"value": "0"
},
"HighNode": "0",
"LedgerEntryType": "RippleState",
"LowLimit": {
"currency": "ASP",
"issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
"value": "10"
},
"LowNode": "0",
"PreviousTxnID": "BF7555B0F018E3C5E2A3FF9437A1A5092F32903BE246202F988181B9CED0D862",
"PreviousTxnLgrSeq": 1438879,
"index": "2243B0B630EA6F7330B654EFA53E27A7609D9484E535AB11B7F946DF3D247CE9"
}
],
"ledger_hash": "3E5A1F0602C9699922CBE7BD3846D0C22A584867FFAF9787A1C676315F0797B0",
"ledger_index": 99893571,
"limit": 10,
"marker": "F60ADF645E78B69857D2E4AEC8B7742FEABC8431BD8611D099B428C3E816DF93,94A9F05FEF9A153229E2E997E64919FD75AAE2028C8153E8EBDB4440BD3ECBB5",
"status": "success",
"validated": true
}
}

account_offers

Retrieves info on the account's currency exchange offers.

The account_offers method retrieves a list of offers made by a given account that are outstanding as of a particular ledger version.

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 — address; required): Look up Offers placed by this account.
    • ledger_hash (hash; optional): The unique hash of the ledger version to use. (See Specifying Ledgers)
    • ledger_index (ledger index; optional): The ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. (See Specifying Ledgers)
    • limit (number; optional): Limit the number of Offers to retrieve. The server may return fewer than this number of results. Must be within the inclusive range 10 to 400. Positive values outside this range are replaced with the closest valid option. The default is 200.
    • marker (marker; optional): Value from a previous paginated response. Resume retrieving data where that response left off.

Returns

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

  • account (string): Unique Address identifying the account that made the offers.
  • offers (array): Array of objects, where each object represents an offer made by this account that is outstanding as of the requested ledger version. If the number of offers is large, only returns up to limit at a time.
  • ledger_current_index (number — ledger index; optional): Omitted if ledger_hash or ledger_index is provided. The ledger index of the current in-progress ledger version, which was used when retrieving this data.
  • ledger_index (number — ledger index; optional): Omitted if ledger_current_index is provided instead. The ledger index of the ledger version that was used when retrieving this data, as requested.
  • ledger_hash (string — hash; optional): The identifying hash of the ledger version that was used when retrieving this data.
  • marker (marker; optional): Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. Omitted when there are no pages of information after this one.

Each offer object contains the following fields:

  • flags (unsigned integer): Options set for this offer entry as bit-flags.
  • seq (unsigned integer): Sequence number of the transaction that created this entry. (Transaction sequence numbers are relative to accounts.)
  • taker_gets (string or object): The amount the account accepting the offer receives, as a String representing an amount in XRP, or a currency specification object. (See Specifying Currency Amounts).
  • taker_pays (string or object): The amount the account accepting the offer provides, as a String representing an amount in XRP, or a currency specification object. (See Specifying Currency Amounts).
  • quality (string): The exchange rate of the offer, as the ratio of the original taker_pays divided by the original taker_gets. When executing offers, the offer with the most favorable (lowest) quality is consumed first; offers with the same quality are executed from oldest to newest.
  • expiration (unsigned integer; optional): A time after which this offer is considered unfunded, as the number of seconds since the Ripple Epoch. See also: Offer Expiration.

Request example

curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "account_offers",
"params": [
{
"account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM"
}
]
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM",
"ledger_current_index": 99895001,
"offers": [],
"status": "success",
"validated": false
}
}