Create Subaccount
Creates a new subaccount under your master account and returns its credentials.
| Method | POST |
| Path | /dma/api/v1/master/subaccount/create |
| Auth | Authenticated (master account API key). |
No request body is required.
Request
- Python
- Java
- Go
- Node.js
from reference_client import sign_request, BASE_URL
import requests
headers, path = sign_request("POST", "/dma/api/v1/master/subaccount/create")
r = requests.post(BASE_URL + path, headers=headers)
print(r.json())
HttpResponse<String> resp = client.send(
"POST", "/dma/api/v1/master/subaccount/create", null, null);
System.out.println(resp.body());
headers, p, err := SignRequest("POST", "/dma/api/v1/master/subaccount/create", nil)
if err != nil { panic(err) }
req, _ := http.NewRequest("POST", BaseURL+p, nil)
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 {headers, path} = signRequest('POST', '/dma/api/v1/master/subaccount/create');
const r = await fetch(BASE_URL + path, {
method: 'POST',
headers,
});
console.log(await r.json());
Response
{
"message": "Subaccount successfully created and linked to master",
"data": {
"api_key": "cs_live_subaccount_key_abc...",
"api_secret": "subaccount_secret_xyz...",
"subaccount_id": 1001
}
}
| Field | Type | Description |
|---|---|---|
data.api_key | string | CoinSwitch API key for the new subaccount. |
data.api_secret | string | CoinSwitch API secret for the new subaccount. Store securely. |
data.subaccount_id | integer (int64) | Unique identifier for the subaccount — use this in all subsequent API calls. |
Errors
| Status | Message | Cause |
|---|---|---|
401 | X-Auth-Apikey header is required | Missing authentication headers. |
401 | invalid or expired API key | API key validation failed. |
403 | user is not registered as a master account | Caller is not a registered master. |
403 | this API key is not authorized... | Subaccount API key used instead of master. |
500 | internal server error | Unexpected failure. |