> For the complete documentation index, see [llms.txt](https://docs.xpay.stream/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xpay.stream/transactions/search-transactions.md).

# Search Transactions

{% hint style="info" %}
**API Endpoint**

**POST** [**/client/transactions/find**](https://apis.xpay.stream/client/transactions/find)
{% endhint %}

***

{% hint style="info" %}
**Request Headers:**

Authorization: Bearer [\<access\_token>](/authentication-api.md)

Content-Type: application/json<br>

**Request Body**

Transactions can be filtered by a wallets, and apply an OR filter to filter matching transactions by fields whildcards of txID, source, destination, tag, type and action.

```json
{
    "page": 1,        // optional - if not present, default 1
    "pageSize": 20,   // optional - if not present, default 10
    
    "wallet": "<wallet_uuid>" // optional - and filter
    
    // with an OR filter transactions, matching fields: 
    // - txID, tron transaction hash 
    // - wallet, wallet UUID
    // - tag, the wallet(s) group tag 
    // - source address
    // - destination address
    // - type as 'TRX' for tron, 'TRC20' for USDT
    // - action as 'sent' or 'received'
    "or": "<value>" 
}
```

{% endhint %}

{% hint style="success" %}
**Success Response**\
By default all search results are paged, with 10 items per page.

You can specify in your request the page number and number of items per page. Find in response, which page you are, if more pages are availabe (nextPage: true), total count for all items without paging and the total found for items count in this page.

**`Example Below:`**

{% code lineNumbers="true" fullWidth="true" %}

```json
{
    "success": {
        "message": "Done",
        "data": [
            {
                "txRef": "f2f5...1a1aa8",
                "action": "sent",
                "address": "TNQGn...boUi2N",
                "amount": "10000000",
                "availableBandwidthPoints": 261,
                "availableEnergy": 0,
                "createdAt": 1696856682072,
                "destination": "TPx4K...G4bZ1",
                "feeSUN": 5881440,
                "requiredBandwidthPoints": 345,
                "requiredEnergy": 13182,
                "source": "TNQ...oUi2N",
                "sunCostForBandwidth": 345000,
                "sunCostForEnergy": 5536440,
                "tag": "Master",
                "timestamp": 1696856681664,
                "tokenAddress": "TMhkJ...L5sz",
                "tokenDecimals": "6",
                "txID": "6ca6f5...7bf808c8",
                "type": "TRC20",
                "username": "email@test.com",
                "wallet": "6984...0cba",
                "mailed": 1
            },
            {
                "txRef": "f13...5c7805",
                "action": "received",
                "address": "TPx4...Z1",
                "amount": "10000000",
                "destination": "TPx4...4bZ1",
                "source": "TNQ...Ui2N",
                "tag": "xpay-credits: +10 🪙",
                "timestamp": 1696856681664,
                "txID": "6ca6...808c8",
                "type": "TRC20",
                "username": "email@test.com",
                "wallet": "4199...23D6",
                "credited": 1
            },
            {
                "txRef": "592d...740d",
                "action": "sent",
                "address": "TNQ...i2N",
                "amount": "10000000",
                "availableBandwidthPoints": 257,
                "availableEnergy": 0,
                "createdAt": 1696855821267,
                "destination": "TPx...4bZ1",
                "feeSUN": 5881440,
                "requiredBandwidthPoints": 345,
                "requiredEnergy": 13182,
                "source": "TNQG...Ui2N",
                "sunCostForBandwidth": 345000,
                "sunCostForEnergy": 5536440,
                "tag": "Master",
                "timestamp": 1696855820782,
                "tokenAddress": "TMhkJ...L5sz",
                "tokenDecimals": "6",
                "txID": "ca771...26be",
                "type": "TRC20",
                "username": "email@test.com",
                "wallet": "698...0cba",
                "mailed": 1
            },
            {
                "txRef": "d6e62...fdde5",
                "action": "received",
                "address": "TPx4...4bZ1",
                "amount": "10000000",
                "destination": "TPx4...G4bZ1",
                "source": "TNQG...Ui2N",
                "tag": "xpay-credits: +10 🪙",
                "timestamp": 1696855820782,
                "txID": "ca771...826be",
                "type": "TRC20",
                "username": "email@test.com",
                "wallet": "4199...3D6",
                "credited": 1
            },
            {
                "txRef": "fe05...df0ea",
                "action": "sent",
                "address": "TNQG...Ui2N",
                "amount": "10000000",
                "availableBandwidthPoints": 600,
                "availableEnergy": 0,
                "createdAt": 1696855378585,
                "destination": "TPx...bZ1",
                "feeSUN": 5536440,
                "requiredBandwidthPoints": 345,
                "requiredEnergy": 13182,
                "source": "TNQ...i2N",
                "sunCostForBandwidth": 0,
                "sunCostForEnergy": 5536440,
                "tag": "Master",
                "timestamp": 1696855378086,
                "tokenAddress": "TMhk...L5sz",
                "tokenDecimals": "6",
                "txID": "1939...e212",
                "type": "TRC20",
                "username": "email@test.com",
                "wallet": "6984da12-ca05-4712-b63c-63f3d5460cba",
                "mailed": 1
            },
            {
                "txRef": "1ec9a...d0ce6",
                "action": "received",
                "address": "TPx4...4bZ1",
                "amount": "10000000",
                "destination": "TPx...4bZ1",
                "source": "TNQ...oUi2N",
                "tag": "xpay-credits: +10 🪙",
                "timestamp": 1696855378086,
                "txID": "193...e212",
                "type": "TRC20",
                "username": "email@test.com",
                "wallet": "419...3D6",
                "credited": 1
            },
            {
                "txRef": "5f5...637e",
                "action": "sent",
                "address": "TNQ...i2N",
                "amount": "10000000",
                "availableBandwidthPoints": 154,
                "availableEnergy": 0,
                "createdAt": 1696437043211,
                "destination": "TPx...bZ1",
                "feeSUN": 5881440,
                "requiredBandwidthPoints": 345,
                "requiredEnergy": 13182,
                "source": "TNQ...2N",
                "sunCostForBandwidth": 345000,
                "sunCostForEnergy": 5536440,
                "tag": "Master",
                "timestamp": 1696437042738,
                "tokenAddress": "TMh...L5sz",
                "tokenDecimals": "6",
                "txID": "7709f1...307a5",
                "type": "TRC20",
                "username": "email@test.com",
                "wallet": "698...cba",
                "mailed": 1
            },
            {
                "txRef": "995d228...ff2bc",
                "action": "sent",
                "address": "TNQGnb...rfsboUi2N",
                "amount": "12000000",
                "availableBandwidthPoints": 439,
                "availableEnergy": 0,
                "createdAt": 1696426917221,
                "destination": "TPx4K4...Eu7G4bZ1",
                "feeSUN": 5536440,
                "requiredBandwidthPoints": 345,
                "requiredEnergy": 13182,
                "source": "TNQ...2N",
                "sunCostForBandwidth": 0,
                "sunCostForEnergy": 5536440,
                "tag": "Master",
                "timestamp": 1696426916571,
                "tokenAddress": "TMhkJ...RL5sz",
                "tokenDecimals": "6",
                "txID": "44a23...acadb2",
                "type": "TRC20",
                "username": "email@test.com",
                "wallet": "6984...0cba",
                "mailed": 1
            },
            {
                "txRef": "bed3...a4b7f",
                "action": "sent",
                "address": "TNQ...oUi2N",
                "amount": 5000000,
                "availableBandwidthPoints": 143,
                "availableEnergy": 0,
                "createAt": 1696372081847,
                "destination": "TVBG...TbDi",
                "feeSUN": 268000,
                "requiredBandwidthPoints": 268,
                "requiredEnergy": 0,
                "source": "TNQ..i2N",
                "sunCostForBandwidth": 268000,
                "sunCostForEnergy": 0,
                "tag": "Master",
                "timestamp": 1696372080000,
                "txID": "1450...fb985",
                "type": "TRX",
                "username": "email@test.com",
                "wallet": "6984da...460cba",
                "mailed": 1
            },
            {
                "txRef": "e38ff5027b2...0ad6e",
                "action": "received",
                "address": "TNQGnbM...Ui2N",
                "amount": "24000000",
                "destination": "TNQGnb...Ui2N",
                "source": "TVBG..TbDi",
                "tag": "Master",
                "timestamp": 1696371478395,
                "txID": "8506f9...2bd8",
                "type": "TRC20",
                "username": "email@test.com",
                "wallet": "698...cba",
                "mailed": 1
            }
        ]
    },
    "page": 1,
    "pageSize": 10,
    "foundCount": 10,
    "totalCount": 25,
    "nextPage": true,
    "uuid": "5c7b6dfb-cebc-4d12-8de9-b66d05980ee1"
}
```

{% endcode %}
{% endhint %}

***

{% tabs %}
{% tab title="CURL Example" %}
{% code lineNumbers="true" fullWidth="true" %}

```bash
curl 'https://apis.xpay.stream/client/transactions/find' \
  -H 'Authorization: Bearer <access_token>'         \
  -H 'Content-Type: application/json'               \
  --data-raw '{}'             
```

{% endcode %}
{% endtab %}

{% tab title="NodeJS Example" %}
{% code lineNumbers="true" %}

```javascript
// npm i cross-fetch
const fetch = require("cross-fetch");

const API_URL = "https://apis.xpay.stream/client/transactions/find";

const method = "POST";

const headers = { 
    "Content-Type": "application/json",
    "Authorization": "Bearer <access_token>"
};

const body = JSON.stringify({
    page: 1,
    pageSize: 20,
    wallet: "<wallet_uuid>"
});

fetch(API_URL, { headers, body, method })
.then(async res =>  await res.json())
.then(result => {
    if(result.error)
        console.log("Wallets Search Error", result);
    if(result.success)
        console.log("Wallet Searched", result);
})
.catch((err) => {
    console.error("Wallet Search API Exception", err);
});
```

{% endcode %}

{% endtab %}
{% endtabs %}
