Server message spec
Basic server message structure
Description
Server messages are used to deliver:
Responses to client requests (e.g. account data, authentication result)
Real-time updates (e.g. price or position changes)
Snapshots of full entity lists (e.g. all accounts or trades)
System errors indicating problems with the request or processing
All messages are wrapped in the server_message
field inside message_type
.
There are two core categories of server messages:
Response messages – contain either a
success
orerror
value and always includemessage_response_id
linking them to the original client requestEvent messages – broadcast snapshots or updates with
snapshot
orupdate
keys; these do not includemessage_response_id
Each payload is grouped by topic (e.g., accounts
, orders
, positions
, etc.).
Json Structure
Event Message
Used for broadcasting real-time updates or snapshots to all or subscribed clients.
{
"message_id": "string", // Unique message ID (UUID)
"message_response_id": null, // Always null for event messages
"message_type": {
"server_message": {
"positions": {
"snapshot": [
// Full array of domain objects (e.g. positions)
]
}
}
}
}
Or for updates:
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"positions": {
"update": {
// Single object or array of updated domain objects
}
}
}
}
}
Or for errors
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"positions": {
"error": "unauthorized"
}
}
}
}
Response Messages
Used for responses to client-initiated requests (e.g., get_positions
, auth_request
, etc.).
{
"message_id": "string",
"message_response_id": "uuid", // Refers to original request message_id
"message_type": {
"server_message": {
"get_positions_response": {
"success": [
// Array of positions
]
}
}
}
}
Error Message
{
"message_id": "string",
"message_response_id": "uuid|null", // Present only if it's a response error
"message_type": {
"server_message": {
"get_positions_response": {
"error": "unauthorized"
}
}
}
}
Server Message Envelope Fields
message_id
string
Unique UUID of the outgoing server message
message_response_id
string (opt)
UUID of the original client message (for responses)
message_type
object
Contains the server_message
, which includes either a response or event payload
YftManagerApiServerMessage
Description
YftManagerApiServerMessage
is the main enum used by the server to send any outgoing message.
Each variant wraps a payload using one of the following wrappers:
YftManagerApiServerResponse<T>
Used for client request responses, containing either:
Success(T)
Error(YftManagerApiErrorType)
YftManagerApiEventType<T, F>
Used for event streams, containing either:
Snapshot(F)
— full list (e.g. all orders)Update(T)
— new or changed item(s)
This design allows the client to clearly understand:
If the message is a reply or an event
Whether to replace or merge data
How to handle errors contextually
Enum: YftManagerApiServerMessage
YftManagerApiServerMessage
AuthResponse
Response to AuthRequest
, wraps success or error
ServerTimeResponse
Response to GetServerTime
GetAccountsResponse
Response to GetAccounts
, contains list of accounts
GetPositionsResponse
Response to GetPositions
, contains list of positions
GetLastPriceResponse
Response to GetLastPrices
, contains price list
UpdateBalanceResponse
Response to UpdateBalance
, returns updated account
GetHistoryPositionsResponse
Response to GetHistoryPositions
, contains historical positions
GetOrdersResponse
Response to GetOrders
, returns order list
GetTradesResponse
Response to GetTrades
, returns trade list
SubscribeResult
Response to Subscribe
, indicates subscription success/failure
Accounts
Event: snapshot or update of account data
Positions
Event: snapshot or update of position data
HistoryPositions
Event: snapshot/update of historical positions
LastPrices
Event: snapshot or update of prices
Orders
Event: snapshot or update of orders
Trades
Event: snapshot or update of trades
TradingGroups
Event: snapshot or update of trading groups
TradingInstruments
Event: snapshot or update of instruments
TradingProfiles
Event: snapshot or update of trading profiles
TradingMarkups
Event: snapshot or update of markup profiles
DayOffProfiles
Event: snapshot or update of day-off profiles
Error Codes
When a server operation fails, the error
field appears under the relevant server_message
response or event.
These values come from the predefined enum YftManagerApiErrorType
.
unauthorized
The client is not authenticated
auth_failed
Authentication failed due to bad input
unknown_topic
Requested topic does not exist
network_error
Network-related failure occurred
unexpected
Internal or unexpected server error
AuthResponse
The AuthResponse
message is sent in reply to an AuthRequest
.
It indicates whether the authentication was successful and, if so, includes session and user details.
Depending on the result, the response may contain either:
success
: with a fullAuthResultJsonMessage
payloaderror
: with a standardized error type fromYftManagerApiErrorType
(e.g.,unauthorized
,auth_failed
)
JSON Structure
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"auth_response": {
"success": {
"session_id": "string"
}
}
}
}
}
Field Reference
message_id
string
Unique ID of the outgoing server message
message_response_id
string
UUID of the original AuthRequest
message_type
object
Wraps server_message.auth_response
success.session_id
string
Session ID assigned to the authenticated client
error
string
(enum)
Error code: unauthorized
, auth_failed
, etc.
ServerTime
Returns the current server time. Used by clients to synchronize clocks, measure latency, or test connectivity.
JSON Structure
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"server_time_response": {
"success": {
"server_time": "2025-06-15T19:38:17.000+03:00"
}
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message.
message_type
string
Always "server_message"
for server responses.
message_response_id
string
Corresponds to the original client message this is replying to.
server_time
string
Server time in ISO 8601 / RFC 3339 format, e.g. "2025-06-05T19:38:17.000+03:00"
.
GetAccountsResponse
Returns a list of trading accounts available to the authenticated user.
This message is a direct response to a GetAccounts
request.
JSON Structure (Success)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_accounts_response": {
"success": [
{
/* ManagerApiAccount object */
}
]
}
}
}
}
JSON Structure (Error)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_accounts_response": {
"error": "unauthorized"
}
}
}
}
📑 Field Reference
message_id
string
Unique identifier of this server message
message_response_id
string
UUID of the original GetAccounts
request
success
array
List of account objects available to the user
error
string
Error code if the request failed (unauthorized
, etc.)
📌 See the ManagerApiAccount model for details on the account structure.
GetPositionsResponse
Returns a list of currently open trading positions for the authenticated user or account.
This message is a direct response to a GetPositions
request.
JSON Structure (Success)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_positions_response": {
"success": [
{
/* ManagerApiPosition object */
}
]
}
}
}
}
JSON Structure (Error)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_positions_response": {
"error": "unauthorized"
}
}
}
}
📑 Field Reference
message_id
string
Unique identifier of this server message
message_response_id
string
UUID of the original GetPositions
request
success
array
List of open positions
error
string
Error code if the request failed (unauthorized
, etc.)
🔎 See the ManagerApiPosition model for details on the position structure.
GetHistoryPositionsResponse
Returns a list of historical (closed) trading positions for the authenticated user or account.
This message is a direct response to a GetHistoryPositions
request.
JSON Structure (Success)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_history_positions_response": {
"success": [
{
/* ManagerApiPosition object */
}
]
}
}
}
}
JSON Structure (Error)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_history_positions_response": {
"error": "unauthorized"
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
string
UUID of the original GetHistoryPositions
request
success
array
List of closed (historical) trading positions
error
string
Error code if the request failed (unauthorized
, etc.)
See the ManagerApiPosition model for details on the position structure.
GetLastPriceResponse
Returns the latest bid/ask prices for all available trading instruments.
This message is a direct response to a GetLastPrices
request.
JSON Structure (Success)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_last_price_response": {
"success": [
{
/* ManagerApiBidAsk object */
}
]
}
}
}
}
JSON Structure (Error)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_last_price_response": {
"error": "unauthorized"
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
string
UUID of the original GetLastPrices
request
success
array
List of bid/ask price objects
error
string
Error code if the request failed (unauthorized
, etc.)
See the ManagerApiBidAsk model for details on the bid/ask structure.
UpdateBalanceResponse
Returns updated account information along with the balance operation that caused the update (if any). This message is a direct response to an
UpdateBalance
request.
JSON Structure (Success)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"update_balance_response": {
"success": {
"updated": {
"id": "string",
"trader_id": "string",
"currency": "string",
"balance": 0.0,
"equity": 0.0,
"margin": 0.0,
"free_margin": 0.0,
"margin_level": 0.0,
"leverage": 0.0,
"trading_group": "string",
"last_update_date": 0,
"metadata": {
"key": "value"
},
"status": "active",
"hedge_mode": "hedge"
},
"operation": {
"id": "string",
"trader_id": "string",
"account_id": "string",
"reason": "deposit",
"process_id": "string",
"delta": 100.0,
"date": 0,
"comment": "optional comment",
"reference_operation_id": "string"
}
}
}
}
}
}
JSON Structure (Error)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"update_balance_response": {
"error": "network_error"
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
string
UUID of the original UpdateBalance
request
success.operation
object | null
Balance operation that triggered the update (see ManagerApiAccountBalanceUpdateOperation
).
error
string
Error code if the request failed (network_error
, etc.)
See the ManagerApiAccount and ManagerApiAccountBalanceUpdateOperation model for details on the account structure.
GetOrdersResponse
Returns a list of active orders for the authenticated user or account.
This message is a direct response to a GetOrders
request.
JSON Structure (Success)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_orders_response": {
"success": [
{
/* ManagerApiOrder object */
}
]
}
}
}
}
JSON Structure (Error)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_orders_response": {
"error": "unauthorized"
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
string
UUID of the original GetOrders
request
success
array
List of active order objects
error
string
Error code if the request failed (unauthorized
, etc.)
See the ManagerApiOrder model for details on the order structure.
GetTradesResponse
Returns a list of trades executed for the authenticated user or account.
This message is a direct response to a GetTrades
request.
JSON Structure (Success)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_trades_response": {
"success": [
{
/* ManagerApiTrade object */
}
]
}
}
}
}
JSON Structure (Error)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"get_trades_response": {
"error": "unauthorized"
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
string
UUID of the original GetTrades
request
success
array
List of executed trade objects
error
string
Error code if the request failed (unauthorized
, etc.)
See the ManagerApiTrade model for details on the trade structure.
SubscribeResult
Indicates whether a client successfully subscribed to a specific data topic.
This message is a direct response to a Subscribe
request.
JSON Structure (Success)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"subscribe_result": {
"success": true
}
}
}
}
JSON Structure (Error)
{
"message_id": "string",
"message_response_id": "string",
"message_type": {
"server_message": {
"subscribe_result": {
"error": "unknown_topic"
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
string
UUID of the original Subscribe
request
success
boolean
true
if the subscription was successful
error
string
Error code if the request failed (unknown_topic
, unauthorized
, etc.)
Accounts
Broadcast message that delivers either the full list of accounts or incremental updates.
This is an event-type message and is not tied to a specific request (i.e., message_response_id
is always null).
The payload may contain:
snapshot
: full list of current accounts (Vec<ManagerApiAccount>
)update
: a single account-related change (ManagerApiAccountEvent
)
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"accounts": {
"snapshot": [
{
/* ManagerApiAccount object */
}
]
}
}
}
}
JSON Structure (Update – Added)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"accounts": {
"update": {
"added": {
/* ManagerApiAccount object */
}
}
}
}
}
}
JSON Structure (Update – Updated)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"accounts": {
"update": {
"updated": [
{
/* ManagerApiAccount object */
},
{
/* ManagerApiAccountBalanceUpdateOperation object */
}
]
}
}
}
}
}
Or, when no balance operation is present:
"updated": [
{
/* ManagerApiAccount object */
},
null
]
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Full list of accounts (ManagerApiAccount
)
update
object
A single change described by ManagerApiAccountEvent
ManagerApiAccountEvent
Describes the nature of an account change:
added
A new account was created. Contains a ManagerApiAccount
object
updated
An existing account was modified. Contains a ManagerApiAccount
and an optional ManagerApiAccountBalanceUpdateOperation
(e.g., deposit, withdrawal, correction)
See the ManagerApiAccount and ManagerApiAccountBalanceUpdateOperation models for structure details.
Positions
Broadcast message that delivers either the full list of currently open positions or an incremental position update.
This is an event-type message and does not contain message_response_id
.
The payload may contain:
snapshot
: list of all currently open positions (Vec<ManagerApiPosition>
)update
: a single position-related change (ManagerApiPositionEvent
)
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"positions": {
"snapshot": [
{
/* ManagerApiPosition object */
}
]
}
}
}
}
JSON Structure (Update – Created)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"positions": {
"update": {
"created": {
/* ManagerApiPosition object */
}
}
}
}
}
}
JSON Structure (Update – Updated)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"positions": {
"update": {
"updated": {
/* ManagerApiPosition object */
}
}
}
}
}
}
JSON Structure (Update – Closed)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"positions": {
"update": {
"closed": {
/* ManagerApiPosition object */
}
}
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Full list of open positions (ManagerApiPosition
)
update
object
A single change described by ManagerApiPositionEvent
ManagerApiPositionEvent
Describes the nature of a position change:
created
A new position was opened
updated
An existing position was updated (e.g. SL/TP, volume, etc.)
closed
The position was closed
Each variant contains a full ManagerApiPosition
object.
See the ManagerApiPosition model for structure details.
HistoryPositions
Broadcast message that delivers either a full snapshot or an update of closed (historical) trading positions. This is an event-type message and is not tied to a specific client request.
The payload may contain:
snapshot
: full list of historical positions (Vec<ManagerApiPosition>
)update
: partial update (subset of closed positions, typically aVec<ManagerApiPosition>
as well)
⚠️ Unlike live positions, there is no separate event enum here — both
snapshot
andupdate
use plain array ofManagerApiPosition
.
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"history_positions": {
"snapshot": [
{
/* ManagerApiPosition object */
}
]
}
}
}
}
JSON Structure (Update)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"history_positions": {
"update": [
{
/* ManagerApiPosition object */
}
]
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Full list of historical positions
update
array
Subset of new/updated closed positions
See the ManagerApiPosition model for details on the position structure.
LastPrices
Broadcast message that delivers either a full snapshot or an update of the latest bid/ask prices. This is an event-type message used for real-time price feeds.
The payload may contain:
snapshot
: full list of the latest prices for all instrumentsupdate
: subset of instruments whose prices have changed
Both snapshot
and update
contain arrays of ManagerApiBidAsk
objects.
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"last_prices": {
"snapshot": [
{
/* ManagerApiBidAsk object */
}
]
}
}
}
}
JSON Structure (Update)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"last_prices": {
"update": [
{
/* ManagerApiBidAsk object */
}
]
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Latest known prices for all trading instruments
update
array
Price changes for one or more instruments
See the ManagerBidAsk model for details on the price structure.
Orders
Broadcast message that delivers either the full list of currently active orders or an incremental order change. This is an event-type message and is not tied to a specific client request.
The payload may contain:
snapshot
: full list of currently active ordersupdate
: a single order-related event (create, cancel, execute, etc.)
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"orders": {
"snapshot": [
{
/* ManagerApiOrder object */
}
]
}
}
}
}
JSON Structure (Update – Examples)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"orders": {
"update": {
"created": {
/* ManagerApiOrder object */
}
}
}
}
}
}
"update": {
"canceled": {
/* ManagerApiOrder object */
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Full list of active orders
update
object
A single order-related event (ManagerApiOrderEvent
)
ManagerApiOrderEvent
Represents a change to a single order. The event can be one of the following:
created
A new order was placed
updated
An existing order was modified
canceled
An order was canceled
executed
An order was fully or partially filled
failed
The order was rejected or failed to execute
Each variant contains a full ManagerApiOrder
object.
See the ManagerApiOrder model for details on the order structure.
TradingGroups
Broadcast message that delivers either the full list of trading groups or an incremental update. This is an event-type message and is not tied to a specific request.
The payload may contain:
snapshot
: full list of available trading groupsupdate
: subset of added or changed trading groups
Both snapshot
and update
are arrays of ManagerApiTradingGroup
objects.
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"trading_groups": {
"snapshot": [
{
/* ManagerApiTradingGroup object */
}
]
}
}
}
}
JSON Structure (Update)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"trading_groups": {
"update": [
{
/* ManagerApiTradingGroup object */
}
]
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Full list of trading groups
update
array
Newly added or changed trading groups
See the ManagerApiTradingGroup model for details on the trading group structure.
TradingInstruments
Broadcast message that delivers either the full list of trading instruments or an incremental update. This is an event-type message and is not tied to a specific request.
The payload may contain:
snapshot
: full list of available instrumentsupdate
: subset of newly added or modified instruments
Both snapshot
and update
are arrays of ManagerApiTradingInstrument
objects.
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"trading_instruments": {
"snapshot": [
{
/* ManagerApiTradingInstrument object */
}
]
}
}
}
}
JSON Structure (Update)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"trading_instruments": {
"update": [
{
/* ManagerApiTradingInstrument object */
}
]
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Full list of available trading instruments
update
array
Newly added or updated trading instruments
See the ManagerApiTradingInstrument model for details on the instrument structure.
TradingProfiles
Broadcast message that delivers either the full list of trading profiles or an incremental update. This is an event-type message and is not tied to a specific client request.
The payload may contain:
snapshot
: full list of trading profilesupdate
: subset of newly added or modified profiles
Both snapshot
and update
are arrays of ManagerApiTradingProfile
objects.
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"trading_profiles": {
"snapshot": [
{
/* ManagerApiTradingProfile object */
}
]
}
}
}
}
JSON Structure (Update)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"trading_profiles": {
"update": [
{
/* ManagerApiTradingProfile object */
}
]
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Full list of trading profiles
update
array
Newly added or updated trading profiles
See the ManagerApiTradingProfile model for details on the profile structure.
TradingMarkups
Broadcast message that delivers either the full list of trading markup profiles or an incremental update. This is an event-type message and is not tied to any client request.
The payload may contain:
snapshot
: full list of markup profilesupdate
: subset of newly added or modified markup profiles
Both snapshot
and update
are arrays of ManagerApiMarkupProfile
objects.
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"trading_markups": {
"snapshot": [
{
/* ManagerApiMarkupProfile object */
}
]
}
}
}
}
JSON Structure (Update)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"trading_markups": {
"update": [
{
/* ManagerApiMarkupProfile object */
}
]
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Full list of markup profiles
update
array
Newly added or updated markup profiles
See the ManagerApiMarkupProfile model for details on the markup structure.
DayOffProfiles
Broadcast message that delivers either the full list of trading day-off profiles or an incremental update. This is an event-type message and is not tied to any specific request.
The payload may contain:
snapshot
: full list of day-off profilesupdate
: subset of newly added or modified profiles
Both snapshot
and update
are arrays of ManagerApiDayOffProfile
objects.
JSON Structure (Snapshot)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"day_off_profiles": {
"snapshot": [
{
/* ManagerApiDayOffProfile object */
}
]
}
}
}
}
JSON Structure (Update)
{
"message_id": "string",
"message_response_id": null,
"message_type": {
"server_message": {
"day_off_profiles": {
"update": [
{
/* ManagerApiDayOffProfile object */
}
]
}
}
}
}
Field Reference
message_id
string
Unique identifier of this server message
message_response_id
null
Always null for event messages
snapshot
array
Full list of trading day-off profiles
update
array
Newly added or updated day-off profiles
See the ManagerApiDayOffProfile model for details on the profile structure.
Last updated