Trading Platforms (MT4, MT5) Integration
Create Trading Platform Account
This guide explains how to use the Create_TP_Account_Json API endpoint to create a new trading platform (TP) account for an existing client in the Hyper ERP/CRM system.This function requires a POST request with a JSON payload and proper Bearer token authentication.
Request Body
The request must be sent with a `Content-Type: application/json` header. The JSON payload must contain the client's ID and their specific API password.| Parameter | Type | Description |
|---|---|---|
| ClientNumber | Integer |
Required. The unique ID of the client. This is the client's [hyp_Clients].[Client Number] .
|
| API_Password | String | Required. The client-specific API password. This password is provided by the system and is stored in the client's website extension record. |
{
"ClientNumber":500014,
"API_Password":"S0wUqUWvujCf"
}
Successful Response (HTTP 200)
A successful response will return a ResponseCode of 0 and an `account` object containing the details of the newly created trading platform account.The `account` object is based on the
[hyp_TPM Account Status]
table and includes the following fields:
| Field | Type | Description |
|---|---|---|
| Account Login | Integer | The new unique Login ID for the trading platform. |
| Data Source | String | The identifier for the trading data source (e.g., "R1"). |
| Platform | String | The name of the trading platform (e.g., "MT5"). |
| Status | String | The initial status of the account. ENUM: 'Unknown', 'Closed', 'Readonly', 'Active'. |
| Group | String | The trading group the account was assigned to. |
| Currency | String | The base currency of the trading account, by the group (e.g., "USD"). |
| Balance | Money | The initial balance of the account (typically 0.00). |
{
"ResponseCode":0,
"ResponseMsgEng":"Success",
"account":{
"AccountLogin":636400,
"DataSource":"R1",
"Platform":"MT4",
"Status":2,
"Group":"Basic_IL2",
"Currency":"USD",
"Balance":0.00
}
}
Error Responses
Account Already Exists (HTTP 200)
If a trading account already exists for this client, the API will return a ResponseCode of 1 and include the details of the existing account.
{
"ResponseCode":1,
"ResponseMsgEng":"TP account is already exist",
"account":{
"AccountLogin":55521,
"DataSource":"R1",
"Platform":"MT4",
"Status":3,
"Group":"Basic_IL2",
"Currency":"USD",
"Balance":18270.84
}
}
Bad Request / Server Errors
These errors occur for invalid input or internal server issues.
// HTTP 401 Unauthorized
{
"ResponseCode": 99,
"ResponseMsgEng": "Missing / Wrong Access Token"
}
// HTTP 401 Unauthorized (implied)
{
"ResponseCode": 11,
"ResponseMsgEng": "Incorrect API_Password"
}
// HTTP 400 Bad Request
// (e.g., missing JSON body, invalid ClientNumber)
{
"ResponseCode": 14,
"ResponseMsgEng": "Bad or missing input data."
}
// HTTP 500 Internal Server Error
// (e.g., failed to load client data from DB)
{
"ResponseCode": 4,
"ResponseMsgEng": "Internal server error."
}
// HTTP 500 Internal Server Error
// (The trading platform itself did not respond in time)
{
"ResponseCode": 5,
"ResponseMsgEng": "Timeout with no Answer from the Trading System"
}