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