Transfer Funds (CoinSwitch Account ↔ Master)
Transfers funds between your CoinSwitch account (main book) and the master account.
This endpoint requires your CoinSwitch API key — not the master account or subaccount API key. Using a master/subaccount key returns 403.
| Method | POST |
| Path | /dma/api/v1/funds/transfer/master-account |
| Auth | Authenticated (CoinSwitch main book API key). |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
subaccount_id | string | Yes | subaccount_id of the master account's subaccount. |
amount | number (decimal) | Yes | Amount to transfer. Must be > 0. |
direction | string | Yes | IN (CoinSwitch account → master) or OUT (master → CoinSwitch account). |
client_txn_id | string (UUID) | Yes | Idempotency key — unique UUID per transaction. |
quote_asset | string | Yes | USDT. |
Request
- Python
- Java
- Go
- Node.js
from reference_client import sign_request, BASE_URL
import requests, json, uuid
payload = {
"subaccount_id": "1000",
"amount": 500.00,
"direction": "IN",
"client_txn_id": str(uuid.uuid4()),
"quote_asset": "USDT"
}
headers, path = sign_request("POST", "/dma/api/v1/funds/transfer/master-account")
r = requests.post(BASE_URL + path, headers=headers, data=json.dumps(payload))
print(r.json())
Map<String, Object> body = new HashMap<>();
body.put("subaccount_id", "1000");
body.put("amount", 500.00);
body.put("direction", "IN");
body.put("client_txn_id", UUID.randomUUID().toString());
body.put("quote_asset", "USDT");
HttpResponse<String> resp = client.send(
"POST", "/dma/api/v1/funds/transfer/master-account", null, body);
System.out.println(resp.body());
body := map[string]any{
"subaccount_id": "1000",
"amount": 500.00,
"direction": "IN",
"client_txn_id": uuid.New().String(),
"quote_asset": "USDT",
}
bodyJSON, _ := json.Marshal(body)
headers, p, err := SignRequest("POST", "/dma/api/v1/funds/transfer/master-account", nil)
if err != nil { panic(err) }
req, _ := http.NewRequest("POST", BaseURL+p, bytes.NewReader(bodyJSON))
for k, v := range headers { req.Header.Set(k, v) }
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
const {signRequest, BASE_URL} = require('./reference-client');
const crypto = require('crypto');
const body = {
"subaccount_id": "1000",
"amount": 500.00,
"direction": "IN",
"client_txn_id": crypto.randomUUID(),
"quote_asset": "USDT"
};
const {headers, path} = signRequest('POST', '/dma/api/v1/funds/transfer/master-account');
const r = await fetch(BASE_URL + path, {
method: 'POST',
headers,
body: JSON.stringify(body),
});
console.log(await r.json());
Response
{
"message": "transfer successful",
"data": {
"txn_id": "exchange_txn_abc123",
"subaccount_id": "1000",
"direction": "IN",
"amount": 500.00,
"quote_asset": "USDT"
}
}
| Field | Type | Description |
|---|---|---|
data.txn_id | string | Exchange transaction ID. |
data.subaccount_id | string | The master subaccount involved. |
data.direction | string | Echo of the direction. |
data.amount | number | Amount transferred. |
data.quote_asset | string | Asset transferred. |
Errors
| Status | Message | Cause |
|---|---|---|
400 | only USDT is supported for master account transfers | Non-USDT quote_asset specified. |
400 | amount must be greater than zero | Amount is zero or negative. |
403 | master account does not belong to this user | Master account belongs to a different user. |
403 | API key belongs to master/subaccount, not coinswitch key | Must use the CoinSwitch API key. |
404 | subaccount not found | Invalid subaccount_id. |
500 | internal server error | Unexpected failure. |