# Websocket API command confirmations

**URL:** https://community.tradovate.com/t/websocket-api-command-confirmations/4527
**Category:** API Developers
**Created:** [April 26, 2022, 5:57pm UTC](https://community.tradovate.com/t/websocket-api-command-confirmations/4527 "2022-04-26T17:57:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![beebee](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/beebee/32/1776_2.png) [@beebee](https://community.tradovate.com/u/beebee)
#### Post date: [April 26, 2022, 5:57pm UTC](https://community.tradovate.com/t/websocket-api-command-confirmations/4527/1 "2022-04-26T17:57:02Z")

</div>

Hello

When I subscribe to API websocket, I can get messages in two formats.  
There’s the messages and then there’s the commandReports.

I run into some issues where an api message says command was successful but then a few moments later the commandReport says the order failed.

The commandReports also come a bit later than the simple messages, just to clarify if I want to be certain that a command has succeeded or failed, I should wait on the command report?

---

<div class="post-metadata">

### Author: ![Alexander](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/alexander/32/988_2.png) [@Alexander](https://community.tradovate.com/u/Alexander)
#### Post date: [April 26, 2022, 7:46pm UTC](https://community.tradovate.com/t/websocket-api-command-confirmations/4527/2 "2022-04-26T19:46:15Z")

</div>

There are Commands, CommandReports and ExecutionReports. To send a command, you just use an API endpoint. To watch a command you want CommandReports, and to know about an order’s execution/fill/working status you want ExecutionReports.

---

<div class="post-metadata">

### Author: ![beebee](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/beebee/32/1776_2.png) [@beebee](https://community.tradovate.com/u/beebee)
#### Post date: [April 26, 2022, 8:16pm UTC](https://community.tradovate.com/t/websocket-api-command-confirmations/4527/3 "2022-04-26T20:16:22Z")

</div>

I understand the above. Let’s say I send make a cancel order request.

For example:  
It can succeed, fail with a too late message. I’ll get a 200 status response from the api messages but I’ll get a commandReport-\>commandStatus-\>ExecutionRejected with with a tooLate failure message.

Do I need to wait for the commandReport to see if the actual command succeeded because if I make a decision based on a 200 status response but then a few moments later the commandReport gives a conflicting message, I am a bit unclear on this.

It’s not only with cancel orders, i’ve had the issue happen with all different types of commands.  
I don’t have a log of it happening right now but here’s an example

when I get the SEQ\_NUM back, I use that to link the my command with the orderId; sometimes after the SEQ\_NUM is returned, I get no errors but a few moments later might get a different result PENDING, WORKING, CANCELLED or REJECTED

Do I have to wait until the order is confirmed with the via the commandReport before moving on or is matching the SEQ\_NUM enough?

```nohighlight
API -- ENTRY API_CMD_SELL_TO_OPEN_REQUEST SEND [26/04/2022 05:24:20:184312]
[order/placeorder
3.0

{"accountSpec":"xxx","accountId":xxx,"action":"Sell","timeInForce":"Day","symbol":2553027,"orderQty":1,"orderType":"Limit","price":4279.5,"isAutomated":true}]

#### A ---- THIS LINE is from the API, status_code 200
API -- GOT API_CMD_SELL_TO_OPEN_SEQ_NUM 

#### B------ Then I get these messages
API -- [PENDING] STO -- GOT API_CMD_SELL_TO_OPEN_ORDER_ID -- 
[{'entityType': 'executionReport', 'eventType': 'Created', 'entity': {'xxx'}}]

API -- STO -- ORDER ID [3746911793] ORDER STATUS [PENDING]

API -- [PENDING] STO -- GOT API_CMD_SELL_TO_OPEN_ORDER_ID -- 
[{'entityType': 'executionReport', 'eventType': 'Created', 'entity': {'xxx'}}]

API -- STO -- ORDER ID [3746911793] ORDER STATUS [PENDING]

API -- [FILLED] GOT API_CMD_SELL_TO_OPEN_ORDER_ID -- 
[{'entityType': 'executionReport', 'eventType': 'Created', 'entity': {'xxx'}}]

```

---

<div class="post-metadata">

### Author: ![beebee](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/beebee/32/1776_2.png) [@beebee](https://community.tradovate.com/u/beebee)
#### Post date: [April 29, 2022, 12:49pm UTC](https://community.tradovate.com/t/websocket-api-command-confirmations/4527/4 "2022-04-29T12:49:28Z")

</div>

I used the usersync command reports, they seem to come a bit later but that seems to be final.
