For the complete documentation index, see llms.txt. This page is also available as Markdown.

CancelOrder

Cancel a specific open order by its order ID.

Endpoint URL

Local Host   :  POST http://127.0.0.1:5000/api/v1/cancelorder
Ngrok Domain :  POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/cancelorder
Custom Domain:  POST https://<your-custom-domain>/api/v1/cancelorder

Sample API Request

{
  "apikey": "<your_app_apikey>",
  "orderid": "250408001002736",
  "strategy": "Python"
}

Sample cURL Request

curl -X POST http://127.0.0.1:5000/api/v1/cancelorder \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>",
  "orderid": "250408001002736",
  "strategy": "Python"
}'

Sample API Response

Request Body

Parameter
Description
Mandatory/Optional
Default Value

apikey

Your OpenAlgo API key

Mandatory

-

orderid

Order ID to cancel

Mandatory

-

strategy

Strategy identifier

Optional

-

Response Fields

Field
Type
Description

status

string

"success" or "error"

orderid

string

Cancelled order ID

message

string

Error message (on failure)

mode

string

"live" or "analyze"

Notes

  • Only open/pending orders can be cancelled

  • Completed orders cannot be cancelled

  • Orders that are being processed (in transit) may not be cancellable

  • If the order is already cancelled, the API returns success

  • For AMO (After Market Orders), cancellation rules may differ

Error Scenarios

Error
Cause

Order not found

Invalid order ID

Order not cancellable

Order already executed

Order in transit

Order being processed at exchange


Back to: API Documentation

Last updated