# Search for operations by TX hash

The method allows you to find an operation in the system by the address of the transaction in the blockchain

The response will indicate the type of operation, the direction of the transaction, the address that was used for the operation and the body of the operation in the record from the type

Available types of operations:

| Type                | Description                                                                                                          |
| ------------------- | -------------------------------------------------------------------------------------------------------------------- |
| ORDER               | The transaction address was found in the incoming transactions of the order                                          |
| INVOICE             | The transaction address was found in the incoming transactions of the order created for the execution of the account |
| ORPHAN\_TRANSACTION | The transaction address was in the incoming transaction address created for a different coin or network              |
| WITHDRAWAL          | Transaction address was found among output operations                                                                |
| DEPOSIT             | The transaction address was found in the incoming transaction address as "free replenishment"                        |
| PERSONAL\_DEPOSIT   | The transaction address was found in incoming transactions at the system address "personal user addresses"           |

Available transaction directions:

| Direction | Description          |
| --------- | -------------------- |
| IN        | Incoming transaction |
| OUT       | Outgoing transaction |

Address body example:

```json
{
   "id": "cf95ea41-20c5-4528-b689-c21f4da6359f", // address identifier
   "type": "PAY_IN" // address type: PAY_IN, PERSONAL, PAY_OUT, BUSINESS, RECURRENT
}

```

There can be multiple entries in the result body, so the result is represented as an array:

Response body example:

```json
{
   "success": true,
   "response": [
     {
       "type": "OUT",
       "source": "WITHDRAWAL",
       "address": {
         ... // address body
       },
       "result": {
         ... // body for WITHDRAWAL
       }
     },
     {
       "type": "IN",
       "source": "DEPOSIT",
       "address": {
         ... // address body
       },
       "result": {
         ... // body for DEPOSIT
       }
     }
   ]
}

```

***

An example of the body of the `PERSONAL_DEPOSIT` operation:

```json
{ // body is identical to the body sent in the webhook
   "id": "2fa68ddf-2479-47cb-9e66-ae91139c3063", // personal deposit identifier
   "addressId": "dcb1a9fe-4b8d-40f6-baf6-241dc88436d9", // recipient address identifier
   "userId": "6196a1f2-b6b5-40a5-a672-f1ffd70fdd7d", // user ID in the system for which the address was created
   "amount": "0.005", // deposit amount
   "currency": "USDT", // deposit coin
  "addressFrom": ["0x....", "0x...."],                  // array of senders
  "addressTo": "0x....",                                // recipient address
   "network": "bsc", // deposit networks
   "status": "PROCESSED", // status, available values: PROCESSED
   "tx": "0x5b9b3b55b366266025e...", // blockchain transaction address
   "createdAt": "2023-03-02T06:58:00.365Z",
   "updatedAt": "2023-03-02T07:01:50.693Z"
}

```

***

An example of a `DEPOSIT` operation body:

```json
{ // body is identical to the body sent in the webhook
   "id": "2fa68ddf-2479-47cb-9e66-ae91139c3063", // record ID
   "status": "processed", // status, available values: processed, error, rejected, pending
   "addressType": "BUSINESS", // address type: PAY_IN, PERSONAL, PAY_OUT, BUSINESS, RECURRENT
   "addressFrom": "0x5b9b3b55b366266025e...", // sender address in blockchain
   "addressTo": "0x3f4e3d79a244189e25e...", // address of the recipient in the blockchain
   "type": "deposit", // operation type: withdrawal, deposit
   "amount": "0.005", // deposit amount
   "currency": "USDT", // deposit coin
   "network": "bsc", // deposit networks
   "txId": "0x5b9b3b55b366266025e...", // blockchain transaction address
   "alias": "My address", // address name specified when creating
   "comment": null, // operation comment
   "createdAt": "2023-03-02T06:58:00.365Z",
   "updatedAt": "2023-03-02T07:01:50.693Z"
}

```

***

An example of a `WITHDRAWAL` operation body:

```json
{ // response body is identical to the response body when receiving output data
   "id": "2a2d464b-231a-baf3-6f8a-7b9dc0f8cef7", // output identifier in the system
   "advancedBalanceId": "017f444f-a6ce-487f-0f80-9777199a6ff5", // advance balance identifier
   "addressId": "5bcb11d2-cfe8-3a09-0c51-dd7be7243c5d", // sender address identifier
   "currency": "ETH", // sending coin
   "network": "ethereum", // sending network
   "tx": "0x00000000000000000000c8950e52aa3...", // blockchain transaction address
   "status": "processed", // output status: init, error, pending, processed, rejected
   "address": "0x000000000c8950e52aa315030efedc861da658e2", // address of the recipient in the blockchain
   "tag": null,
   "amount": "2.12345", // withdrawal amount
   "feeAmount": "0.005", // fee amount
   "createdAt": "2023-03-02T07:01:50.693Z"
}

```

***

An example of the body of the `ORDER` operation:

```json
{ // response body is identical to the response body of the request for obtaining information about the order
   "id": "d01d03e2-15dc-b03a-b34e-46cad2345b92", // order id
   "advancedBalanceId": "c6e7d8dc-ce10-637d-147b-2dda3015b8a4", // advance balance id
   "currency": "ETH", // payment coin
   "network": "etehereum", // payment network
   "link": "https://payment.domain/...", // payment link
   "status": "processed", // status: init, error, processed, pending, expired, partial
   "order": "#123456789",
   "description": "Order #123456789",
   "address": "0x000000000c8950e52aa315030efedc861da658e2", // address for receiving payment
   "addressId": "8eae79cf-1db2-4858-9023-aca473d805e2", // system address id
   "tag": null, // address tag
   "amount": "0.84", // payment amount
   "received": "0.86", // amount received
   "transactions": [
     {
       "id": "f0b22f11-007c-4f65-bb9b-265432ab64c3",
       "status": "processed",
       "currency": "BNB",
       "network": "bsc",
       "amount": "0.0001",
       "tx": "0x8fb0d40678d1bb4b6c0b2095c18d9280aa8ccf966e778e6b209f4f71c7f1e835",
       "confirmations": "15",
       "sender": "0xcD62a4E08513f16F86C1c0AF0860DD6b3De1B83d",
       "priceUSD": "212.90000000",
       "amountUSD": "0.02129"
     },
     {
       "id": "a2a7ed3b-a8af-42c4-900c-d21e1d9eda3c",
       "status": "processed",
       "currency": "BNB",
       "network": "bsc",
       "amount": "0.0006",
       "tx": "0x60032c394fcc7a103bc2826f9b81e5086be90628331e1ce163e1c576c64baf06",
       "confirmations": "15",
       "sender": "0x54936CE809bBccC7f1378c7ec88F5504cE49605C",
       "priceUSD": "212.70000000",
       "amountUSD": "0.12762"
     }
   ],
   "orphanDeposits": [
     {
       "id": "7cd20ea9-0e2c-46c5-8e12-82b0485d5ba1",
       "organizationId": "1f07eb01-5fd8-4e05-89b5-bebcd1d1fc39",
       "orderId": "d01d03e2-15dc-b03a-b34e-46cad2345b92",
       "stage": "WITHDRAWAL",
       "status": "PROCESSED",
       "message": null,
       "currency": "BNB",
       "network": "bsc",
       "amount": "0.00000001",
       "canWithdrawal": true,
       "inTransaction": {
         "addressType": "PAY_IN",
         "addressId": "8519ba89-68d5-4914-9a0f-d99e77dc88ea",
         "address": "0x68f8a74b5fD0b687369536607214acfA3b1572Ff",
         "txId": "0x6751285829e38b1bb53d1df887dde750182f08e230b58a5a2d3e867ba7327362",
         "amount": "0.00000001",
         "status": "processed",
         "createdAt": "2023-05-30T14:10:27.276Z"
       },
       "outTransaction": {
         "withdrawalId": "4429ba89-68d5-4914-9a0f-d99e77dc88ea",
         "address": "0x68f8a74b5fD0b687369536607214acfA3b1572Ff",
         "txId": "0x5511285829e38b1bb53d1df887dde750182f08e230b58a5a2d3e867ba7327362",
         "amount": "0.00000001",
         "status": "processed",
         "createdAt": "2023-05-30T14:10:27.276Z"
       },
       "createdAt": "2023-05-30T14:10:27.283Z"
     }
   ],
   "successWebhook": "https://example.com/success-webhook-url",
   "errorWebhook": "https://example.com/error-webhook-url",
   "returnUrl": "null",
   "expiresAt": "2021-05-23T15:00:00Z",
   "createdAt": "2021-05-23T15:00:00Z",
   "updatedAt": "2021-05-23T15:00:00Z"
}

```

***

An example of the body of the `INVOICE` operation:

```json
{ // response body is identical to the response body of the request for obtaining account data
   "id": "fe31e1f3-bd23-4c89-bced-7fecc60cbb34", // Account ID
   "advancedBalanceId": "1cabe6ba-52b8-42bf-88a4-b3c953c3fd36", // advance balance ID
   "orderId": "ae31e1f3-bd23-4c89-bced-7fecc60cbb31", //Order ID (before the INIT status will be null)
   "orderLink": "https://payment.domain/...", // order link (before INIT status will be null)
   "invoiceLink": "https://invoices.domain/...", // invoice link
   "status": "PENDING", // account status (CREATED - created, INIT - coin selected for payment, PENDING - user made a transaction, PROCESSED - paid, PARTIAL - partial payment, ERROR - error, EXPIRED - account has expired)
   "order": "Order #1234",
   "description": "Buy 1 Bitcoin",
   "currency": "USD",
   "amount": "3000",
   "receivedCurrency": "USDT", // selected coin for payment (before INIT status will be null)
   "receivedAmount": "123", // amount received
   "includeFee": true,
   "insurancePercent": "2",
   "slippagePercent": "3.5",
   "webhookURL": "https://my-shop.com/api/webhooks",
   "returnURL": "https://my-shop.com/",
   "currencies": [
     {
       "currency": "USDT",
       "networks": [
         {
           "name": "tron",
           "amount": "3030.123" // final amount payable for USDT on the tron network
         },
         {
           "name": "bsc",
           "amount": "3030.123"
         }
       ]
     }
   ],
   "expiresAt": "2022-12-16T08:36:38.130Z",
   "createdAt": "2022-12-16T07:36:38.130Z"
}

```

***

An example of the body of the `ORPHAN_DEPOSIT` operation:

```json
{ // response body is identical to the response body of the request to receive deposit data
   "id": "7cd20ea9-0e2c-46c5-8e12-82b0485d5ba1",
   "organizationId": "1f07eb01-5fd8-4e05-89b5-bebcd1d1fc39",
   "orderId": "4db8ba00-20f8-4e3f-8292-301dd66618af",
   "stage": "WITHDRAWAL",
   "status": "PROCESSED",
   "message": null,
   "currency": "BNB",
   "network": "bsc",
   "amount": "0.00000001",
   "canWithdrawal": true,
   "inTransaction": {
     "addressType": "PAY_IN",
     "addressId": "8519ba89-68d5-4914-9a0f-d99e77dc88ea",
     "address": "0x68f8a74b5fD0b687369536607214acfA3b1572Ff",
     "txId": "0x6751285829e38b1bb53d1df887dde750182f08e230b58a5a2d3e867ba7327362",
     "amount": "0.00000001",
     "status": "processed",
     "createdAt": "2023-05-30T14:10:27.276Z"
   },
   "outTransaction": {
     "withdrawalId": "4429ba89-68d5-4914-9a0f-d99e77dc88ea",
     "address": "0x68f8a74b5fD0b687369536607214acfA3b1572Ff",
     "txId": "0x5511285829e38b1bb53d1df887dde750182f08e230b58a5a2d3e867ba7327362",
     "amount": "0.00000001",
     "status": "processed",
     "createdAt": "2023-05-30T14:10:27.276Z"
   },
   "createdAt": "2023-05-30T14:10:27.283Z"
}

```

{% openapi src="https://615678623-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa1TzfeK1Z0GLFNxiNpMW%2Fuploads%2Fgit-blob-9ef2473afbb2747e60457d760dca1d7a9e80c63e%2Fopenapi.json?alt=media" path="/api-gateway/find-tx" method="post" %}
[openapi.json](https://615678623-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa1TzfeK1Z0GLFNxiNpMW%2Fuploads%2Fgit-blob-9ef2473afbb2747e60457d760dca1d7a9e80c63e%2Fopenapi.json?alt=media)
{% endopenapi %}
