XRP — account
API reference for XRP. All methods ->
account_channels
Retrieves a list of payment channels where the account is the source of the channel.
The account_channels method returns information about an account's Payment Channels. This includes only channels where the specified account is the channel's source, not the destination. (A channel's "source" and "owner" are the same.) 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 channels where this account is the channel’s owner/source.destination_account(string — address; optional): a second account; if provided, filters results to payment channels whose destination is this account.ledger_hash(string; 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 to use, or a shortcut string to choose a ledger automatically (see Specifying Ledgers).limit(number; optional): limits the number of transactions to retrieve. Must be between 10 and 400; values outside this range are adjusted to the nearest valid value. Default: 200.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 address of the source/owner of the payment channels. Corresponds to theaccountfield of the request.channels(array of objects): list of payment channels owned by thisaccount. Each object contains the following fields:account(string): the owner of the channel, as an address.channel_id(string): a unique ID for this channel, represented as a 64-character hexadecimal string. This is also the ID of the channel object in the ledger’s state data.destination_account(string): the destination account of the channel, as an address. Only this account can receive theamountin the channel while it is open.settle_delay(unsigned integer): the number of seconds the payment channel must remain open after the owner requests to close it.public_key(string; optional): the public key for the payment channel in the XRP Ledger’s base58 format. Signed claims against this channel must be redeemed with the matching key pair.public_key_hex(string; optional): the public key for the payment channel in hexadecimal format, if one was specified at channel creation. Signed claims against this channel must be redeemed with the matching key pair.expiration(unsigned integer; optional): time in seconds since the Ripple Epoch when this channel is set to expire. This expiration date is mutable. If this value is before the close time of the most recent validated ledger, the channel is expired.cancel_after(unsigned integer; optional): time in seconds since the Ripple Epoch representing this channel’s immutable expiration, if one was specified at creation. If this is before the close time of the most recent validated ledger, the channel is expired.source_tag(unsigned integer; optional): a 32-bit unsigned integer used as a source tag for payments through this payment channel, if specified at creation. This indicates the channel’s originator or purpose. Conventionally, if you bounce payments from this channel, you should include this value in theDestinationTagof the return payment.destination_tag(unsigned integer; optional): a 32-bit unsigned integer used as a destination tag for payments through this payment channel, if specified at creation. This indicates the payment channel’s beneficiary or purpose at the destination account.
ledger_hash(string; optional): the identifying hash of the ledger version used to generate this response.ledger_index(number): the ledger index of the ledger version used to generate this response.validated(boolean; optional): iftrue, the information in this response comes from a validated ledger version; otherwise, the information is subject to change.limit(number; optional): the limit defining how many channel objects were actually returned by this request.marker(string — marker; optional): server-defined value for pagination; pass this value to the next call to resume fetching results from where this call left off. Omitted when there are no more pages of data.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "account_channels",
"params": [
{
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"channels": [
{
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"amount": "1000",
"balance": "0",
"channel_id": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
"destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"public_key": "aBR7mdD75Ycs8DRhMgQ4EMUEmBArF8SEh1hfjrT2V9DQTLNbJVqw",
"public_key_hex": "03CFD18E689434F032A4E84C63E2A3A6472D684EAF4FD52CA67742F3E24BAE81B2",
"settle_delay": 60
}
],
"ledger_hash": "42C4F4E81710B015B3BA2A81E357E30E261F58964A6AB6C012734FADB67AB40D",
"ledger_index": 99672209,
"status": "success",
"validated": true
}
}
account_currencies
Retrieves a list of currencies an account can send or receive.
The account_currencies command retrieves a list of currencies that an account can send or receive, based on its trust lines. This is not a thoroughly confirmed list, but it can be used to populate user interfaces.
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 currencies this account can send or receive.ledger_hash(string; 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 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_hash(string — hash; optional): the identifying hash of the ledger version used to retrieve this data, represented as a hexadecimal string.ledger_index(integer): the ledger index of the ledger version used to retrieve this data.receive_currencies(array of strings): list of currency codes that this account can receive.send_currencies(array of strings): list of currency codes that this account can send.validated(boolean): iftrue, the data in this response comes from a validated ledger.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "account_currencies",
"params": [
{
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"account_index": 0,
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ledger_hash": "26C97A5C542BB50D6C084EF158AC35AC4D3A94CEA57286F60552A2D55BC2DDCA",
"ledger_index": 99672360,
"receive_currencies": [
"BTC",
"CNY",
"DYM",
"EUR",
"JOE",
"MXN",
"USD",
"015841551A748AD2C1F76FF6ECB0CCCD00000000"
],
"send_currencies": [
"ASP",
"BTC",
"CHF",
"CNY",
"DYM",
"EUR",
"JOE",
"JPY",
"MXN",
"USD",
"5553445400000000000000000000000000000000"
],
"status": "success",
"validated": true
}
}
account_info
Retrieves basic data on the account.
The account_info command retrieves information about an account, its activity, and its XRP balance. 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): the account to look up.ledger_hash(string; 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 to use, or a shortcut string to choose a ledger automatically (see Specifying Ledgers).queue(boolean; optional): iftrue, returns stats about queued transactions sent by this account. Can only be used when querying data from the current open ledger.signer_lists(boolean; optional): iftrue, returns anySignerListobjects associated with this account.
Returns
The response follows the standard format, with the result containing the requested account, its data, and a ledger to which it applies, as the following fields:
account_data(object): the AccountRoot ledger object containing this account’s information as stored in the ledger.account_flags(object): the account’s flag statuses, derived from theFlagsfield of the account. Contains the following nested fields:defaultRipple(boolean): iftrue, the account allows rippling on its trust lines by default.depositAuth(boolean): iftrue, the account uses Deposit Authorization and does not accept payments from unknown parties.disableMasterKey(boolean): iftrue, the account’s master key pair is disabled.disallowIncomingCheck(boolean): iftrue, the account does not allow others to send Checks to it.disallowIncomingNFTokenOffer(boolean): iftrue, the account does not allow others to make NFT buy or sell offers to it.disallowIncomingPayChan(boolean): iftrue, the account does not allow others to create Payment Channels to it.disallowIncomingTrustline(boolean): iftrue, the account does not allow others to create trust lines to it.disallowIncomingXRP(boolean): iftrue, the account prefers not to receive XRP from others. This setting is advisory and not enforced at the protocol level.globalFreeze(boolean): iftrue, all tokens issued by the account are currently frozen.noFreeze(boolean): iftrue, the account has permanently renounced the ability to freeze individual trust lines or enforce a global freeze. See No Freeze for details.passwordSpent(boolean): iffalse, the account can send a special key-reset transaction with zero transaction cost. The protocol automatically toggles this flag; it is not user-controlled.requireAuthorization(boolean): iftrue, the account uses Authorized Trust Lines to restrict who can hold its issued tokens.requireDestinationTag(boolean): iftrue, the account requires a destination tag on all incoming payments.
signer_lists(array; optional):- API v1: omitted unless the request specified signer_lists and at least one SignerList is associated with the account. Contains an array of SignerList ledger objects for multi-signing. Since an account can own at most one SignerList, this array contains exactly one member if present. The field is nested under account_data.
- API v2: identical to API v1, but the field is returned at the root level of the response. (Clio implements API v2 behavior in all cases.)
ledger_current_index(integer; optional): the ledger index of the current in-progress ledger used when retrieving this information. Omitted if ledger_index is provided instead.ledger_index(integer; optional): the ledger index of the ledger version used to retrieve this information. This data does not include any changes from newer ledger versions.queue_data(object; optional): information about queued transactions sent by this account. Returned only if queue was set totrueand the current open ledger was queried. Describes the local rippled server’s queue state, which may differ across the network. Some fields may be omitted because certain values are computed lazily by the queuing mechanism. Contains the following nested fields:txn_count(integer): number of queued transactions from this address.auth_change_queued(boolean; optional): whether a transaction in the queue changes this address’s ways of authorizing transactions. Iftrue, no further transactions can be queued until that transaction executes or drops from the queue.lowest_sequence(integer; optional): the lowest sequence number among transactions queued by this address.highest_sequence(integer; optional): the highest sequence number among transactions queued by this address.max_spend_drops_total(string; optional): the total number of drops of XRP that could be debited from this account if every queued transaction consumes the maximum possible amount.transactions(array; optional): information about each queued transaction from this account.
validated(boolean):trueif this data originates from a validated ledger version; if omitted orfalse, the data is not final.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "account_info",
"params": [
{
"account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
"ledger_index": "current",
"queue": true
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"account_data": {
"Account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
"Balance": "88986679",
"Flags": 1048576,
"LedgerEntryType": "AccountRoot",
"MessageKey": "0200000000000000000000000038901D3A772963CF12FF7C0E010FE350B6CCC45D",
"OwnerCount": 0,
"PreviousTxnID": "083A5D87E0E10D8632A62B67CCE8C68C0E94615371E92AD591CD068DE600117A",
"PreviousTxnLgrSeq": 99424162,
"RegularKey": "rhLkGGNZdjSpnHJw4XAFw1Jy7PD8TqxoET",
"Sequence": 192223,
"index": "92FA6A9FC8EA6018D5D16532D7795C91BFB0831355BDFDA177E86C8BF997985F"
},
"account_flags": {
"allowTrustLineClawback": false,
"defaultRipple": false,
"depositAuth": false,
"disableMasterKey": true,
"disallowIncomingCheck": false,
"disallowIncomingNFTokenOffer": false,
"disallowIncomingPayChan": false,
"disallowIncomingTrustline": false,
"disallowIncomingXRP": false,
"globalFreeze": false,
"noFreeze": false,
"passwordSpent": false,
"requireAuthorization": false,
"requireDestinationTag": false
},
"ledger_current_index": 99672810,
"queue_data": {
"txn_count": 0
},
"status": "success",
"validated": false
}
}
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): iftrue, 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 a0.5:1ratio. As a special case, 0 is treated as a1:1ratio.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 a0.5:1ratio. As a special case, 0 is treated as a1:1ratio.no_ripple(boolean; optional): iftrue, this account has enabled the No Ripple flag for this trust line. Iffalse, 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): iftrue, the peer account has enabled the No Ripple flag for this trust line. Iffalse, 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): iftrue, the counterparty has authorized this trust line. Default:false.freeze(boolean; optional): iftrue, the perspective account has frozen this trust line. Default:false.freeze_peer(boolean; optional): iftrue, 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
20and400; values outside this range are adjusted to the nearest valid option. - Default:
100.
- Must be between
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): iftrue, 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 between10and400for 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): iftrue, the data in this response originates from a validated ledger version; otherwise, it may be subject to change.
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 range10to400. Positive values outside this range are replaced with the closest valid option. The default is200.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 tolimitat a time.ledger_current_index(number — ledger index; optional): Omitted ifledger_hashorledger_indexis 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 ifledger_current_indexis 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 originaltaker_paysdivided by the originaltaker_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
}
}
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-1uses the earliest validated ledger available.ledger_index_max(integer; optional): most recent ledger index to include transactions from. A value of-1uses 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): iftrue, returns transactions as hex strings instead of JSON. Default:false.forward(boolean; optional): iftrue, 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): Thelimitvalue 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 totrue, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change.
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): Thelimitvalue 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 totrue, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change.
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): Ifbinaryistrue, 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
}
}