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

# Instant Swap Event

This `Wallet-as-a-Service` webhook is fired when an instant swap has been create and completed successfully.

* **Parent Method:** `instant_swap`
* **Sub-Methods:**
  * **`completed`**: Triggered when the internal transfer is successfully processed.

<br />

### **Example Payload for Instant Swap:**

```json instant-swap.completed theme={null}
{
  "requestId": "ab67d4be56d4d549f59b92a17fd71b",
  "method": "instant_swap.completed",
  "params": {
    "id": "68180c09b19304fc881991c2",
    "fee": 0,
    "fromCoin": "USDT",
    "fromAmount": 2,
    "toCoin": "TRX",
    "toAmount": 7.55102795,
    "swapPrice": 3.77551398,
    "status": "success",
    "ts": "1746918883356",
    "quoteId": "1305237885725507584",
    "walletId": "6812c4977de20fb535e5bdee",
    "workspaceId": "656abf1e4b5f5e0012345678",
    "createdAt": "2025-05-04T23:58:20.494Z",
    "wallet": {
      "id": "6812b103908d2d0d49c7ff79",
      "clientUserId": null,
      "email": "email@openxswitch.com",
      "name": "openxswitch-subwallet",
      "assets":[ 
          {
            "coin": "USDT",
            "balance": 9,
            "frozen": 0,
            "updatedAt": "2025-05-04T23:58:20.494Z"
          },
          {
            "coin": "TRX",
            "balance": 26.043,
            "frozen": 0,
            "updatedAt": "2025-05-04T23:58:20.494Z"
          }
      ],
      "isSubWallet": false
    }
  }
}
```

<br />

### Reference

| **Field**                          | **Description**                                                    | **Type**                |
| :--------------------------------- | :----------------------------------------------------------------- | :---------------------- |
| `requestId`                        | Unique identifier for the webhook event                            | `string`                |
| `method`                           | Name of the webhook method                                         | `string`                |
| `params.fee`                       | Swap fee charged for the transaction                               | `number`                |
| `params.fromCoin`                  | The coin swapped from (input coin)                                 | `string`                |
| `params.fromAmount`                | The amount of `fromCoin` used in the swap                          | `number`                |
| `params.toCoin`                    | The coin swapped to (output coin)                                  | `string`                |
| `params.toAmount`                  | The amount of `toCoin` received from the swap                      | `number`                |
| `params.swapPrice`                 | Effective price of the swap (toAmount / fromAmount)                | `number`                |
| `params.ts`                        | Timestamp of the swap event (likely in milliseconds since epoch)   | `string` (or `number`)  |
| `params.quoteId`                   | Unique identifier for the swap quote used                          | `string`                |
| `params.walletId`                  | ID of the wallet involved in the transaction                       | `string`                |
| `params.workspaceId`               | ID of the associated workspace or organization                     | `string`                |
| `params.createdAt`                 | Timestamp when the transfer was created                            | `string` (ISO datetime) |
| `params.wallet.id`                 | Wallet ID (redundant with `walletId`, likely the master wallet ID) | `string`                |
| `params.wallet.clientUserId`       | Optional external user identifier for the wallet                   | `string` or `null`      |
| `params.wallet.email`              | Email address associated with the wallet                           | `string`                |
| `params.wallet.name`               | Display name of the wallet                                         | `string`                |
| `params.wallet.assets`             | List of assets and their balances after the swap                   | `array of objects`      |
| `params.wallet.assets[].coin`      | Coin symbol (e.g., USDT, TRX)                                      | `string`                |
| `params.wallet.assets[].balance`   | Balance of the coin after the swap                                 | `number`                |
| `params.wallet.assets[].frozen`    | Frozen amount of the coin (if any)                                 | `number`                |
| `params.wallet.assets[].updatedAt` | Last update time of the asset balance                              | `string` (ISO datetime) |
| `params.wallet.isSubWallet`        | Whether the wallet is a subwallet                                  | `boolean`               |
