Last updated
Edit

account_tx

[Source]

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

Request Format

An example of the request format:

{
  "id": 2,
  "command": "account_tx",
  "account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
  "ledger_index_min": -1,
  "ledger_index_max": -1,
  "binary": false,
  "limit": 2,
  "forward": false,
  "api_version": 2
}

Try it! >

The request includes the following parameters:

FieldTypeDescription
accountStringA unique identifier for the account, most commonly the account's address.
tx_typeString(Optional) Clio Only Return only transactions of a specific type, such as "Clawback", "AccountSet", "AccountDelete", et al. Case-insensitive. See Transaction Types. New in: Clio v2.0 AMM support since: Clio v2.1.0
ledger_index_minInteger(Optional) Use to specify the earliest ledger to include transactions from. A value of -1 instructs the server to use the earliest validated ledger version available.
ledger_index_maxInteger(Optional) Use to specify the most recent ledger to include transactions from. A value of -1 instructs the server to use the most recent validated ledger version available.
ledger_hashString(Optional) Use to look for transactions from a single ledger only. (See Specifying Ledgers.)
ledger_indexString or Unsigned Integer(Optional) Use to look for transactions from a single ledger only. (See Specifying Ledgers.)
binaryBoolean(Optional) Defaults to false. If set to true, returns transactions as hex strings instead of JSON.
forwardBoolean(Optional) Defaults to false. If set to true, returns values indexed with the oldest ledger first. Otherwise, the results are indexed with the newest ledger first. (Each page of results may not be internally ordered, but the pages are overall ordered.)
limitInteger(Optional) Default varies. Limit the number of transactions to retrieve. The server is not required to honor this value.
markerMarkerValue from a previous paginated response. Resume retrieving data where that response left off. This value is stable even if there is a change in the server's range of available ledgers.
  • You must use at least one of the following fields in your request: ledger_index, ledger_hash, ledger_index_min, or ledger_index_max.
  • API v2: If you specify either ledger_index or ledger_hash, including ledger_index_min and ledger_index_max returns an invalidParams error.

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.

Response Format

An example of a successful response:

{
  "result": {
    "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
    "ledger_index_min": 32570,
    "ledger_index_max": 91824401,
    "transactions": [
      {
        "meta": {
          "AffectedNodes": [
            {
              "ModifiedNode": {
                "FinalFields": {
                  "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
                  "AccountTxnID": "932CC7E9BAC1F7B9FA5381679F293EEC0A646E5E7F2F6D14C85FEE2102F0E66C",
                  "Balance": "1086222646",
                  "Domain": "6D64756F31332E636F6D",
                  "EmailHash": "98B4375E1D753E5B91627516F6D70977",
                  "Flags": 9568256,
                  "MessageKey": "0000000000000000000000070000000300",
                  "OwnerCount": 17,
                  "RegularKey": "rD9iJmieYHn8jTtPjwwkW2Wm9sVDvPXLoJ",
                  "Sequence": 393,
                  "TicketCount": 5,
                  "TransferRate": 4294967295
                },
                "LedgerEntryType": "AccountRoot",
                "LedgerIndex": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
                "PreviousFields": {
                  "Balance": "1086222601"
                },
                "PreviousTxnID": "7E50969CDEF8E12B1AD26E64B338935813624A4D1CDDC4C9457832524F0FF74C",
                "PreviousTxnLgrSeq": 89353048
              }
            },
            {
              "ModifiedNode": {
                "FinalFields": {
                  "Account": "rPJARH5nLWQisdmvDAbvzwS7N32Z1kusTZ",
                  "Balance": "55022190",
                  "Flags": 0,
                  "OwnerCount": 0,
                  "Sequence": 89113341
                },
                "LedgerEntryType": "AccountRoot",
                "LedgerIndex": "C0363F86E070B70E7DA129736C3B05E509261C8668F61A7E958C4C10F17EAB90",
                "PreviousFields": {
                  "Balance": "55022245",
                  "Sequence": 89113340
                },
                "PreviousTxnID": "60D0FE881F9B1457FB1711011C6E490C22532B1D495557D6488BE3A634167CEE",
                "PreviousTxnLgrSeq": 90136515
              }
            }
          ],
          "TransactionIndex": 2,
          "TransactionResult": "tesSUCCESS",
          "delivered_amount": "45"
        },
        "tx_json": {
          "Account": "rPJARH5nLWQisdmvDAbvzwS7N32Z1kusTZ",
          "DeliverMax": "45",
          "Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
          "DestinationTag": 316562,
          "Fee": "10",
          "Sequence": 89113340,
          "SigningPubKey": "EDE21591E615E1D77C8C8A7F95372D001B3DF090AB47B99729CFCBC1E4E07D35F4",
          "TransactionType": "Payment",
          "TxnSignature": "D229FEB6ED82367102AC12DE5045BE6D548CBB52E0CB8F037A23171910A6158FA3377F5118B6CEAFDB07D6D43F76FE29CC26BE1ACBC7A86C9D86E14043C66104",
          "ledger_index": 90136515,
          "date": 777284672
        },
        "ledger_index": 90136515,
        "hash": "894541402AC968C98C329A88D097170B14BF4DEB8B2A7DF377EE89DDD332E018",
        "ledger_hash": "14110F60753176E1F6A71AA084B6AD8663CBB46193CCFCDFAC02561626AA6B75",
        "close_time_iso": "2024-08-18T08:24:32Z",
        "validated": true
      },
      {
        "meta": {
          "AffectedNodes": [
            {
              "ModifiedNode": {
                "FinalFields": {
                  "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
                  "AccountTxnID": "932CC7E9BAC1F7B9FA5381679F293EEC0A646E5E7F2F6D14C85FEE2102F0E66C",
                  "Balance": "1086222601",
                  "Domain": "6D64756F31332E636F6D",
                  "EmailHash": "98B4375E1D753E5B91627516F6D70977",
                  "Flags": 9568256,
                  "MessageKey": "0000000000000000000000070000000300",
                  "OwnerCount": 17,
                  "RegularKey": "rD9iJmieYHn8jTtPjwwkW2Wm9sVDvPXLoJ",
                  "Sequence": 393,
                  "TicketCount": 5,
                  "TransferRate": 4294967295
                },
                "LedgerEntryType": "AccountRoot",
                "LedgerIndex": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
                "PreviousFields": {
                  "Balance": "1086222552"
                },
                "PreviousTxnID": "EED9EB1880B951FAB3EE0DBBEB67B7ABEE3FA77F15782B6BD40342B3C23CFB75",
                "PreviousTxnLgrSeq": 89343389
              }
            },
            {
              "ModifiedNode": {
                "FinalFields": {
                  "Account": "rPSDqHdMPsnkmyUX4BvBkY8rycQYwrhUqw",
                  "Balance": "52611432",
                  "Flags": 0,
                  "OwnerCount": 0,
                  "Sequence": 89196186
                },
                "LedgerEntryType": "AccountRoot",
                "LedgerIndex": "20761D2C37004C70318F7A3C5A1C35817A90A0AE56485F6E3281FB2B3F05B0C9",
                "PreviousFields": {
                  "Balance": "52611491",
                  "Sequence": 89196185
                },
                "PreviousTxnID": "BAF86C2776C08407E0FAF42D374874E10430CB8C23AD464D9D9097EA326ABE92",
                "PreviousTxnLgrSeq": 89353024
              }
            }
          ],
          "TransactionIndex": 4,
          "TransactionResult": "tesSUCCESS",
          "delivered_amount": "49"
        },
        "tx_json": {
          "Account": "rPSDqHdMPsnkmyUX4BvBkY8rycQYwrhUqw",
          "DeliverMax": "49",
          "Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
          "DestinationTag": 342662134,
          "Fee": "10",
          "Sequence": 89196185,
          "SigningPubKey": "ED7E4A2970ADFCCE93D59D469322745E98CBEB3D7D5388728B3BB2268E71F30B0F",
          "TransactionType": "Payment",
          "TxnSignature": "8CE14FD18BD186694DED8C204C3FCC2A527CC24AD51C2E0B2B792D035C85D662BC1A1450A8DF04BBEC66821B362056311127C627056AC7779B385517FD3A9202",
          "ledger_index": 89353048,
          "date": 774249571
        },
        "ledger_index": 89353048,
        "hash": "7E50969CDEF8E12B1AD26E64B338935813624A4D1CDDC4C9457832524F0FF74C",
        "ledger_hash": "ED54DA98F3E495C36C2B0D9A511565E04454A1F4503B9DEE3FD39301D7625865",
        "close_time_iso": "2024-07-14T05:19:31Z",
        "validated": true
      }
    ],
    "validated": true,
    "marker": {
      "ledger": 89353048,
      "seq": 4
    },
    "limit": 2
  },
  "api_version": 2,
  "status": "success",
  "type": "response"
}

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

FieldTypeDescription
accountStringUnique Address identifying the related account
ledger_index_minInteger - Ledger IndexThe ledger index of the earliest ledger actually searched for transactions.
ledger_index_maxInteger - Ledger IndexThe ledger index of the most recent ledger actually searched for transactions.
limitIntegerThe limit value used in the request. (This may differ from the actual limit value enforced by the server.)
markerMarkerServer-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off.
metaObject (JSON)(JSON mode) The transaction results metadata in JSON.
meta_blobString (Binary)(Binary mode) The transaction results metadata as a hex string.
transactionsArrayArray of transactions matching the request's criteria, as explained below.
validatedBooleanIf included and set to true, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change.

Note
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.

FieldTypeDescription
close_time_isoStringThe ledger close time represented in ISO 8601 time format.
hashStringThe unique hash identifier of the transaction.
ledger_hashStringA hex string of the ledger version that included this transaction.
ledger_indexIntegerThe ledger index of the ledger version that included this transaction.
tx_jsonObject (JSON)(JSON mode) JSON object defining the transaction.
tx_blobString (Binary)(Binary mode) A unique hex string defining the transaction.
validatedBooleanWhether or not the transaction is included in a validated ledger. Any transaction not yet in a validated ledger is subject to change.

Possible Errors

  • Any of the universal error types.
  • invalidParams - One or more fields are specified incorrectly, or one or more required fields are missing. In API v1, you won't receive this error if you specify:
    • ledger_index_min or ledger_index_max, but also try to specify ledger_index or ledger_hash.
    • A non-boolean value for the binary or forward fields.
  • actMalformed - The Address specified in the account field of the request is not formatted properly.
  • lgrIdxMalformed - The ledger specified by the ledger_index_min or ledger_index_max does not exist, or if it does exist the server does not have it. In API v1, you won't receive this error if you specify a ledger_index_min or ledger_index_max value beyond the range of ledgers that the server has.
  • lgrIdxsInvalid - Either the request specifies a ledger_index_max that is before the ledger_index_min, or the server does not have a validated ledger range because it is not synced with the network.