dhan orders
Read and manage today’s order book. Live placement, modification, cancellation, and slicing
require a static-IP whitelist on the Dhan side and the --yes flag.
Live action
Commands
Section titled “Commands”| Subcommand | Dhan endpoint | Purpose | Flags |
|---|---|---|---|
dhan orders list |
GET orders |
Today’s order book. | — |
dhan orders get <order-id> |
GET orders/{id} |
Show one order by id. | — |
dhan orders correlation <correlation-id> |
GET orders/external/{id} |
Show one order by correlation id. | — |
dhan orders place --file <json> --yes Live action |
POST orders |
Place an order from JSON. | --file (req), --yes (req), --dry-run |
dhan orders modify <order-id> --file <json> --yes Live action |
PUT orders/{id} |
Modify an order. | --file (req), --yes (req), --dry-run |
dhan orders cancel <order-id> --yes Live action |
DELETE orders/{id} |
Cancel a pending order. | --yes (req) |
dhan orders slice --file <json> --yes Live action |
POST orders/slicing |
Slice a large order. | --file (req), --yes (req), --dry-run |
Read-only
Section titled “Read-only”dhan orders list --json --no-colordhan orders get <order-id> --json --no-colordhan orders correlation <correlation-id> --json --no-colorOrder JSON payload
Section titled “Order JSON payload”The CLI auto-injects dhanClientId into the top-level JSON body if it isn’t already present
(this is Dhan’s identifier for “which client is placing the order”). Example shape:
{ "correlationId": "agent-run-001", "transactionType": "BUY", "exchangeSegment": "NSE_EQ", "productType": "CNC", "orderType": "LIMIT", "validity": "DAY", "securityId": "1333", "quantity": 1, "price": 1500, "afterMarketOrder": false}The --dry-run → --yes discipline
Section titled “The --dry-run → --yes discipline”For any live order-changing command, prefer a dry run first:
dhan orders place --file order.json --dry-run --json --no-color # validate, no HTTP calldhan orders place --file order.json --yes --json --no-color # actually place--dry-run parses the payload, prints { "dryRun": true, "payload": <body> }, and makes no
HTTP call. It does not require --yes.
Without --yes, the live command refuses with exit code 2 and the message
“This command changes live trading state. Re-run with --yes after verifying the payload.”
Static IP whitelisting
Section titled “Static IP whitelisting”Order placement, modification, cancellation, and slicing all require the calling machine’s
static public IP to be whitelisted on the Dhan side. See dhan ip. If the API
returns an authorization / static-IP error, do not retry in a loop — Dhan will continue
to refuse (and may rate-limit).