> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.finrock.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Transaction Source and Destination Types — Finrock

> Reference for source_type and destination_type enum values used when creating and filtering transactions in the Finrock API. Includes practical examples.

When you create or query transactions through the Finrock API, two enum fields — `source_type` and `destination_type` — describe where funds originate and where they are going. Understanding these values helps you construct accurate transaction requests and filter your transaction history effectively.

## source\_type

The `source_type` field identifies where the funds for a transfer originate.

| Value      | Description                                                                                                                    |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `INTERNAL` | The transfer originates from within your Finrock workspace — that is, from a wallet or sub-account you manage on the platform. |
| `EXCHANGE` | The transfer originates from a connected exchange account (such as Binance) that is linked to your workspace.                  |

<Info>
  For the vast majority of outgoing transfers you initiate programmatically, the `source_type` will be `INTERNAL`.
</Info>

## destination\_type

The `destination_type` field identifies where the funds are being sent.

| Value        | Description                                                                                                                                            |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `INTERNAL`   | The funds are destined for your own sub-account within your workspace. Use this when pulling funds from a connected exchange into your Finrock wallet. |
| `EXTERNAL`   | The funds are going to an address outside your workspace — for example, to a customer's personal wallet or a third-party exchange address.             |
| `SUBACCOUNT` | The funds are being moved to another sub-account within your own workspace — for example, transferring between two branches of your operation.         |
| `EXCHANGE`   | The funds are being sent to a supported connected exchange — for example, depositing to your Binance trading account.                                  |

## Transaction Type Reference

Beyond the source/destination pair, Finrock also categorises transactions by their functional **type**. These types appear in transaction history and webhook payloads.

| Type       | Description                                                                                       |
| ---------- | ------------------------------------------------------------------------------------------------- |
| `Deposit`  | An inbound transfer arriving from outside your workspace.                                         |
| `Withdraw` | An outbound transfer sent to an external address from your workspace.                             |
| `GasTank`  | A transfer of funds from a wallet to a Gas Tank to prefund network fees.                          |
| `Fee`      | The gas fee charged for a token transfer.                                                         |
| `Staking`  | A transfer related to a staking operation (e.g., Tron staking).                                   |
| `Refill`   | An automatic or manual refill of gas or operational funds.                                        |
| `Sweep`    | An automated consolidation transfer, typically from ad-hoc deposit addresses to a primary wallet. |

## Practical Examples

The following combinations cover the most common use cases you will encounter when building on the Finrock API.

<Tabs>
  <Tab title="Customer Withdrawal">
    A customer requests a payout to their personal wallet address. Funds leave your workspace and go to an external address.

    ```json theme={null}
    {
      "source_type": "INTERNAL",
      "destination_type": "EXTERNAL",
      "destination_address": "0xCustomerWalletAddress",
      "asset": "USDT_ETH",
      "amount": 500.00
    }
    ```

    | Field              | Value      |
    | ------------------ | ---------- |
    | `source_type`      | `INTERNAL` |
    | `destination_type` | `EXTERNAL` |

    Use this pattern for any transfer that exits your workspace to an on-chain address you do not control.
  </Tab>

  <Tab title="Exchange Deposit">
    You want to move funds from your Finrock custody wallet into your Binance trading account for liquidity management.

    ```json theme={null}
    {
      "source_type": "INTERNAL",
      "destination_type": "EXCHANGE",
      "exchange_account_id": "your-binance-account-id",
      "asset": "BTC",
      "amount": 0.5
    }
    ```

    | Field              | Value      |
    | ------------------ | ---------- |
    | `source_type`      | `INTERNAL` |
    | `destination_type` | `EXCHANGE` |

    The target exchange must be connected to your workspace. See the [Exchange Accounts reference](/api-reference/exchanges/list-exchange-accounts) for setup details.
  </Tab>

  <Tab title="Internal Transfer">
    You need to move funds between two sub-accounts within your workspace — for example, rebalancing between a hot wallet sub-account and a cold reserve sub-account.

    ```json theme={null}
    {
      "source_type": "INTERNAL",
      "destination_type": "SUBACCOUNT",
      "destination_subaccount_id": "target-subaccount-id",
      "asset": "ETH",
      "amount": 10.0
    }
    ```

    | Field              | Value        |
    | ------------------ | ------------ |
    | `source_type`      | `INTERNAL`   |
    | `destination_type` | `SUBACCOUNT` |

    Internal transfers between sub-accounts do not incur on-chain fees, as no blockchain transaction is broadcast.
  </Tab>

  <Tab title="Exchange to Workspace">
    You want to move funds from a connected exchange into your Finrock custody wallet — for example, pulling Binance balances into cold storage.

    ```json theme={null}
    {
      "source_type": "EXCHANGE",
      "destination_type": "INTERNAL",
      "exchange_account_id": "your-binance-account-id",
      "asset": "ETH",
      "amount": 5.0
    }
    ```

    | Field              | Value      |
    | ------------------ | ---------- |
    | `source_type`      | `EXCHANGE` |
    | `destination_type` | `INTERNAL` |
  </Tab>
</Tabs>

<Tip>
  When filtering your transaction history, you can combine `source_type` and `destination_type` query parameters to narrow results to a specific flow — for example, retrieving only customer withdrawals (`INTERNAL` → `EXTERNAL`) for a reconciliation report.
</Tip>
