Authorize connection
This request should be executed first after establishing a WebSocket connection and repeated periodically to update the Access token in use.
The request authorizes the established WebSocket connection, within which all further requests for order management will be executed. Each new connection with /cws
interface should be authorized separately.
Authorization is not timeless - requests executed within an authorized connection are considered authorized within the validity period of the Access token (30 minutes from creation). When this period expires, you will need to repeat the request with a new token to continue your work.
Request
Authorized access to WebSocket API is provided only within the WebSocket connection in which the request was executed. For each new WebSocket connection authorization must be performed separately.
To authorize the connection and all further commands executed within it, run the request with the actual Access token as the value of the token
parameter.
- Request body
- Schema
{
"opcode": "authorize",
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813",
"token": "eyJhbGciOiJ..."
}
Request body parameters
authorize
— Authorization of WebSocket connectioncreate:market
— Creation of market ordercreate:limit
— Creation of limit ordercreate:stop
— Creation of stop ordercreate:stopLimit
— Creation of stop limit orderupdate:market
— Modification of market orderupdate:limit
— Modification of limit orderupdate:stop
— Modification of stop orderupdate:stopLimit
— Modification of stop limit orderdelete:market
— Cancelation of market orderdelete:limit
— Cancelation of limit orderdelete:stop
— Cancelation of stop orderdelete:stopLimit
— Cancelation of stop limit order
Operation code:
The unique identifier of the operation. All incoming messages related to this operation will have this guid
field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
Access Token
Example: eyJhbGciOiJ...
Responses
According to the results of processing the received request, the server will return a message with the corresponding code to the WebSocket connection.
- 200
- 400
- 401
Successful request processing report
- Body
- Schema
{
"requestGuid": "c328fcf1-e495-408a-a0ed-e20f95d6b813",
"httpCode": 200,
"message": "The connection has been initialized."
}
Response body parameters
The unique identifier of the operation. All incoming messages related to this operation will have this guid
field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
Response HTTP code
Example: 200
Text description of the returned HTTP code
Example: The connection has been initialized.
Failed to process the request. Check the validity of the transmitted message and try again.
- Body
- Schema
{
"requestGuid": "c328fcf1-e495-408a-a0ed-e20f95d6b813",
"httpCode": 400,
"message": "Invalid or unsupported quantity"
}
Response body parameters
The unique identifier of the operation. All incoming messages related to this operation will have this guid
field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
Response HTTP code
Example: 400
Text description of the returned HTTP code
Example: Invalid or unsupported quantity
Failed to process request. Access token is invalid, not specified in the message or belongs to other system environment
- Body
- Schema
{
"requestGuid": "c328fcf1-e495-408a-a0ed-e20f95d6b813",
"httpCode": 401,
"message": "Invalid JWT token!"
}
Response body parameters
The unique identifier of the operation. All incoming messages related to this operation will have this guid
field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
Response HTTP code
Example: 401
Text description of the returned HTTP code
Example: Invalid JWT token!