XRP — ledger, Methods
API reference for XRP. All methods ->
ledger_entry
Retrieves a single item from a ledger version.
The ledger_entry method returns a single ledger entry from the XRP Ledger in its raw format. See ledger format for information on the different types of entries you can retrieve.
Request format
This method can retrieve several distinct types of data. You can select which type of item to retrieve by passing the appropriate parameters, comprised of the general and type-specific fields listed below, and following the standard request formatting. (For example, a WebSocket request always has the command field and optionally an id field, and a JSON-RPC request uses the method and params fields.)
General fields
-
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):binary(boolean; optional): Iftrue, return the requested ledger entry's contents as a hex string in the XRP Ledger's binary format. Otherwise, return data in JSON format. The default isfalse.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 (e.g. "validated", "closed", or "current") to choose a ledger automatically. (See Specifying Ledgers.)include_deleted(boolean; optional, Clio servers only): If set totrueand the queried object has been deleted, returns its complete data as it was prior to its deletion. If set tofalseor not provided, and the queried object has been deleted, returnsobjectNotFound(current behavior).
Specific fields
In addition to the general fields above, you must specify exactly 1 of the specific fields to indicate what type of entry to retrieve, along with its sub-fields as appropriate. The valid fields are:
- Get Ledger Entry by ID
- Get AccountRoot Entry
- Get AMM Entry
- Get Bridge Entry
- Get Credential Entry
- Get DirectoryNode Entry
- Get Offer Entry
- Get Oracle Entry
- Get RippleState Entry
- Get Check Entry
- Get Escrow Entry
- Get PayChannel Entry
- Get DepositPreauth Entry
- Get Ticket Entry
- Get NFT Page
- Get MPT Issuance Object
- Get MPToken Object
Get Ledger Entry by ID
Retrieve any type of ledger entry by its unique ID.
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):index(string): The ledger entry ID of a single entry to retrieve from the ledger, as a 64-character (256-bit) hexadecimal string.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4",
"ledger_index": "validated"
}
]
}'
Response example
{
"result": {
"index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4",
"ledger_hash": "0F7D2D0313C7A3D69433AEAB715D8034A7B5F9E07534FDEB211EBD25A99753DE",
"ledger_index": 100449979,
"node": {
"Amendments": [
"42426C4D4F1009EE67080A9B7965B44656D7714D104A72F9B4369F97ABF044EE",
"4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373",
"6781F8368C4771B83E8B821D88F580202BCB4228075297B19E4FDC5233F1EFDC",
"740352F2412A9909880C23A559FCECEDA3BE2126FED62FC7660D628A06927F11"
],
"Flags": 0,
"LedgerEntryType": "Amendments",
"PreviousTxnID": "14853FF2D09D198B576A531C50883C59D71474BA9072C1F5C0ED1DD57882B922",
"PreviousTxnLgrSeq": 99226369,
"index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4"
},
"status": "success",
"validated": true
}
}
Get AccountRoot Entry
Retrieve an AccountRoot entry by its address. This is roughly equivalent to the account_info method.
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_root(string — address): The classic address of the AccountRoot entry to retrieve.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"account_root": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
"ledger_hash": "F12172CAE7E0B4E9283323ACFEC6FA41212A7B10F2D530FD0D891D4044533E01",
"ledger_index": 100469352,
"node": {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"AccountTxnID": "932CC7E9BAC1F7B9FA5381679F293EEC0A646E5E7F2F6D14C85FEE2102F0E66C",
"Balance": "1138222650",
"Domain": "6D64756F31332E636F6D",
"EmailHash": "98B4375E1D753E5B91627516F6D70977",
"Flags": 9568256,
"LedgerEntryType": "AccountRoot",
"MessageKey": "0000000000000000000000070000000300",
"OwnerCount": 17,
"PreviousTxnID": "E5C3578BDBEBDCDE7E1697E3BA6A1CF04B17CCEBDE4939200680FEF530C7978E",
"PreviousTxnLgrSeq": 94448149,
"RegularKey": "rD9iJmieYHn8jTtPjwwkW2Wm9sVDvPXLoJ",
"Sequence": 393,
"TicketCount": 5,
"TransferRate": 4294967295,
"index": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8"
},
"status": "success",
"validated": true
}
}
Get AMM Entry
Retrieve an Automated Market-Maker (AMM) object from the ledger. This is similar to amm_info method but the ledger_entry version returns only the ledger entry as stored.
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):amm(object or string): The AMM to retrieve. If you specify a string, it must be the object ID of the AMM, as hexadecimal. If you specify an object, it must containassetandasset2sub-fields.amm.asset(object): One of the two assets in this AMM's pool, as a currency object without an amount.amm.asset2(object): The other of the two assets in this AMM's pool, as a [currency object without an amount]https://xrpl.org/docs/references/protocol/data-types/currency-formats#specifying-without-amounts.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"amm": {
"asset": {
"currency": "string"
},
"asset2": {
"currency" : "string",
"issuer" : "string"
}
},
"ledger_index": "string"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ledger_hash": "string",
"ledger_index": integer,
"node": {
"LedgerEntryType": "string",
"index": "string",
"AMM": {
"Asset": {
"currency": "string",
"issuer": "string"
},
"Asset2": {
"currency": "string",
"issuer": "string"
},
"LPTokenBalance": "string",
"TradingFee": integer,
"VoteSlots": [
{
"Account": "string",
"TradingFee": integer,
"VoteWeight": "string"
}
],
"AuctionSlot": {
"Account": "string",
"Price": {
"value": "string",
"currency": "string",
"issuer": "string"
},
"Expiration": integer
}
},
"Flags": integer
},
"validated": boolean
}
}
Get Bridge Entry
(Requires the XChainBridge amendment.)
Retrieve a Bridge entry which represents a single cross-chain bridge that connects the XRP Ledger with another blockchain.
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):bridge_account(string): The account that submitted theXChainCreateBridgetransaction on the blockchain.bridge(object): The Bridge to retrieve. Includes the door accounts and assets on the issuing and locking chain.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"bridge_account": "string",
"bridge": {
"locking_chain_door": "string",
"locking_chain_issue": {
"currency": "string",
"issuer": "string"
},
"issuing_chain_door": "string",
"issuing_chain_issue": {
"currency": "string",
"issuer": "string"
}
}
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ledger_hash": "string",
"ledger_index": integer,
"node": {
"LedgerEntryType": "string",
"index": "string",
"Bridge": {
"LockingChainDoor": "string",
"LockingChainIssue": {
"currency": "string",
"issuer": "string"
},
"IssuingChainDoor": "string",
"IssuingChainIssue": {
"currency": "string",
"issuer": "string"
}
},
"Flags": integer,
"OwnerNode": "string"
},
"validated": boolean
}
}
Get Credential Entry
Retrieve a Credential entry, which represents an attestation by one account about another 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):credential(object or string; required): Specify the Credential to retrieve. If a string, must be the ledger entry ID of the entry, as hexadecimal. If an object, requiressubject,issuer, andcredential_typesub-fields.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"credential": {
"subject": "string",
"issuer": "string",
"credential_type": "string"
},
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ledger_hash": "string",
"ledger_index": integer,
"node": {
"LedgerEntryType": "string",
"index": "string",
"Credential": {
"Subject": "string",
"Issuer": "string",
"CredentialType": "string"
},
"Flags": integer
},
"validated": boolean
}
}
Get DirectoryNode Entry
Retrieve a DirectoryNode which contains a list of other ledger objects. Can be provided as string (object ID of the Directory) or as an object.
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):directory(object or string): The DirectoryNode to retrieve. If a string, must be the object ID of the directory, as hexadecimal. If an object, requires eitherdir_rootorowneras a sub-field, plus optionally asub_indexsub-field.directory.sub_index(unsigned integer; optional): If provided, jumps to a later "page" of the DirectoryNode.directory.dir_root(string; optional): Unique index identifying the directory to retrieve, as a hex string.directory.owner(string; optional): Unique address of the account associated with this directory.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"directory": {
"owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"sub_index": 0
},
"ledger_index": "validated"
}
]
}'
Response example
{
"result": {
"index": "3B9C0CE77FCE7BCEE1A68F1E26AC467AF326239D0D816CE705E4A0E2DAD03F6D",
"ledger_hash": "C36B922A1D7453928D8477DCE0F512DC914F3DBC8C099780895588A412CFB31D",
"ledger_index": 100471753,
"node": {
"Flags": 0,
"Indexes": [
"0D9D9CDDB28263938B423CE74FF3B4F6D960BA0F16EB7CEB36AB7937439ED73A",
"28ADCBD6F9A4B18949EC5CDBB3411F1D5826ED0ECB149AE14AED6D8784EA39EE",
"556B13E58990CC22D3379BCC6D55F46237F11713AD809DF3E7860DAB55B7F3EF",
"6451BF1D41FCDA846C4B60E6F4E4914F1C4EC3015FF978642B7358A14DAE1C26",
"6C3556BE2D440A3BEE999CC77657BA8F5DC473DFE44D4E11A8EE45B49F15FD4A",
"731A16474E86C07C62B3042BD2C223ED85EBD54E3B540E7E2739187EF9B483BA"
],
"LedgerEntryType": "DirectoryNode",
"Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"PreviousTxnID": "DDA5BDDF8DA08065B36548BE127730CB160B106DCCF9476ABB2FABE61BA3135C",
"PreviousTxnLgrSeq": 94384123,
"RootIndex": "3B9C0CE77FCE7BCEE1A68F1E26AC467AF326239D0D816CE705E4A0E2DAD03F6D",
"index": "3B9C0CE77FCE7BCEE1A68F1E26AC467AF326239D0D816CE705E4A0E2DAD03F6D"
},
"status": "success",
"validated": true
}
}
Get Offer Entry
Retrieve an Offer entry which defines an offer to exchange currency. Can be provided as string (unique index of the Offer) or as an object.
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): -
offer(object or string): If a string, interpret as ledger entry ID of the Offer to retrieve. If an object, requires the sub-fieldsaccountandseqto uniquely identify the offer.offer.account(string — address; required ifofferis an object): The account that placed the offer.offer.seq(unsigned integer; required ifofferis an object): The Sequence Number of the transaction that created the Offer entry.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"offer": {
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"seq": 359
},
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"index": "D0A063DEE0B0EC9522CF35CD55771B5DCAFA19A133EE46A0295E4D089AF86438",
"ledger_hash": "9D360371ABE2F2FA4AFE1FB489988E752792185975CE1CEEFACE1B86CB327AAD",
"ledger_index": 100471866,
"node": {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"BookDirectory": "5A70682882F317175860A1188FAFF2757537D1A66B8500894E038D7EA4C68000",
"BookNode": "0",
"Flags": 0,
"LedgerEntryType": "Offer",
"OwnerNode": "0",
"PreviousTxnID": "2B44EBE00728D04658E597A85EC4F71D20503B31ABBF556764AD8F7A80BA72F6",
"PreviousTxnLgrSeq": 18555460,
"Sequence": 359,
"TakerGets": "1000000000",
"TakerPays": {
"currency": "FOO",
"issuer": "rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v",
"value": "100"
},
"index": "D0A063DEE0B0EC9522CF35CD55771B5DCAFA19A133EE46A0295E4D089AF86438"
},
"status": "success",
"validated": true
}
}
Get Oracle Entry
Retrieve an Oracle entry which represents a single price oracle that can store token prices.
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):oracle(object; required): The oracle identifier.oracle.account(string — address; required): The account that controls theOracleobject.oracle.oracle_document_id(number; required): A unique identifier of the price oracle for theAccount.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"oracle" : {
"account": "string",
"oracle_document_id": number
},
"ledger_index": "string"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ledger_hash": "string",
"ledger_index": integer,
"node": {
"LedgerEntryType": "string",
"index": "string",
"Oracle": {
"Account": "string",
"OracleDocumentID": number,
"URI": "string",
"LastUpdateTime": integer,
"PriceDataSeries": [
{
"Price": "string",
"Scale": integer,
"Timestamp": integer
}
]
},
"Flags": integer
},
"validated": boolean
}
}
Get RippleState Entry
Retrieve a RippleState entry which tracks a (non-XRP) currency balance between two accounts.
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):state(object; optional): Alias toripple_state.ripple_state(object; optional): Object specifying the RippleState (trust line) object to retrieve. Theaccountsandcurrencysub-fields are required to uniquely specify the RippleState entry to retrieve.ripple_state.accounts(array; required ifripple_stateis specified): 2-length array of account Addresses, defining the two accounts linked by this RippleState entry.ripple_state.currency(string; required ifripple_stateis specified): Currency Code of the RippleState entry to retrieve.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"ripple_state": {
"accounts": [
"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"
],
"currency": "USD"
},
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"index": "9CA88CDEDFF9252B3DE183CE35B038F57282BC9503CDFA1923EF9A95DF0D6F7B",
"ledger_hash": "03983977B9497B624E8A735205FFF3729A9F06B5C7384E59638B8147F648EDF8",
"ledger_index": 100472021,
"node": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "0"
},
"Flags": 8847360,
"HighLimit": {
"currency": "USD",
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"value": "110"
},
"HighNode": "0",
"LedgerEntryType": "RippleState",
"LowLimit": {
"currency": "USD",
"issuer": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
"value": "0"
},
"LowNode": "0",
"PreviousTxnID": "5E089C0CD4C52D3ECD85E5E1F38FC255F43FAFAF4FD5C42DD48A8A1B6C36DF5E",
"PreviousTxnLgrSeq": 61168278,
"index": "9CA88CDEDFF9252B3DE183CE35B038F57282BC9503CDFA1923EF9A95DF0D6F7B"
},
"status": "success",
"validated": true
}
}
Get Check Entry
Retrieve a Check entry which is a potential payment that can be cashed by its recipient.
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):check(string): The object ID of a Check entry to retrieve.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"check": "C4A46CCD8F096E994C4B0DEAB6CE98E722FC17D7944C28B95127C2659C47CBEB",
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"index": "C4A46CCD8F096E994C4B0DEAB6CE98E722FC17D7944C28B95127C2659C47CBEB",
"ledger_hash": "FD563CE753BAC24A385EDC5875AD57BE9074F0B9C9C1397441BCFA2569960C9A",
"ledger_index": 100472064,
"node": {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"DestinationNode": "0",
"DestinationTag": 13,
"Flags": 0,
"LedgerEntryType": "Check",
"OwnerNode": "0",
"PreviousTxnID": "4E0AA11CBDD1760DE95B68DF2ABBE75C9698CEB548BEA9789053FCB3EBD444FB",
"PreviousTxnLgrSeq": 61965653,
"SendMax": {
"currency": "USD",
"issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"value": "10"
},
"Sequence": 384,
"index": "C4A46CCD8F096E994C4B0DEAB6CE98E722FC17D7944C28B95127C2659C47CBEB"
},
"status": "success",
"validated": true
}
}
Get Escrow Entry
Retrieve an Escrow entry which holds XRP until a specific time or condition is met. Can be provided as string (object ID of the Escrow) or as an object.
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):escrow(object or string): The Escrow to retrieve. If a string, must be the object ID of the Escrow, as hexadecimal. If an object, requiresownerandseqsub-fields.escrow.owner(string — address; required ifescrowis an object): The owner (sender) of the Escrow object.escrow.seq(unsigned integer; required ifescrowis an object): The Sequence Number of the transaction that created the Escrow object.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"escrow": {
"owner": "rL4fPHi2FWGwRGRQSH7gBcxkuo2b9NTjKK",
"seq": 126
},
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"index": "917ACF1324F06D19239A03E4A6A3FE24F9313BB23337ECB801BDAD013BE27F83",
"ledger_hash": "110D64E05F92F26624DAC3BC11294BD512306DEAE2F94717B7D6BA8ABB308361",
"ledger_index": 100472121,
"node": {
"Account": "rL4fPHi2FWGwRGRQSH7gBcxkuo2b9NTjKK",
"Amount": "99750000",
"Condition": "A0258020085D1EDF8045DC7F6E42B8DB09E05248502852FB3FF27815FC94433D1CB62198810120",
"Destination": "rL4fPHi2FWGwRGRQSH7gBcxkuo2b9NTjKK",
"FinishAfter": 3802143660,
"Flags": 0,
"LedgerEntryType": "Escrow",
"OwnerNode": "1",
"PreviousTxnID": "470DC630B0251FCCA740EA9CA7781A502608890FB123F14D0C4BE20C4D5D44DB",
"PreviousTxnLgrSeq": 37088514,
"index": "917ACF1324F06D19239A03E4A6A3FE24F9313BB23337ECB801BDAD013BE27F83"
},
"status": "success",
"validated": true
}
}
Get PayChannel Entry
Retrieve a PayChannel entry which holds XRP for asynchronous payments.
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):payment_channel(string): The object ID of the PayChannel to retrieve.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"payment_channel": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"index": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
"ledger_hash": "BEC950D37F3B609CDC1F76047871DB1C5AC6DBEFA19AEA84D14AF1BF83BECE4E",
"ledger_index": 100472165,
"node": {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Amount": "1000",
"Balance": "0",
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"DestinationNode": "0",
"Flags": 0,
"LedgerEntryType": "PayChannel",
"OwnerNode": "0",
"PreviousTxnID": "711C4F606C63076137FAE90ADC36379D7066CF551E96DA6FE2BDAB5ECBFACF2B",
"PreviousTxnLgrSeq": 61965340,
"PublicKey": "03CFD18E689434F032A4E84C63E2A3A6472D684EAF4FD52CA67742F3E24BAE81B2",
"SettleDelay": 60,
"index": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7"
},
"status": "success",
"validated": true,
"warning": "load"
}
}
Get DepositPreauth Entry
Retrieve a DepositPreauth entry which tracks preauthorization for payments to accounts requiring Deposit Authorization.
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):deposit_preauth(object or string; required): Specify the DepositPreauth to retrieve. If a string, must be the ledger entry ID of the DepositPreauth entry, as hexadecimal. If an object, requiresownersub-field and eitherauthorizedorauthorize_credentialssub-field.deposit_preauth.owner(string — address; required): The account that provided the preauthorization.deposit_preauth.authorized(string — address; optional): The account that received the preauthorization.deposit_preauth.authorized_credentials(array; optional): A set of credentials that received the preauthorization.
Each member of the deposit_preauth.authorized_credentials array, if provided, must include the following nested fields:
issuer(string — address; required): The address of the account that issued the credential.credential_type(string — hexadecimal; required): The type of the credential, as issued.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"deposit_preauth": {
"owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"authorized": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX"
},
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"index": "A43898B685C450DE8E194B24D9D54E62530536A770CCB311BFEE15A27381ABB2",
"ledger_hash": "C605C3E34DDBD8025844583B2EAEB75EE5CA933DB6B97646BDA736FED8D6A0A6",
"ledger_index": 100472247,
"node": {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Authorize": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"Flags": 0,
"LedgerEntryType": "DepositPreauth",
"OwnerNode": "0",
"PreviousTxnID": "CB1BF910C93D050254C049E9003DA1A265C107E0C8DE4A7CFF55FADFD39D5656",
"PreviousTxnLgrSeq": 61965405,
"index": "A43898B685C450DE8E194B24D9D54E62530536A770CCB311BFEE15A27381ABB2"
},
"status": "success",
"validated": true
}
}
Get Ticket Entry
Retrieve a Ticket entry which represents a sequence number set aside for future use.
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):ticket(object or string): The Ticket to retrieve. If a string, must be the ledger entry ID of the Ticket, as hexadecimal. If an object, theaccountandticket_seqsub-fields are required to uniquely specify the Ticket entry.ticket.account(string — address; required ifticketis an object): The owner of the Ticket.ticket.ticket_seq(number; required ifticketis an object): The Ticket Sequence number of the Ticket to retrieve.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"ticket": {
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"ticket_seq": 389
},
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"index": "B603682BC36F474F708E1A150B7C034C6C13D838C3F2F135CDB7BEA6E5B5ACEF",
"ledger_hash": "2594A8BF2A0C52022EE4BD187FBB9345297DDB20C82FFBDDE87CFEA443440B98",
"ledger_index": 100472816,
"node": {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Flags": 0,
"LedgerEntryType": "Ticket",
"OwnerNode": "0",
"PreviousTxnID": "7458B6FD22827B3C141CDC88F1F0C72658C9B5D2E40961E45AF6CD31DECC0C29",
"PreviousTxnLgrSeq": 76567735,
"TicketSequence": 389,
"index": "B603682BC36F474F708E1A150B7C034C6C13D838C3F2F135CDB7BEA6E5B5ACEF"
},
"status": "success",
"validated": true
}
}
Get NFT Page
Return an NFT Page in its raw ledger 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):nft_page(string): The ledger entry ID of an NFT Page to retrieve.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"nft_page": "255DD86DDF59D778081A06D02701E9B2C9F4F01DFFFFFFFFFFFFFFFFFFFFFFFF",
"ledger_index": "validated"
}
]
}'
Response example
{
"result": {
"index": "255DD86DDF59D778081A06D02701E9B2C9F4F01DFFFFFFFFFFFFFFFFFFFFFFFF",
"ledger_hash": "1C560CABB9E9556BEA3DE17DDCC4CB0F5FF82A533698744F0C339D3AE41391B1",
"ledger_index": 100472871,
"node": {
"Flags": 0,
"LedgerEntryType": "NFTokenPage",
"NFTokens": [
{
"NFToken": {
"NFTokenID": "000827100179C79A9CAACE945A5B77FCC291948F17A72A3F369B7C9400000A19",
"URI": "68747470733A2F2F78726F79616C74792E6D7970696E6174612E636C6F75642F697066732F516D534236344D5856614C7A46427757394847467969696243436D53554A4E7267753731735A38653742334D51452F323732392E6A736F6E"
}
},
{
"NFToken": {
"NFTokenID": "000827100179C79A9CAACE945A5B77FCC291948F17A72A3FBCE1D3AC000008F1",
"URI": "68747470733A2F2F78726F79616C74792E6D7970696E6174612E636C6F75642F697066732F516D534236344D5856614C7A46427757394847467969696243436D53554A4E7267753731735A38653742334D51452F323433332E6A736F6E"
}
}
],
"PreviousTxnID": "BB84C7F9FD90E7AC8A3178580F2F9BD2F00738F53060203025AF80CAF1C5D794",
"PreviousTxnLgrSeq": 77102208,
"index": "255DD86DDF59D778081A06D02701E9B2C9F4F01DFFFFFFFFFFFFFFFFFFFFFFFF"
},
"status": "success",
"validated": true
}
}
Get MPT Issuance Object
Return an MPTokenIssuance object.
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):mpt_issuance(string): The 192-bitMPTokenIssuanceIDthat's associated with the MPTokenIssuance, as hexadecimal.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"mpt_issuance": "string",
"ledger_index": "validated"
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ledger_hash": "string",
"ledger_index": integer,
"node": {
"LedgerEntryType": "string",
"index": "string",
"MPTIssuance": {
"MPTIssuanceID": "string",
"Owner": "string",
"TransferFee": integer,
"Flags": integer,
"Taxon": integer,
"URI": "string",
"MPTSupply": "string"
}
},
"validated": boolean
}
}
Get MPToken Object
Return an MPToken object.
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):mptoken(object or string): If a string, interpret as ledger entry ID of the MPToken to retrieve. If an object, requires the sub-fieldsaccountandmpt_issuance_idto uniquely identify the MPToken.mptoken.mpt_issuance_id(string; required ifmptokenis an object): The 192-bit MPTokenIssuanceID that's associated with the MPTokenIssuance.mptoken.account(string; required ifmptokenis an object): The account that owns the MPToken.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ledger_entry",
"params": [
{
"mptoken":{
"mpt_issuance_id": "string",
"account":"string"
}
}
]
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ledger_hash": "string",
"ledger_index": integer,
"node": {
"LedgerEntryType": "string",
"index": "string",
"MPToken": {
"MPTIssuanceID": "string",
"Owner": "string",
"Flags": integer,
"TransferFee": integer,
"Taxon": integer,
"QualityIn": integer,
"QualityOut": integer,
"Balance": "string",
"PreviousTxnID": "string",
"PreviousTxnLgrSeq": integer
}
},
"validated": boolean
}
}
Returns
The response follows the standard format, with a successful result containing the following fields:
index(string): The unique ID of this ledger entry.ledger_index(unsigned integer): The ledger index of the ledger that was used when retrieving this data.node(object; omitted if"binary": true): Object containing the data of this ledger entry, according to the ledger format.node_binary(string; omitted unless"binary": true): The binary representation of the ledger object, as hexadecimal.deleted_ledger_index(string; Clio server only): Returned if include_deleted parameter is set. The ledger index where the ledger entry object was deleted.
Transaction Methods:
Transactions are the only thing that can modify the shared state of the XRP Ledger. All business on the XRP Ledger takes the form of transactions. Use these methods to work with transactions.
simulate
Executes a dry run of any transaction type to preview results and metadata.
The simulate method executes a dry run of any transaction type, enabling you to preview the results and metadata of a transaction without committing them to the XRP Ledger. Since this command never submits a transaction to the network, it doesn't incur any fees.
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):tx_blob(string; required): The transaction to simulate, in binary format. If you include this field, do not also includetx_json.tx_json(object; required): The transaction to simulate, in JSON format. If you include this field, do not also includetx_blob.binary(boolean; optional): The default value isfalse, which returns data and metadata in JSON format. Iftrue, returns data and metadata in binary format, serialized to a hexadecimal string.
Note:
- The simulated transaction must be unsigned.
- If the
Fee,Sequence,SigningPubKey, orNetworkIDfields are provided, they will be used in the transaction. Otherwise, the server will autofill them.
Returns
The response follows the standard format, with a successful result containing the following fields:
tx_json(object): The transaction that was simulated, including auto-filled values. Included ifbinarywasfalse.tx_blob(string): The serialized transaction that was simulated, including auto-filled values. Included ifbinarywastrue.ledger_index(ledger index): The ledger index of the ledger that would have included this transaction.meta(object): Transaction metadata, which describes the results of the transaction. Not included if the transaction fails with a code that means it wouldn’t be included in the ledger (such as a non-TEC code). Included ifbinarywasfalse.meta_blob(string): Transaction metadata, which describes the results of the transaction. Not included if the transaction fails with a code that means it wouldn’t be included in the ledger (such as a non-TEC code). Included ifbinarywastrue.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "simulate",
"params": [
{
"tx_json": {
"TransactionType": "Payment",
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"Amount": {
"currency": "USD",
"value": "1",
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
}
}
}
]
}'
Response example
{
"result": {
"applied": false,
"engine_result": "tesSUCCESS",
"engine_result_code": 0,
"engine_result_message": "The simulated transaction would have been applied.",
"ledger_index": 100512217,
"meta": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"AccountTxnID": "42BDE75B7309C46BBA7FFC867DDA29DFCB2C066AA3866CF9076280A2DE63FE3C",
"Balance": "1138222640",
"Domain": "6D64756F31332E636F6D",
"EmailHash": "98B4375E1D753E5B91627516F6D70977",
"Flags": 9568256,
"MessageKey": "0000000000000000000000070000000300",
"OwnerCount": 17,
"RegularKey": "rD9iJmieYHn8jTtPjwwkW2Wm9sVDvPXLoJ",
"Sequence": 394,
"TicketCount": 5,
"TransferRate": 4294967295
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
"PreviousFields": {
"AccountTxnID": "932CC7E9BAC1F7B9FA5381679F293EEC0A646E5E7F2F6D14C85FEE2102F0E66C",
"Balance": "1138222650",
"Sequence": 393
},
"PreviousTxnID": "E5C3578BDBEBDCDE7E1697E3BA6A1CF04B17CCEBDE4939200680FEF530C7978E",
"PreviousTxnLgrSeq": 94448149
}
}
],
"TransactionIndex": 126,
"TransactionResult": "tesSUCCESS"
},
"status": "success",
"tx_json": {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Amount": {
"currency": "USD",
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"value": "1"
},
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"Fee": "10",
"Sequence": 393,
"SigningPubKey": "",
"TransactionType": "Payment",
"TxnSignature": "",
"hash": "42BDE75B7309C46BBA7FFC867DDA29DFCB2C066AA3866CF9076280A2DE63FE3C"
}
}
}