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

# transferBetweenDeployers: Move Funds Between Deployers

> Transfer cross margin funds directly between two market deployers within your account, leaving your chain-level balance completely unaffected.

If you maintain positions across multiple market deployers (MDs), you can rebalance margin between them directly using `transferBetweenDeployers`. The transfer moves funds from the source deployer's cross margin pool to the destination deployer's cross margin pool. Your chain-level balance is not affected in any way. Both deployers must be ones you are already enrolled in, and the transfer is subject to the same withdrawable amount constraints as [`unlockCollateral`](/exchange/unlock-collateral) on the source side.

<Note>
  You must be enrolled in **both** the source and destination market deployers before calling this action.
</Note>

## Endpoint

```
POST https://dev.upsidemax.xyz/exchange
```

## Request

Every request must carry an ECDSA signature and a nonce to prevent replay attacks.

```json theme={"system"}
{
  "action": {
    "type": "transferBetweenDeployers",
    "fromMarketDeployerId": 1,
    "toMarketDeployerId": 2,
    "coinId": 1,
    "amount": "1000"
  },
  "signature": { "r": "0x...", "s": "0x...", "v": 28 },
  "nonce": 1778859000000
}
```

### Action parameters

<ParamField body="fromMarketDeployerId" type="int32" required>
  The ID of the source market deployer. The transfer amount is deducted from this deployer's cross margin pool and is subject to its withdrawable amount limit.
</ParamField>

<ParamField body="toMarketDeployerId" type="int32" required>
  The ID of the destination market deployer. The transfer amount is credited to this deployer's cross margin pool.
</ParamField>

<ParamField body="coinId" type="int32" required>
  The coin or currency ID to transfer. Must be a coin supported by both market deployers.
</ParamField>

<ParamField body="amount" type="string" required>
  The amount to transfer, expressed as a raw integer string (e.g. `"1000"`). Must be greater than zero and must not exceed the withdrawable amount on the source deployer. Decimals are not accepted — use the coin's smallest unit.
</ParamField>

## Response

A successful transfer returns the updated cross margin balances for both market deployers.

```json theme={"system"}
{
  "status": "ok",
  "response": {
    "type": "transferBetweenDeployers",
    "data": {
      "coinId": 1,
      "amount": 1000,
      "fromBalanceAfter": 4000,
      "toBalanceAfter": 3000
    }
  }
}
```

<ResponseField name="coinId" type="int32">
  The coin ID that was transferred.
</ResponseField>

<ResponseField name="amount" type="int64">
  The amount moved from the source to the destination market deployer.
</ResponseField>

<ResponseField name="fromBalanceAfter" type="int64">
  The cross margin balance of the source market deployer after the transfer.
</ResponseField>

<ResponseField name="toBalanceAfter" type="int64">
  The cross margin balance of the destination market deployer after the transfer.
</ResponseField>

## Errors

If the request cannot be fulfilled, the exchange still returns **HTTP 200** with `status: "ok"` — the rejection is reported inside `response.data`, where a server-assigned integer `errorCode` and a human-readable `errorMessage` are populated while the numeric amount and balance fields are set to `0`. Common causes include:

* **Amount exceeds withdrawable balance on source** — position IM and frozen order margin reduce how much can be moved from the source deployer.
* **Not enrolled in one or both deployers** — you must be enrolled in both the source and destination MDs.
* **Same source and destination** — `fromMarketDeployerId` and `toMarketDeployerId` must differ.
* **Amount ≤ 0** — the `amount` field must be a positive integer string.

```json theme={"system"}
{
  "status": "ok",
  "response": {
    "type": "transferBetweenDeployers",
    "data": {
      "coinId": 0,
      "amount": 0,
      "fromBalanceAfter": 0,
      "toBalanceAfter": 0,
      "errorCode": 1,
      "errorMessage": "requested amount exceeds withdrawable balance on source deployer"
    }
  }
}
```

<Tip>
  If you need to move funds involving your chain-level balance instead, use [`lockCollateral`](/exchange/lock-collateral) or [`unlockCollateral`](/exchange/unlock-collateral).
</Tip>
