Skip to content
Cirrus home
Sign in

Reference

Bracket and cover orders

Orders the broker protects with its own stop-loss and target.

Read the guide first

Place a bracket or cover order #

POST /v1/orders/bracket scope orders

Places a broker bracket (BO: entry + stop-loss + target) or cover (CO: entry + stop-loss) order in one account; the legs show up in the order book as ordinary orders.

More about this

Once the request is valid the answer is 200 with the broker's verdict in status; request-level problems are 4xx and place nothing.

Repeat a request with the same Idempotency-Key to get the first answer back (Idempotent-Replayed: true) instead of placing again.

Parameters

  • Idempotency-Key header · string required

    A new UUID per order request (1-128 printable characters).

Body fields

  • account string required

    Account id (see /v1/accounts).

  • instrument_token string required

    Instrument id (see /v1/instruments).

  • kind string required

    BO (bracket: entry + stop-loss + target) or CO (cover: entry + stop-loss).

    One of: BO, CO

  • side string required

    Order side.

    One of: BUY, SELL

  • order_type string required

    Entry order type: LIMIT or MARKET.

    One of: MARKET, LIMIT, SL, SL_M

  • product string required

    MIS (intraday), CARRYFORWARD (overnight derivatives, NRML), DELIVERY (equity delivery, CNC) or MTF (margin trading facility).

    One of: MIS, CARRYFORWARD, DELIVERY, MTF

  • quantity integer (int64) required

    Units, or lots when qty_is_in_lot. Units round down to whole lots; under one lot is refused.

  • stop_loss number (double) required

    Stop-loss price.

  • qty_is_in_lot boolean

    quantity counts lots, not units.

  • price number (double)

    Entry limit price (LIMIT); 0 or absent for MARKET.

  • target number (double) | null

    Target price: required for BO, not allowed for CO.

  • trailing_stop_loss number (double) | null

    Trailing stop-loss step, in points (on the tick grid).

  • client_tag string | null

    Your own reference for the entry (1-64 letters, digits, _, ., : or -), echoed in the answer and kept on the order: GET /v1/orders/{client_tag} finds it.

Errors

HTTPCodeWhen
400idempotency_key_required

The Idempotency-Key header is missing (use a new UUID per order request).

400invalid_idempotency_key

The Idempotency-Key header is not 1-128 printable characters.

400malformed_json

The body is not JSON, or does not fit the request shape (unknown or missing fields, wrong types).

401unauthorized

No credential, or the credential is invalid, expired or revoked.

403forbidden

The credential may not use this route (missing scope, app-session-only route, IP not allowed).

404account_not_found

No linked broker account with this id for the caller.

409request_in_progress

A request with this Idempotency-Key is still being processed.

422invalid_request

The request is well-formed but not valid; field names the input.

422idempotency_key_reused

This Idempotency-Key was already used with a different request.

429rate_limited

Too many requests for this credential (or too many failed attempts); retry after the Retry-After header (seconds; error.retry_after_ms has the exact wait).

503service_unavailable

A dependency is temporarily unavailable, or the feature is off on this server; retry later.

All fields (request and response schema)

Loading fields…

POST
curl -X POST "https://cirrus.pocketful.in/v1/orders/bracket" \
  -H "Authorization: token $CIRRUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "account": "PF1",
    "instrument_token": "CT:TEST:RELIANCE",
    "kind": "BO",
    "side": "BUY",
    "order_type": "LIMIT",
    "product": "MIS",
    "quantity": 5,
    "price": 2500,
    "stop_loss": 2450,
    "target": 2600
  }'
Response · 200
{
  "status": "success",
  "data": {
    "account": "PF1",
    "basket_id": "777",
    "order_id": null,
    "status": "accepted",
    "message": null
  },
  "error": null
}

Modify a bracket or cover order #

PATCH /v1/orders/bracket/{order_id} scope orders

Changes the entry price or quantity, or the legs, of a bracket / cover order in one account.

More about this

Once the request is valid the answer is 200 with the broker's verdict in status.

Parameters

  • order_id path · string required

    Broker order id, order_tag or client_tag of the entry, as GET /v1/orders/{order_id} takes it (1-64 letters, digits, -, _, . or :).

Body fields

  • account string required

    Account id the order is in.

  • instrument_token string required

    Instrument id of the order.

  • kind string required

    BO (bracket: entry + stop-loss + target) or CO (cover: entry + stop-loss).

    One of: BO, CO

  • side string required

    Side of the entry.

    One of: BUY, SELL

  • entry_price number (double) required

    Entry price the legs are measured from.

  • price number (double) | null

    New entry limit price.

  • quantity integer (int64) | null

    New quantity, in units.

  • stop_loss number (double) | null

    New stop-loss price.

  • target number (double) | null

    New target price (BO only).

  • trailing_stop_loss number (double) | null

    New trailing stop-loss step, in points.

Errors

HTTPCodeWhen
400malformed_json

The body is not JSON, or does not fit the request shape (unknown or missing fields, wrong types).

401unauthorized

No credential, or the credential is invalid, expired or revoked.

403forbidden

The credential may not use this route (missing scope, app-session-only route, IP not allowed).

404account_not_found

No linked broker account with this id for the caller.

422invalid_request

The request is well-formed but not valid; field names the input.

429rate_limited

Too many requests for this credential (or too many failed attempts); retry after the Retry-After header (seconds; error.retry_after_ms has the exact wait).

503service_unavailable

A dependency is temporarily unavailable, or the feature is off on this server; retry later.

All fields (request and response schema)

Loading fields…

PATCH
curl -X PATCH "https://cirrus.pocketful.in/v1/orders/bracket/<order_id>" \
  -H "Authorization: token $CIRRUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "account": "PF1",
    "instrument_token": "CT:TEST:RELIANCE",
    "kind": "BO",
    "side": "BUY",
    "entry_price": 2500,
    "stop_loss": 2460,
    "target": 2620
  }'
Response · 200
{
  "status": "success",
  "data": {
    "account": "PF1",
    "basket_id": null,
    "order_id": "250929000001",
    "status": "accepted",
    "message": null
  },
  "error": null
}

Cancel a bracket or cover order #

DELETE /v1/orders/bracket/{order_id} scope orders

Cancels a bracket / cover order (entry and legs) in one account.

More about this

Once the request is valid the answer is 200 with the broker's verdict in status.

Parameters

  • order_id path · string required

    Broker order id, order_tag or client_tag of the entry, as GET /v1/orders/{order_id} takes it (1-64 letters, digits, -, _, . or :).

  • account query · string required

    Account id the order is in.

  • kind query · string required

    BO or CO.

Errors

HTTPCodeWhen
400invalid_query

The query string does not fit the route's parameters.

401unauthorized

No credential, or the credential is invalid, expired or revoked.

403forbidden

The credential may not use this route (missing scope, app-session-only route, IP not allowed).

404account_not_found

No linked broker account with this id for the caller.

422invalid_request

The request is well-formed but not valid; field names the input.

429rate_limited

Too many requests for this credential (or too many failed attempts); retry after the Retry-After header (seconds; error.retry_after_ms has the exact wait).

503service_unavailable

A dependency is temporarily unavailable, or the feature is off on this server; retry later.

All fields (request and response schema)

Loading fields…

DELETE
curl -X DELETE "https://cirrus.pocketful.in/v1/orders/bracket/<order_id>?account=<account>&kind=<kind>" \
  -H "Authorization: token $CIRRUS_API_KEY"
Response · 200
{
  "status": "success",
  "data": {
    "account": "PF1",
    "basket_id": null,
    "order_id": "250929000001",
    "status": "accepted",
    "message": null
  },
  "error": null
}