{
  "openapi": "3.1.0",
  "info": {
    "title": "Cirrus API",
    "description": "Trade across linked broker accounts with one API: place, modify and cancel orders (one order across many accounts), bracket / cover and GTT orders, server-side stop-loss / target triggers, live order book, positions, holdings, trades and funds, a WebSocket stream of changes, an activity log, and signed webhooks.\n\nEvery JSON response has the same envelope: `{\"status\": \"success\", \"data\": ..., \"error\": null}` or `{\"status\": \"error\", \"data\": null, \"error\": {\"code\", \"message\", \"field\"}}` (see `ErrorCode` for every code). All keys are snake_case. A few fields are also sent under a deprecated legacy name with the same value, and requests accept either name: `x-deprecated-aliases` lists them (per schema, and for the whole API under `info`). Use the documented names.\n\nAuthenticate with an API key (`Authorization: token <key_id>:<key_secret>`) or, for partner apps, an OAuth 2.0 access token (authorization code with PKCE). Operations tagged `app_session_only` (`x-app-only: true`) are available only to the signed-in app. Each operation's `x-required-scope` names the scope it needs.",
    "x-deprecated-aliases": {
      "cirrus_token": "instrument_token",
      "cirrus_tag": "order_tag",
      "cirrus_exits": "exits"
    },
    "version": "1.3.0"
  },
  "paths": {
    "/v1/orders": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Place orders",
        "description": "Places each order in every account it names (sized per account; split above the exchange freeze quantity). Once placement starts the answer is 200 with one result per slice, even when some accounts refuse: check each `status`. Request-level problems (bad JSON, validation, unknown instrument or account list, missing `Idempotency-Key`) are 4xx and place nothing.\n\nRepeat a request with the same `Idempotency-Key` to get the first answer back (`Idempotent-Replayed: true`) instead of placing again.",
        "operationId": "place_orders",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "A new UUID per order request (1-128 printable characters).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlaceOrdersRequest"
              },
              "examples": {
                "hedged_partial_fill": {
                  "summary": "Hedge first: the sold leg waits for the bought one and is sent for its filled share",
                  "value": {
                    "orders": [
                      {
                        "instrument_token": "CT:TEST:NIFTY22500CE",
                        "side": "BUY",
                        "order_type": "LIMIT",
                        "product": "CARRYFORWARD",
                        "quantity": 300,
                        "price": 68,
                        "accounts": [
                          "P1"
                        ]
                      },
                      {
                        "instrument_token": "CT:TEST:NIFTY22400CE",
                        "side": "SELL",
                        "order_type": "LIMIT",
                        "product": "CARRYFORWARD",
                        "quantity": 300,
                        "price": 112.5,
                        "accounts": [
                          "P1"
                        ],
                        "depends_on": 0,
                        "depends_on_partial": "filled_qty",
                        "depends_on_timeout_ms": 5000
                      }
                    ]
                  }
                },
                "partial_failure": {
                  "summary": "One order, two accounts: one accepted, one refused",
                  "value": {
                    "orders": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "order_type": "LIMIT",
                        "product": "DELIVERY",
                        "quantity": 1,
                        "price": 2500,
                        "accounts": [
                          "P1",
                          "Z1"
                        ]
                      }
                    ]
                  }
                },
                "protected": {
                  "summary": "Protected entry: a broker bracket where the broker has one, a server-side trigger elsewhere",
                  "value": {
                    "orders": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "order_type": "LIMIT",
                        "product": "MIS",
                        "quantity": 5,
                        "price": 2500,
                        "accounts": [
                          "PF1",
                          "U1"
                        ],
                        "protection": {
                          "stop_loss": {
                            "enabled": true,
                            "type": "points",
                            "value": 20
                          },
                          "target": {
                            "enabled": true,
                            "type": "points",
                            "value": 40
                          }
                        }
                      }
                    ]
                  }
                },
                "protected_by_v2_trigger": {
                  "summary": "Stop-loss and target held by the server as a v2 trigger, created when the order fills",
                  "value": {
                    "orders": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "order_type": "LIMIT",
                        "product": "MIS",
                        "quantity": 5,
                        "price": 2500,
                        "accounts": [
                          "P1"
                        ],
                        "protection": {
                          "stop_loss": {
                            "enabled": true,
                            "type": "points",
                            "value": 20
                          },
                          "target": {
                            "enabled": true,
                            "type": "points",
                            "value": 40
                          },
                          "route": "trigger"
                        }
                      }
                    ]
                  }
                },
                "success": {
                  "summary": "Placed in one account",
                  "value": {
                    "orders": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "order_type": "LIMIT",
                        "product": "DELIVERY",
                        "quantity": 1,
                        "price": 2500,
                        "accounts": [
                          "P1"
                        ]
                      }
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Placement ran; one result per slice.",
            "headers": {
              "Idempotency-Key": {
                "schema": {
                  "type": "string"
                },
                "description": "The request's `Idempotency-Key`, echoed."
              },
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_PlaceOrdersResponse"
                },
                "examples": {
                  "hedged_partial_fill": {
                    "summary": "Hedge first: the sold leg waits for the bought one and is sent for its filled share",
                    "value": {
                      "status": "success",
                      "data": {
                        "results": [
                          {
                            "order_index": 0,
                            "account": "P1",
                            "cirrus_token": "CT:TEST:NIFTY22500CE",
                            "cirrus_tag": "01M4XDF6ERZPG3PV2FKERCT8VY",
                            "quantity": 300,
                            "status": "accepted",
                            "order_id": "PAPER-1",
                            "message": null,
                            "order_type": "LIMIT",
                            "price": 68,
                            "instrument_token": "CT:TEST:NIFTY22500CE",
                            "order_tag": "01M4XDF6ERZPG3PV2FKERCT8VY"
                          },
                          {
                            "order_index": 1,
                            "account": "P1",
                            "cirrus_token": "CT:TEST:NIFTY22400CE",
                            "cirrus_tag": "01M4XDFBBDFY172K9KX6PYQHRE",
                            "quantity": 150,
                            "status": "accepted",
                            "order_id": "PAPER-1",
                            "message": null,
                            "order_type": "LIMIT",
                            "price": 112.5,
                            "reduced_from": 300,
                            "instrument_token": "CT:TEST:NIFTY22400CE",
                            "order_tag": "01M4XDFBBDFY172K9KX6PYQHRE"
                          }
                        ],
                        "accepted": 2,
                        "rejected": 0,
                        "unknown": 0
                      },
                      "error": null
                    }
                  },
                  "partial_failure": {
                    "summary": "One order, two accounts: one accepted, one refused",
                    "value": {
                      "status": "success",
                      "data": {
                        "results": [
                          {
                            "order_index": 0,
                            "account": "P1",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "cirrus_tag": "01M3PGPRZHC3EKF5WBRE13ECS3",
                            "quantity": 1,
                            "status": "accepted",
                            "order_id": "PAPER-1",
                            "message": null,
                            "order_type": "LIMIT",
                            "price": 2500,
                            "instrument_token": "CT:TEST:RELIANCE",
                            "order_tag": "01M3PGPRZHC3EKF5WBRE13ECS3"
                          },
                          {
                            "order_index": 0,
                            "account": "Z1",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "cirrus_tag": "01M3PGPRZHQRCBZXZSAEJPG4RS",
                            "quantity": 1,
                            "status": "rejected",
                            "order_id": null,
                            "message": "Broker zerodha is not supported yet.",
                            "order_type": "LIMIT",
                            "price": 2500,
                            "reason": "no_session",
                            "instrument_token": "CT:TEST:RELIANCE",
                            "order_tag": "01M3PGPRZHQRCBZXZSAEJPG4RS"
                          }
                        ],
                        "accepted": 1,
                        "rejected": 1,
                        "unknown": 0
                      },
                      "error": null
                    }
                  },
                  "protected": {
                    "summary": "Protected entry: a broker bracket where the broker has one, a server-side trigger elsewhere",
                    "value": {
                      "status": "success",
                      "data": {
                        "results": [
                          {
                            "order_index": 0,
                            "account": "PF1",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "cirrus_tag": "01M6114QW86RVRRF9AGWXPGZ1D",
                            "quantity": 5,
                            "status": "accepted",
                            "order_id": null,
                            "message": "placed as a broker bracket order (basket 777)",
                            "order_type": "LIMIT",
                            "price": 2500,
                            "protection": "bracket",
                            "protection_id": "777",
                            "instrument_token": "CT:TEST:RELIANCE",
                            "order_tag": "01M6114QW86RVRRF9AGWXPGZ1D"
                          },
                          {
                            "order_index": 0,
                            "account": "U1",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "cirrus_tag": "01M6114QW8JR7SEXJA8MW48JYW",
                            "quantity": 5,
                            "status": "accepted",
                            "order_id": "250924000000123",
                            "message": null,
                            "order_type": "LIMIT",
                            "price": 2500,
                            "protection": "trigger",
                            "trigger_v2_id": "01M6114QWBNVGMMAKGXZ6QD44V",
                            "instrument_token": "CT:TEST:RELIANCE",
                            "order_tag": "01M6114QW8JR7SEXJA8MW48JYW"
                          }
                        ],
                        "accepted": 2,
                        "rejected": 0,
                        "unknown": 0
                      },
                      "error": null
                    }
                  },
                  "protected_by_v2_trigger": {
                    "summary": "Stop-loss and target held by the server as a v2 trigger, created when the order fills",
                    "value": {
                      "status": "success",
                      "data": {
                        "results": [
                          {
                            "order_index": 0,
                            "account": "P1",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "cirrus_tag": "01M528W5RQR83SWDQVE74F02HZ",
                            "quantity": 5,
                            "status": "accepted",
                            "order_id": "PAPER-1",
                            "message": null,
                            "order_type": "LIMIT",
                            "price": 2500,
                            "protection": "trigger",
                            "trigger_v2_id": "01M528W5RT4849ZV0QXFC6WPDD",
                            "instrument_token": "CT:TEST:RELIANCE",
                            "order_tag": "01M528W5RQR83SWDQVE74F02HZ"
                          }
                        ],
                        "accepted": 1,
                        "rejected": 0,
                        "unknown": 0
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "Placed in one account",
                    "value": {
                      "status": "success",
                      "data": {
                        "results": [
                          {
                            "order_index": 0,
                            "account": "P1",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "cirrus_tag": "01M3PGPRZFZXEQM0KEC0DB653H",
                            "quantity": 1,
                            "status": "accepted",
                            "order_id": "PAPER-1",
                            "message": null,
                            "order_type": "LIMIT",
                            "price": 2500,
                            "instrument_token": "CT:TEST:RELIANCE",
                            "order_tag": "01M3PGPRZFZXEQM0KEC0DB653H"
                          }
                        ],
                        "accepted": 1,
                        "rejected": 0,
                        "unknown": 0
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`, `idempotency_key_required` or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed; or the MCP connection's limits (trading, accounts, paper only, order value, orders a day) refuse it. Nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` names the input, e.g. `orders[0].price`, or `orders[0].quantity` when it is less than one lot; units that are not whole lots are rounded down) or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_quantity": {
                    "summary": "A zero quantity is refused; nothing is placed",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "quantity must be greater than 0",
                        "field": "orders[0].quantity"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: market data or accounts are temporarily unavailable; nothing was placed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v1/orders/{order_id}": {
      "get": {
        "tags": [
          "orders"
        ],
        "summary": "One order",
        "description": "One order from today's order book, in the same shape as a `GET /v1/portfolio/orders` row (`OrderData`, with instrument details and live prices when known). `order_id` is the broker's order id (as `PATCH` / `DELETE` on this path take it) or the order's `order_tag` (known before the broker acknowledges), or the `client_tag` it was placed with. Searches every linked account, or only `account`.\n\nAn id that names more than one order (a `client_tag` given to several orders or accounts, or the same broker order id in two accounts) is answered with 409 `ambiguous_order` listing the accounts; send `account` to pick one.\n\nA cover / bracket entry placed through `POST /v1/orders` may be accepted with a null `order_id` (the broker's reply did not name the entry); look it up by its `order_tag` here once the order book has it.",
        "operationId": "get_order",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "description": "Broker order id, `order_tag` or `client_tag` (1-64 letters, digits, `-`, `_`, `.` or `:`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Only this account's book; every linked account when absent.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_OrderData"
                },
                "examples": {
                  "success": {
                    "summary": "Found by its client_tag",
                    "value": {
                      "status": "success",
                      "data": {
                        "cirrus_tag": "01M3PGPRYMRRAPV8MCBEA19MS1",
                        "broker_tag": null,
                        "order_id": "250929000101",
                        "parent_tag": null,
                        "username": "user-01M3PGPRXSNM34C3C6AM1B721X",
                        "account": "P1",
                        "broker": "paper",
                        "cirrus_token": "CT:TEST:RELIANCE",
                        "tradingsymbol": "RELIANCE-EQ",
                        "side": "BUY",
                        "order_type": "LIMIT",
                        "product": "MIS",
                        "quantity": 5,
                        "price": 2500,
                        "trigger_price": null,
                        "state": "OPEN",
                        "filled_qty": 0,
                        "average_price": null,
                        "status_message": null,
                        "broker_updated_at": null,
                        "created_at": "2026-09-29T12:02:21.780809Z",
                        "status_history": [],
                        "client_tag": "strat-7:entry",
                        "lot_size": 1,
                        "exchange": "NSE",
                        "instrument_type": "EQUITY",
                        "symbol": "RELIANCE",
                        "expiry": "",
                        "strike": 0,
                        "option_type": "",
                        "ltp": 2500,
                        "prev_close": 2490,
                        "instrument_token": "CT:TEST:RELIANCE",
                        "order_tag": "01M3PGPRYMRRAPV8MCBEA19MS1"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: unknown query parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`order_not_found` (not in today's book of the caller's accounts) or `account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "order_not_found": {
                    "summary": "Not in today's order book",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "order_not_found",
                        "message": "No order with this id in today's order book",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`ambiguous_order`: the id names orders in several accounts, or several orders (`message` lists the accounts); add `account`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "ambiguous_order": {
                    "summary": "One broker id in two accounts: add `account`",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "ambiguous_order",
                        "message": "This id names 2 orders (accounts: P1, P2); add account= to pick one, or use the order_tag",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `order_id`): not a valid id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or order data are temporarily unavailable; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "delete": {
        "tags": [
          "orders"
        ],
        "summary": "Cancel an order",
        "description": "Cancels an open order in one account. Once the request is valid the answer is 200 with the broker's verdict in `status`.\n\nA bracket / cover entry is cancelled together with its legs. Once the entry has (partly) filled, its legs are the position's live stop-loss / target, so such a cancel is refused with 409 `position_protected` unless `legs=true` is sent; then the legs are cancelled, the answer carries a `warning` (the position is unprotected) and the activity log records the protection as removed. An entry that has not filled is cancelled as before.",
        "operationId": "cancel_order",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "description": "Broker order id, `order_tag` or `client_tag`, as `GET /v1/orders/{order_id}` takes it (1-64 letters, digits, `-`, `_`, `.` or `:`). A tag is sent to the broker as the order's broker id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Account id the order is in.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "instrument_token",
            "in": "query",
            "description": "Instrument id of the order.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-deprecated-aliases": {
              "cirrus_token": "instrument_token"
            }
          },
          {
            "name": "quantity",
            "in": "query",
            "description": "Units still open (some brokers need it to cancel); 0 or absent\notherwise.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "legs",
            "in": "query",
            "description": "For a bracket / cover entry that has (partly) filled: `true` also\ncancels its live stop-loss / target legs, leaving the position\nunprotected. Without it such a cancel is refused (409\n`position_protected`).",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The broker's answer.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AmendResult"
                },
                "examples": {
                  "broker_refused": {
                    "summary": "The broker refused: its reason is in `message`",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "P1",
                        "order_id": "PAPER-7",
                        "status": "rejected",
                        "message": "Order already completed",
                        "reason": "broker_rejected"
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "The broker cancelled the order",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "P1",
                        "order_id": "PAPER-8",
                        "status": "accepted",
                        "message": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: a parameter is missing or not valid. Or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_account": {
                    "summary": "`account` is required",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_query",
                        "message": "invalid query string: missing field `account`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, or an MCP connection's limits refuse it: trading off (read-only), or an account it may not act on (unlisted; a real one when paper only). Never valued or counted against the day; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`position_protected`: a (partly) filled bracket / cover entry; cancelling it would cancel its live stop-loss / target legs. Send `legs=true` to do so anyway, or exit the position. `order_not_open`: the order is already filled, cancelled or rejected; nothing was sent. Or `request_in_progress`: an earlier request with this Idempotency-Key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: bad `order_id` (also an `order_tag` / `client_tag` not in the account's order book, not yet acknowledged by the broker, or naming several orders: nothing was sent) or unknown instrument. Or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts, market or order data are temporarily unavailable; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      },
      "patch": {
        "tags": [
          "orders"
        ],
        "summary": "Modify an order",
        "description": "Changes an open order in one account: send the order as it should be now (same validation and market protection as placement). Once the request is valid the answer is 200 with the broker's verdict in `status`; request-level problems are 4xx and change nothing. `quantity` must be greater than what has already filled.\n\nSend an `Idempotency-Key` to make retries safe: a repeat with the same key gets the first answer back (`Idempotent-Replayed: true`) instead of modifying again.",
        "operationId": "modify_order",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "description": "Broker order id, `order_tag` or `client_tag`, as `GET /v1/orders/{order_id}` takes it (1-64 letters, digits, `-`, `_`, `.` or `:`). A tag is sent to the broker as the order's broker id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per modify request (1-128 printable characters).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModifyOrderRequest"
              },
              "examples": {
                "success": {
                  "summary": "The broker accepted the change",
                  "value": {
                    "account": "P1",
                    "instrument_token": "CT:TEST:RELIANCE",
                    "side": "BUY",
                    "order_type": "SL",
                    "product": "MIS",
                    "quantity": 5,
                    "price": 2500,
                    "trigger_price": 2499
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The broker's answer.",
            "headers": {
              "Idempotency-Key": {
                "schema": {
                  "type": "string"
                },
                "description": "The request's `Idempotency-Key`, echoed (when one was sent)."
              },
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AmendResult"
                },
                "examples": {
                  "success": {
                    "summary": "The broker accepted the change",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "P1",
                        "order_id": "PAPER-9",
                        "status": "accepted",
                        "message": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json` or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed; or the MCP connection's limits (trading, accounts, paper only, order value, orders a day) refuse it. Nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "No linked account with this id",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account not found for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`order_not_open`: the order is already filled, cancelled or rejected; nothing was sent. `request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` names the input, e.g. `price`, `quantity` (also when it is not greater than the filled quantity), `order_id`: also an `order_tag` / `client_tag` not in the account's order book, not yet acknowledged by the broker, or naming several orders: nothing was sent, `instrument_token`) or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "price_off_tick": {
                    "summary": "A price off the tick grid is refused; nothing is sent",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "price 2500.03 is not a multiple of tick size 0.05",
                        "field": "price"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts, market or order data are temporarily unavailable; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v1/orders/{order_id}/protection": {
      "get": {
        "tags": [
          "orders"
        ],
        "summary": "An order's protection",
        "description": "The stop-loss / target an order placed with `protection` on `POST /v1/orders` is protected by: `status` (`none`, `waiting_for_fill`, `armed`), where it lives (`route`), the rules asked for and the triggers holding it, each with the path to open it (`version` `v2`: `/v2/triggers/{trigger_id}`, `v1`: `/v1/triggers/{trigger_id}`). The order is found as `GET /v1/orders/{order_id}` finds it (broker id, `order_tag` or `client_tag`, today's book). Protection records are kept 36 hours after the order; an older or unprotected order answers `none`.",
        "operationId": "get_order_protection",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "description": "Broker order id, `order_tag` or `client_tag`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Only this account's book; every linked account when absent.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The order's protection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_OrderProtection"
                },
                "examples": {
                  "armed": {
                    "summary": "Protected by a v2 bracket after the fill",
                    "value": {
                      "status": "success",
                      "data": {
                        "cirrus_tag": "01JAC9X2K7QF0000000000PR01",
                        "account": "P1",
                        "status": "armed",
                        "route": "trigger",
                        "rules": {
                          "stop_loss": {
                            "type": "points",
                            "value": 20
                          },
                          "target": {
                            "type": "points",
                            "value": 40
                          },
                          "trail": null
                        },
                        "broker_id": null,
                        "triggers": [
                          {
                            "trigger_id": "01JAC9X2K7QF0000000000TRG1",
                            "version": "v2",
                            "quantity": 5,
                            "entry_price": 2499.5
                          }
                        ],
                        "order_tag": "01JAC9X2K7QF0000000000PR01"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: unknown query parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`order_not_found` or `account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "order_not_found": {
                    "summary": "Not in today's order book",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "order_not_found",
                        "message": "No order with this id in today's order book",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`ambiguous_order`: add `account`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `order_id`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/margins/orders": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Calculate order margins",
        "description": "The margin each order would need in each account, for the same body as `POST /v1/orders` (sized and priced as it would be placed), and per account. Nothing is placed and no `Idempotency-Key` is needed. Results without a figure carry a `message` instead; the other accounts still get theirs.\n\nBroker limits: Pocketful, 5paisa, Motilal Oswal, Tradejini, XTS and ODIN accounts have no margin calculation (`error_code` `not_supported_by_broker`). Their results, and results whose broker did not answer, carry an estimate from the exchanges' published risk files instead (`source` `estimate`; the broker may charge more), or no figure when the instrument is not in those files.\n\n`accounts` has one total per account that has a result: the sum of its results, less the estimated hedge benefit when its orders hedge each other (never below the hedged estimate); null when any of its results has no figure.",
        "operationId": "calculate_order_margins",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlaceOrdersRequest"
              },
              "examples": {
                "success": {
                  "summary": "One account with the broker's figure, one estimated (its broker cannot calculate margins)",
                  "value": {
                    "orders": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "order_type": "LIMIT",
                        "product": "MIS",
                        "quantity": 10,
                        "price": 2500,
                        "accounts": [
                          "P2",
                          "PF1"
                        ]
                      }
                    ],
                    "use_multiplier": true
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "One result per order and account, one total per account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_OrderMarginResponse"
                },
                "examples": {
                  "success": {
                    "summary": "One account with the broker's figure, one estimated (its broker cannot calculate margins)",
                    "value": {
                      "status": "success",
                      "data": {
                        "results": [
                          {
                            "order_index": 0,
                            "account": "PF1",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "quantity": 10,
                            "total_required": 5250,
                            "message": "Margin calculation is not available for pocketful accounts.",
                            "error_code": "not_supported_by_broker",
                            "source": "estimate",
                            "stale": false,
                            "flags": [],
                            "instrument_token": "CT:TEST:RELIANCE"
                          },
                          {
                            "order_index": 0,
                            "account": "P2",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "quantity": 20,
                            "total_required": 50000,
                            "message": null,
                            "error_code": null,
                            "source": "broker",
                            "stale": false,
                            "flags": [],
                            "instrument_token": "CT:TEST:RELIANCE"
                          }
                        ],
                        "accounts": [
                          {
                            "account": "PF1",
                            "total_required": 5250,
                            "source": "estimate",
                            "stale": false,
                            "flags": [],
                            "message": null
                          },
                          {
                            "account": "P2",
                            "total_required": 50000,
                            "source": "broker",
                            "stale": false,
                            "flags": [],
                            "message": null
                          }
                        ],
                        "total_required": 55250
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "description": "`invalid_request` (`field` names the input, e.g. `orders[0].quantity`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "no_accounts": {
                    "summary": "An order needs at least one account",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "at least one account is required",
                        "field": "orders[0].accounts"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: market data or accounts are temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/orders/bracket": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Place a bracket or cover order",
        "description": "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. Once the request is valid the answer is 200 with the broker's verdict in `status`; request-level problems are 4xx and place nothing.\n\nRepeat a request with the same `Idempotency-Key` to get the first answer back (`Idempotent-Replayed: true`) instead of placing again.",
        "operationId": "place_bracket_order",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "A new UUID per order request (1-128 printable characters).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BracketRequest"
              },
              "examples": {
                "success": {
                  "summary": "Bracket order accepted",
                  "value": {
                    "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
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The broker's answer.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_BracketResult"
                },
                "examples": {
                  "success": {
                    "summary": "Bracket order accepted",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "PF1",
                        "basket_id": "777",
                        "order_id": null,
                        "status": "accepted",
                        "message": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`idempotency_key_required`, `invalid_idempotency_key` or `malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "idempotency_key_required": {
                    "summary": "The Idempotency-Key header is required",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "idempotency_key_required",
                        "message": "Idempotency-Key header is required (use a new UUID per order request)",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed; or the MCP connection's limits (trading, accounts, paper only, order value, orders a day) refuse it. Nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` names the input, e.g. `stop_loss`, `target`, `price`, `quantity`) or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_target": {
                    "summary": "A bracket order (BO) needs a target",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "a bracket order (BO) needs a target",
                        "field": "target"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or market data (the LTP a market entry is checked against) are temporarily unavailable; nothing was placed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v1/orders/bracket/{order_id}": {
      "delete": {
        "tags": [
          "orders"
        ],
        "summary": "Cancel a bracket or cover order",
        "description": "Cancels a bracket / cover order (entry and legs) in one account. Once the request is valid the answer is 200 with the broker's verdict in `status`.",
        "operationId": "cancel_bracket_order",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "description": "Broker order id, `order_tag` or `client_tag` of the entry, as `GET /v1/orders/{order_id}` takes it (1-64 letters, digits, `-`, `_`, `.` or `:`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Account id the order is in.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "`BO` or `CO`.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "`BO` (bracket: entry + stop-loss + target) or `CO` (cover: entry +\nstop-loss).",
              "enum": [
                "BO",
                "CO"
              ]
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The broker's answer.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_BracketResult"
                },
                "examples": {
                  "success": {
                    "summary": "Entry and legs cancelled",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "PF1",
                        "basket_id": null,
                        "order_id": "250929000001",
                        "status": "accepted",
                        "message": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: a parameter is missing or not valid. Or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, or an MCP connection's limits refuse it: trading off (read-only), or an account it may not act on (unlisted; a real one when paper only). Never valued or counted against the day; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "No linked account with this id",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account not found for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this Idempotency-Key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: bad `order_id` (also an `order_tag` / `client_tag` not in the account's order book, not yet acknowledged by the broker, or naming several orders: nothing was sent). Or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or order data are temporarily unavailable; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      },
      "patch": {
        "tags": [
          "orders"
        ],
        "summary": "Modify a bracket or cover order",
        "description": "Changes the entry price or quantity, or the legs, of a bracket / cover order in one account. Once the request is valid the answer is 200 with the broker's verdict in `status`.",
        "operationId": "modify_bracket_order",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "description": "Broker order id, `order_tag` or `client_tag` of the entry, as `GET /v1/orders/{order_id}` takes it (1-64 letters, digits, `-`, `_`, `.` or `:`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModifyBracketRequest"
              },
              "examples": {
                "success": {
                  "summary": "Both legs of a bracket order moved",
                  "value": {
                    "account": "PF1",
                    "instrument_token": "CT:TEST:RELIANCE",
                    "kind": "BO",
                    "side": "BUY",
                    "entry_price": 2500,
                    "stop_loss": 2460,
                    "target": 2620
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The broker's answer.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_BracketResult"
                },
                "examples": {
                  "success": {
                    "summary": "Both legs of a bracket order moved",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "PF1",
                        "basket_id": null,
                        "order_id": "250929000001",
                        "status": "accepted",
                        "message": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`. Or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed; or the MCP connection's limits (trading, accounts, paper only, order value, orders a day) refuse it. Nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this Idempotency-Key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `order_id` (also an `order_tag` / `client_tag` not in the account's order book, not yet acknowledged by the broker, or naming several orders: nothing was sent), `stop_loss`, `target`, `instrument_token`). Or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "cover_has_no_target": {
                    "summary": "A cover order (CO) has no target",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "a cover order (CO) has no target",
                        "field": "target"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts, market or order data are temporarily unavailable; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v1/positions/convert": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Convert a position",
        "description": "Moves an open position in one account to another product (e.g. `MIS` to `CARRYFORWARD`). Once the request is valid the answer is 200 with the broker's verdict in `status`.",
        "operationId": "convert_position",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertRequest"
              },
              "examples": {
                "not_available": {
                  "summary": "The account's broker cannot convert positions",
                  "value": {
                    "account": "P1",
                    "instrument_token": "CT:TEST:RELIANCE",
                    "side": "BUY",
                    "quantity": 5,
                    "from": "MIS",
                    "to": "DELIVERY"
                  }
                },
                "success": {
                  "summary": "Moved from MIS to DELIVERY",
                  "value": {
                    "account": "PF1",
                    "instrument_token": "CT:TEST:RELIANCE",
                    "side": "BUY",
                    "quantity": 5,
                    "from": "MIS",
                    "to": "DELIVERY"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The broker's answer.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_ConvertResult"
                },
                "examples": {
                  "not_available": {
                    "summary": "The account's broker cannot convert positions",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "P1",
                        "status": "rejected",
                        "message": "Position conversion is not available for paper accounts."
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "Moved from MIS to DELIVERY",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "PF1",
                        "status": "accepted",
                        "message": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json` or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed; or the MCP connection's limits (trading, accounts, paper only; order value for `MIS` to an overnight product) refuse it. Nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `quantity`, `to`, `instrument_token`) or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "same_product": {
                    "summary": "`to` must differ from `from`",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "`to` must differ from `from`",
                        "field": "to"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or market data are temporarily unavailable; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v1/positions/exit": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Exit a position",
        "description": "Closes the net position in `instrument_token` / `product` of one account at market. The position is read from the broker at the time of the request (not the snapshot); exit orders already working on it (open orders on the exit side) are subtracted, and what is left must be whole lots (otherwise 422 `partial_lot_position`, reporting the remainder). An opposite-side MARKET order for that quantity is placed like `POST /v1/orders` (split above the freeze quantity, with market protection).\n\nOnly once the exit is accepted is the position's protection removed: server-side stop-loss / target triggers, and broker-held protection (GTT, bracket / cover legs) cancelled at the broker, on this account, instrument and product only (an intraday exit never touches carry-forward protection). If the exit is refused, nothing else changes and the answer carries the refusal in `results`. Protection that could not be removed after an accepted exit is listed in `protection_errors`: it may still fire, so remove it by hand.\n\nA broker stop order protecting the position (`kind` `stop_order`) is settled first: an untriggered one is cancelled and read back final, so the exit covers what the broker still holds (it is put back as a server-side trigger if the exit does not go out). One that already went off is waited for (about 3 s): once it filled, only what is left is exited; still working, nothing is placed on top of it (503).\n\nMarket protection (on unless `market_protection` is `false`) prices the exit as a LIMIT a small band past the order book level that covers the whole exit quantity (the bids for a SELL, the asks for a BUY, walked from the best down), else past the best bid / ask, else the last traded price. When the visible depth does not cover the quantity, the deepest level is used and the rest rests at the limit. An exit trusts a book up to five protection bands from the last price (an entry: two), so a thin book does not keep the position open. A stale last trade does not block the exit while the book is live (09:15-15:40 IST, ticked today, levels with a positive price and quantity): it is priced from the book. With no live price and no live book (e.g. the market is closed) it is a LIMIT protected from the last price held, however old. With no price at all, or with the book level further than five bands, the exit is refused (`reason: stale_quote`; the message says which) rather than sent as a raw MARKET: place a LIMIT order instead. On an illiquid contract the protected LIMIT can rest unfilled; check `results` and the order book.\n\nAn `Idempotency-Key` is required: a retry with the same key answers with the first result instead of exiting twice.",
        "operationId": "exit_position",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "A new UUID per exit (1-128 printable characters).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExitRequest"
              },
              "examples": {
                "success": {
                  "summary": "Exited at market",
                  "value": {
                    "account": "P1",
                    "instrument_token": "CT:TEST:RELIANCE",
                    "product": "MIS"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The exit order ran; one result per slice.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_ExitResult"
                },
                "examples": {
                  "success": {
                    "summary": "Exited at market",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "P1",
                        "cirrus_token": "CT:TEST:RELIANCE",
                        "product": "MIS",
                        "net_qty": 5,
                        "working_exit_qty": 0,
                        "exit_qty": 5,
                        "side": "SELL",
                        "cancelled_triggers": [],
                        "cancelled_brackets": [],
                        "protection_errors": [],
                        "results": [
                          {
                            "order_index": 0,
                            "account": "P1",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "cirrus_tag": "01M3PGPRYM2737PQRY9SS63E3P",
                            "quantity": 5,
                            "status": "accepted",
                            "order_id": "PAPER-1",
                            "message": null,
                            "order_type": "LIMIT",
                            "price": 2487.5,
                            "instrument_token": "CT:TEST:RELIANCE",
                            "order_tag": "01M3PGPRYM2737PQRY9SS63E3P"
                          }
                        ],
                        "instrument_token": "CT:TEST:RELIANCE"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`, `idempotency_key_required` or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, or an MCP connection's limits refuse it: trading off (read-only), or an account it may not act on (unlisted; a real one when paper only). Never valued or counted against the day; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`already_flat`: no open position for this account, instrument and product, or exit orders already working cover it; or `request_in_progress` (same `Idempotency-Key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "already_flat": {
                    "summary": "No open position in this product",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "already_flat",
                        "message": "No open position to exit for this account, instrument and product",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`partial_lot_position`: what is left to exit is not whole lots (`message` says how much remains); `invalid_request` (`field`: `instrument_token`); or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: the broker's positions could not be read (no session, or no answer), or accounts, triggers, orders or market data are temporarily unavailable, or a broker stop order of the position went off and its exit is still in flight at the broker; nothing was placed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v1/gtt": {
      "get": {
        "tags": [
          "gtt"
        ],
        "summary": "List GTTs",
        "description": "Every GTT at the broker, per account (a live read, including GTTs made outside this API; `source` `broker`). Brokers that place GTTs but cannot list them, or whose list read failed where that read is best-effort (Pocketful, whose list reply is undocumented), are listed from this API's own records instead (`source` `api_records`): the GTTs placed through this API and not deleted here, with a `note` saying why and that GTTs placed outside it are not visible. An account whose list cannot be read carries an `error`; the others are still listed. Brokers without GTTs carry `error_code` `not_supported_by_broker`.",
        "operationId": "list_gtts",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Only this account; every account when absent.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One entry per account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AccountGtts"
                },
                "examples": {
                  "cannot_list": {
                    "summary": "The account's broker has no GTTs: `error` says so",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "account": "U1",
                          "broker": "upstox",
                          "source": "broker",
                          "gtts": [],
                          "note": null,
                          "error": "Listing GTTs is not available for upstox accounts.",
                          "error_code": "not_supported_by_broker"
                        }
                      ],
                      "error": null
                    }
                  },
                  "from_broker": {
                    "summary": "Read at the broker (Pocketful), including GTTs placed outside this API",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "account": "PF1",
                          "broker": "pocketful",
                          "source": "broker",
                          "gtts": [
                            {
                              "trigger_id": "0f6c1a52-4d7e-4b8e-9d51-2c7a9e3b1f20",
                              "status": "active",
                              "cirrus_token": "CT:TEST:GTT_RELIANCE",
                              "tradingsymbol": "RELIANCE-EQ",
                              "exchange": "NSE",
                              "side": "SELL",
                              "product": "DELIVERY",
                              "quantity": 5,
                              "last_price": null,
                              "legs": [
                                {
                                  "trigger": 2400,
                                  "price": 2399
                                }
                              ],
                              "created_at": null,
                              "updated_at": null,
                              "expires_at": "2099-12-31",
                              "instrument_token": "CT:TEST:GTT_RELIANCE"
                            }
                          ],
                          "note": null,
                          "error": null,
                          "error_code": null
                        }
                      ],
                      "error": null
                    }
                  },
                  "from_records": {
                    "summary": "The broker's list could not be read (Pocketful): the GTTs placed through this API, from its records",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "account": "PF1",
                          "broker": "pocketful",
                          "source": "api_records",
                          "gtts": [
                            {
                              "trigger_id": "0f6c1a52-4d7e-4b8e-9d51-2c7a9e3b1f20",
                              "status": "active",
                              "cirrus_token": "CT:TEST:RELIANCE",
                              "tradingsymbol": "RELIANCE-EQ",
                              "exchange": "NSE",
                              "side": "SELL",
                              "product": "DELIVERY",
                              "quantity": 5,
                              "last_price": null,
                              "legs": [
                                {
                                  "trigger": 2400,
                                  "price": 2399
                                }
                              ],
                              "created_at": "2026-10-12 16:01:53",
                              "updated_at": "2026-10-12 16:01:53",
                              "expires_at": null,
                              "instrument_token": "CT:TEST:RELIANCE"
                            }
                          ],
                          "note": "The broker's GTT list could not be read just now, so these are the GTTs placed through this API. GTTs placed outside it (e.g. in the broker's app) are not visible here.",
                          "error": null,
                          "error_code": null
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: the query string is not valid, e.g. an unknown parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`account_not_found`: no linked account with this id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "No linked account with this id",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account NOPE not found for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts are temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "gtt"
        ],
        "summary": "Create a GTT",
        "description": "Creates a GTT at the broker in one account: a stop-loss, a target, or both (whichever fires first cancels the other). Legs are checked against the tick grid and the live price. Once the request is valid the answer is 200 with the broker's verdict in `status`.\n\nBroker limits: Pocketful has no GTT on BFO (and CDS) or on intraday (`MIS`) products. These, and brokers without GTT at all, come back as `rejected` with `error_code` `not_supported_by_broker` (nothing was sent to the broker).",
        "operationId": "create_gtt",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GttRequest"
              },
              "examples": {
                "success": {
                  "summary": "Stop-loss GTT created at the broker",
                  "value": {
                    "account": "PF1",
                    "instrument_token": "CT:TEST:RELIANCE",
                    "side": "SELL",
                    "product": "DELIVERY",
                    "quantity": 5,
                    "stop_loss": {
                      "trigger": 2400,
                      "price": 2399
                    }
                  }
                },
                "two_leg_not_supported": {
                  "summary": "Pocketful takes no stop-loss + target GTT: refused before any broker call",
                  "value": {
                    "account": "PF1",
                    "instrument_token": "CT:TEST:RELIANCE",
                    "side": "SELL",
                    "product": "DELIVERY",
                    "quantity": 5,
                    "stop_loss": {
                      "trigger": 2400,
                      "price": 2399
                    },
                    "target": {
                      "trigger": 2600
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The broker's answer.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_GttResult"
                },
                "examples": {
                  "success": {
                    "summary": "Stop-loss GTT created at the broker",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "PF1",
                        "trigger_id": "0f6c1a52-4d7e-4b8e-9d51-2c7a9e3b1f20",
                        "status": "accepted",
                        "message": null,
                        "error_code": null
                      },
                      "error": null
                    }
                  },
                  "two_leg_not_supported": {
                    "summary": "Pocketful takes no stop-loss + target GTT: refused before any broker call",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "PF1",
                        "trigger_id": null,
                        "status": "rejected",
                        "message": "stop-loss + target (OCO) GTT is not available for pocketful accounts.",
                        "error_code": "not_supported_by_broker"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json` or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed; or the MCP connection's limits (trading, accounts, paper only, order value, orders a day) refuse it. Nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `stop_loss`, `target`, `quantity`, `instrument_token`) or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "legs_on_wrong_side": {
                    "summary": "A SELL's stop-loss must sit below LTP and its target above",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "for a Sell GTT the stop-loss and target must sit on opposite sides of LTP 2500 (stop-loss below, target above)",
                        "field": "stop_loss"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or the live price are temporarily unavailable; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v1/gtt/{trigger_id}": {
      "delete": {
        "tags": [
          "gtt"
        ],
        "summary": "Delete a GTT",
        "description": "Deletes a GTT at the broker. Once the request is valid the answer is 200 with the broker's verdict in `status`.",
        "operationId": "delete_gtt",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The broker's GTT id (1-64 letters, digits, `-`, `_`, `.` or `:`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Account id the GTT is in.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The broker's answer.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_GttResult"
                },
                "examples": {
                  "success": {
                    "summary": "Deleted at the broker",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "PF1",
                        "trigger_id": "0f6c1a52-4d7e-4b8e-9d51-2c7a9e3b1f20",
                        "status": "accepted",
                        "message": null,
                        "error_code": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: `account` is missing or the query string is not valid. Or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, or an MCP connection's limits refuse it: trading off (read-only), or an account it may not act on (unlisted; a real one when paper only). Never valued or counted against the day; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "No linked account with this id",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account not found for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this Idempotency-Key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: bad `trigger_id`. Or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts are temporarily unavailable; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      },
      "patch": {
        "tags": [
          "gtt"
        ],
        "summary": "Modify a GTT",
        "description": "Replaces a GTT's legs and quantity at the broker: send the GTT as it should be now (same body and checks as creating). Once the request is valid the answer is 200 with the broker's verdict in `status`.",
        "operationId": "modify_gtt",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The broker's GTT id (1-64 letters, digits, `-`, `_`, `.` or `:`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GttRequest"
              },
              "examples": {
                "success": {
                  "summary": "Stop-loss moved",
                  "value": {
                    "account": "PF1",
                    "instrument_token": "CT:TEST:RELIANCE",
                    "side": "SELL",
                    "product": "DELIVERY",
                    "quantity": 5,
                    "stop_loss": {
                      "trigger": 2420,
                      "price": 2419
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The broker's answer.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_GttResult"
                },
                "examples": {
                  "success": {
                    "summary": "Stop-loss moved",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "PF1",
                        "trigger_id": "0f6c1a52-4d7e-4b8e-9d51-2c7a9e3b1f20",
                        "status": "accepted",
                        "message": null,
                        "error_code": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json` or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed; or the MCP connection's limits (trading, accounts, paper only, order value, orders a day) refuse it. Nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `trigger_id`, `stop_loss`, `target`, `quantity`, `instrument_token`) or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_trigger_id": {
                    "summary": "The GTT id has characters an id cannot have",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "trigger_id must be 1-64 letters, digits, '-', '_', '.' or ':'",
                        "field": "trigger_id"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or the live price are temporarily unavailable; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v2/triggers": {
      "get": {
        "tags": [
          "triggers"
        ],
        "summary": "List v2 triggers",
        "description": "Every v2 trigger of the caller, newest first, with its state. Ended triggers stay listed for 8 days. `?group=` lists only the triggers created with that `group`.\n\nAlso every protection `GET /v1/triggers` lists that is held as a v1 record (made before 2026-10-28 through `/v1/triggers`, the order ticket, a signal entry or `/v2/triggers`; a broker bracket / cover placed with an entry; a `/v1/gtt` record), as a `bracket` with plain price levels: `route` `gtt`, `stop_order`, `bracket`, `cover` or `trigger`, a trailing stop-loss as `spec.stop_loss.trail.step`, a GTT stop-loss and its server-side target as one trigger (its id the GTT's record's). Its id is v1's (not a ULID); `created_via` is absent. Ended ones (7 days, as on `/v1/triggers`) show why in `state` and `reason`.",
        "operationId": "list_triggers_v2",
        "parameters": [
          {
            "name": "group",
            "in": "query",
            "description": "Only the triggers created with this `group` (exact match).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The caller's v2 triggers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_TriggerV2"
                },
                "examples": {
                  "by_group": {
                    "summary": "Only the triggers of one `group`",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "trigger_id": "01M5YAYXAH85KQZNZ638FK6KJP",
                          "account": "P1",
                          "strategy": null,
                          "kind": "bracket",
                          "legs": [
                            {
                              "cirrus_token": "CT:TEST:RELIANCE",
                              "side": "BUY",
                              "quantity": 5,
                              "product": "MIS",
                              "instrument_token": "CT:TEST:RELIANCE"
                            }
                          ],
                          "spec": {
                            "entry_px": 2500,
                            "target": {
                              "when": "ltp >= entry_px * 1.02"
                            },
                            "stop_loss": {
                              "init_sl": "entry_px - 25"
                            }
                          },
                          "valid_until": null,
                          "state": "submitted",
                          "transition_seq": 0,
                          "reason": null,
                          "created_at": "2026-10-27T14:57:16.052+05:30",
                          "updated_at": "2026-10-27T14:57:16.052+05:30",
                          "protection": {
                            "stop_loss": {
                              "held_by": "server",
                              "broker_order_id": null,
                              "level": 2475,
                              "adjusted_by_server": false,
                              "status": "held_by_server",
                              "note": null
                            },
                            "target": {
                              "held_by": "server",
                              "broker_order_id": null,
                              "level": 2550,
                              "adjusted_by_server": false,
                              "status": "held_by_server",
                              "note": null
                            }
                          },
                          "created_via": "app",
                          "route": "trigger",
                          "group": "nifty-targets-01M5YAYX93NMJZRR4MSWZR69FD"
                        }
                      ],
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A bracket the engine has not reported on yet",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "trigger_id": "01M5VVFCDFABPK086FBZD11WZ5",
                          "account": "P1",
                          "strategy": null,
                          "kind": "bracket",
                          "legs": [
                            {
                              "cirrus_token": "CT:TEST:RELIANCE",
                              "side": "BUY",
                              "quantity": 5,
                              "product": "MIS",
                              "instrument_token": "CT:TEST:RELIANCE"
                            }
                          ],
                          "spec": {
                            "entry_px": 2500,
                            "target": {
                              "when": "ltp >= entry_px * 1.02"
                            },
                            "stop_loss": {
                              "init_sl": "entry_px - 25",
                              "trail": {
                                "step": "5"
                              }
                            }
                          },
                          "valid_until": null,
                          "state": "submitted",
                          "transition_seq": 0,
                          "reason": null,
                          "created_at": "2026-10-26T15:48:09.715+05:30",
                          "updated_at": "2026-10-26T15:48:09.715+05:30",
                          "protection": {
                            "stop_loss": {
                              "held_by": "server",
                              "broker_order_id": null,
                              "level": 2475,
                              "adjusted_by_server": false,
                              "status": "held_by_server",
                              "note": null
                            },
                            "target": {
                              "held_by": "server",
                              "broker_order_id": null,
                              "level": 2550,
                              "adjusted_by_server": false,
                              "status": "held_by_server",
                              "note": null
                            },
                            "trail": {
                              "held_by": "server",
                              "broker_order_id": null,
                              "level": 2475,
                              "adjusted_by_server": false,
                              "status": "held_by_server",
                              "note": null
                            }
                          },
                          "created_via": "app",
                          "route": "trigger"
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "triggers"
        ],
        "summary": "Create a v2 trigger",
        "description": "Creates a v2 trigger: an `alert`, a `bracket` (entry, target, stop-loss, trailing), a `ladder` (several targets) or a `risk_limit` (loss / profit limits on an account, the user or a strategy), with conditions on any tick field. The trigger is checked first (its conditions compile, the account is the caller's, every leg's instrument exists; `bracket` and `ladder` legs need `product`), then handed to the trigger engine: `202` with the new trigger's id, made by the server. Read it with `GET /v2/triggers/{trigger_id}`; `state` is `submitted` until the engine reports. A `bracket` protecting a position already held (`entry_px`, no `entry`) may set its stop-loss at or beyond `entry_px` to lock in profit (long: `entry_px <= init_sl <` the current price; short mirrored); a waiting bracket's stop stays on the protective side of its entry.\n\nWhere the protection lives (`route`, default `auto`): a `bracket` (or `ladder`) protecting a position already held is always a v2 trigger the server evaluates, whose plain price stop-loss also rests at the broker, broker-native first: a broker GTT for a positional product where the broker has GTTs (one never larger than the position; a broker whose GTT takes one leg holds the stop-loss, the trigger the target), a broker stop-loss order (SL) for an intraday (`MIS`) position where the broker's stop orders are proven. The broker order is placed, and read back, before the `202`, which says `route` `gtt` / `stop_order` and why in `route_reason`; the trigger watches every part and cancels the broker order before any exit it places. If the broker refuses it, the server holds the protection at once (`route` `trigger`, the broker's reason in `route_reason`); if the broker does not answer, nothing else is placed and the trigger keeps watching (`504` `broker_outcome_unknown`, naming the trigger). `route` `gtt` / `stop_order` ask for that route (refused with 422 `route` where the trigger cannot take it); `route` `trigger` keeps every part with the server.",
        "operationId": "create_trigger_v2",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of creating another trigger. A `broker_outcome_unknown` answer is kept like any other: a repeat within 24 hours gets the same 504 back and creates nothing.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTriggerV2Request"
              },
              "examples": {
                "broker_gtt": {
                  "summary": "A plain stop-loss and target on a holding: placed at the broker as a GTT (here a one-leg GTT holding the stop-loss, a server-side trigger the target)",
                  "value": {
                    "account": "PF1",
                    "kind": "bracket",
                    "legs": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "quantity": 5,
                        "product": "DELIVERY"
                      }
                    ],
                    "spec": {
                      "entry_px": 2500,
                      "stop_loss": {
                        "init_sl": "2475"
                      },
                      "target": {
                        "when": "ltp >= 2550"
                      }
                    }
                  }
                },
                "success": {
                  "summary": "A bracket on a long of 5: target +2%, stop-loss 25 below, trailing by 5",
                  "value": {
                    "account": "P1",
                    "kind": "bracket",
                    "legs": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "quantity": 5,
                        "product": "MIS"
                      }
                    ],
                    "spec": {
                      "entry_px": 2500,
                      "target": {
                        "when": "ltp >= entry_px * 1.02"
                      },
                      "stop_loss": {
                        "init_sl": "entry_px - 25",
                        "trail": {
                          "step": "5"
                        }
                      }
                    }
                  }
                },
                "with_group": {
                  "summary": "A trigger of a set, labelled with `group`",
                  "value": {
                    "account": "P1",
                    "kind": "bracket",
                    "legs": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "quantity": 5,
                        "product": "MIS"
                      }
                    ],
                    "spec": {
                      "entry_px": 2500,
                      "target": {
                        "when": "ltp >= entry_px * 1.02"
                      },
                      "stop_loss": {
                        "init_sl": "entry_px - 25"
                      }
                    },
                    "route": "trigger",
                    "group": "nifty-targets-01M5YAYX93NMJZRR4MSWZR69FD"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Accepted.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2Accepted"
                },
                "examples": {
                  "broker_gtt": {
                    "summary": "A plain stop-loss and target on a holding: placed at the broker as a GTT (here a one-leg GTT holding the stop-loss, a server-side trigger the target)",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M61186WVMVS2FEVEY51B7H76",
                        "command_id": "01M61186WXQ1K6HPS3HD7CJNAE",
                        "status": "accepted",
                        "route": "gtt",
                        "route_reason": "broker GTT holds the stop-loss, a server-side trigger the target (one-leg GTT broker)"
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A bracket on a long of 5: target +2%, stop-loss 25 below, trailing by 5",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M65Q5EWB0KC0D6ZG7PT7QVB3",
                        "command_id": "01M65Q5EWKP63YC0162BADKHRE",
                        "status": "accepted",
                        "route": "stop_order",
                        "route_reason": "broker stop-loss order holds the stop-loss, a server-side trigger the target"
                      },
                      "error": null
                    }
                  },
                  "with_group": {
                    "summary": "A trigger of a set, labelled with `group`",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M5YAYXAH85KQZNZ638FK6KJP",
                        "command_id": "01M5YAYXAN76K7W5EPJQP5WZSH",
                        "status": "accepted",
                        "route": "trigger",
                        "route_reason": "trigger requested"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json` (including any unknown field, such as an `id`) or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "client_id": {
                    "summary": "Ids are made by the server: a request carrying one is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `id`, expected one of `account`, `kind`, `strategy`, `legs`, `spec`, `valid_until`, `watch`, `route`, `group`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user, or an MCP connection's limits (trading, accounts, paper only, order value, orders a day; for a trigger without legs, what it acts on: a `risk_limit` at `level` `user` acts on every account and needs every account listed and paper only off) refuse it; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "An account that is not the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account not found for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: the spec or a condition does not compile, a leg is missing `product`, an unknown instrument, or a strategy-level `risk_limit` (not supported yet), or (`field` `spec.entry`) a `bracket` with `entry` while automatic entries are on but not enabled for this user, or (`field` `spec.stop_loss.init_sl`) a `bracket` protecting a held position (`entry_px`) whose stop-loss locks in profit (at or beyond `entry_px`) but is already at or past the current price, or has no current price to check it against, or (`field` `route`) a route this trigger cannot use, or (`field` `rules`) a broker-held level already crossed at the current price; `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_condition": {
                    "summary": "A condition that does not compile is refused before anything is sent",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "target.when: condition ends too early (at byte 17)",
                        "field": "spec"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: the trigger engine did not take the command; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "engine_unavailable": {
                    "summary": "The trigger engine did not take the command; nothing was created",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Triggers are temporarily unavailable; nothing was changed. Retry shortly",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "`broker_outcome_unknown`: the broker did not confirm a GTT / stop order; it may or may not hold it. Nothing else was created; check the account's GTTs or orders before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "triggers"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "triggers"
      }
    },
    "/v2/triggers/{trigger_id}": {
      "get": {
        "tags": [
          "triggers"
        ],
        "summary": "One v2 trigger",
        "description": "One v2 trigger of the caller. Another user's id is not found. A live protection held as a v1 record (see `GET /v2/triggers`) is read by its v1 id (either half of a GTT stop-loss and its server-side target).",
        "operationId": "get_trigger_v2",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The trigger's id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2"
                },
                "examples": {
                  "broker_gtt": {
                    "summary": "Protection held by a broker GTT (stop-loss) and the server (target)",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M61186WVMVS2FEVEY51B7H76",
                        "account": "PF1",
                        "strategy": null,
                        "kind": "bracket",
                        "legs": [
                          {
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "side": "BUY",
                            "quantity": 5,
                            "product": "DELIVERY",
                            "instrument_token": "CT:TEST:RELIANCE"
                          }
                        ],
                        "spec": {
                          "entry_px": 2500,
                          "stop_loss": {
                            "init_sl": "2475"
                          },
                          "target": {
                            "when": "ltp >= 2550"
                          }
                        },
                        "valid_until": null,
                        "state": "submitted",
                        "transition_seq": 0,
                        "reason": null,
                        "created_at": "2026-10-28T16:05:18.300+05:30",
                        "updated_at": "2026-10-28T16:05:18.300+05:30",
                        "protection": {
                          "stop_loss": {
                            "held_by": "broker",
                            "broker_order_id": "pf-gtt-1",
                            "level": 2475,
                            "adjusted_by_server": false,
                            "status": "unknown",
                            "note": "not read back as asked yet"
                          },
                          "target": {
                            "held_by": "server",
                            "broker_order_id": null,
                            "level": 2550,
                            "adjusted_by_server": false,
                            "status": "held_by_server",
                            "note": null
                          }
                        },
                        "created_via": "app",
                        "route": "gtt",
                        "route_reason": "broker GTT holds the stop-loss, a server-side trigger the target (one-leg GTT broker)"
                      },
                      "error": null
                    }
                  },
                  "entered": {
                    "summary": "A bracket whose entry the server placed and saw filled",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M5VVFCDF1Y25EXH1VBER1MEB",
                        "account": "P1",
                        "strategy": null,
                        "kind": "bracket",
                        "legs": [
                          {
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "side": "BUY",
                            "quantity": 5,
                            "product": "MIS",
                            "instrument_token": "CT:TEST:RELIANCE"
                          }
                        ],
                        "spec": {
                          "entry_px": 2500,
                          "target": {
                            "when": "ltp >= entry_px * 1.02"
                          },
                          "stop_loss": {
                            "init_sl": "entry_px - 25",
                            "trail": {
                              "step": "5"
                            }
                          }
                        },
                        "valid_until": null,
                        "state": "active",
                        "transition_seq": 1,
                        "reason": null,
                        "created_at": "2026-10-26T15:48:09.714+05:30",
                        "updated_at": "2026-10-26T15:48:09.719+05:30",
                        "protection": {
                          "stop_loss": {
                            "held_by": "server",
                            "broker_order_id": null,
                            "level": 2475,
                            "adjusted_by_server": false,
                            "status": "held_by_server",
                            "note": null
                          },
                          "target": {
                            "held_by": "server",
                            "broker_order_id": null,
                            "level": 2550,
                            "adjusted_by_server": false,
                            "status": "held_by_server",
                            "note": null
                          },
                          "trail": {
                            "held_by": "server",
                            "broker_order_id": null,
                            "level": 2475,
                            "adjusted_by_server": false,
                            "status": "held_by_server",
                            "note": null
                          }
                        },
                        "entry": {
                          "status": "filled",
                          "filled_qty": 5,
                          "avg_price": 2500.5,
                          "order_ids": [
                            "240101000001"
                          ],
                          "reason": null
                        },
                        "created_via": "app",
                        "route": "trigger"
                      },
                      "error": null
                    }
                  },
                  "risk_progress": {
                    "summary": "A risk limit after its first target: which targets fired and the profit trail",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M5YAR0RQTAEZWW84P44J9YP2",
                        "account": "P1",
                        "strategy": null,
                        "kind": "risk_limit",
                        "legs": [],
                        "spec": {
                          "level": "account",
                          "mtm_floor": -5000,
                          "profit_trail": {
                            "arm_at": 3000,
                            "step": 1000
                          },
                          "targets": [
                            {
                              "mtm": 4000,
                              "action": "book_pct",
                              "pct": 50
                            },
                            {
                              "mtm": 8000,
                              "action": "flatten"
                            }
                          ]
                        },
                        "valid_until": null,
                        "state": "armed",
                        "transition_seq": 2,
                        "reason": "target 1 of 2 reached: mtm 4200 at or above 4000",
                        "created_at": "2026-10-27T14:53:30.200+05:30",
                        "updated_at": "2026-10-27T14:53:30.202+05:30",
                        "protection": null,
                        "risk_progress": {
                          "targets": 2,
                          "targets_fired": 1,
                          "trail_armed": true,
                          "trail_peak": 4200,
                          "trail_floor": 3200
                        }
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "An active bracket after one change by the engine",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M5VVFCDF60NDFJ5SMKG675R2",
                        "account": "P1",
                        "strategy": null,
                        "kind": "bracket",
                        "legs": [
                          {
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "side": "BUY",
                            "quantity": 5,
                            "product": "MIS",
                            "instrument_token": "CT:TEST:RELIANCE"
                          }
                        ],
                        "spec": {
                          "entry_px": 2500,
                          "target": {
                            "when": "ltp >= entry_px * 1.02"
                          },
                          "stop_loss": {
                            "init_sl": "entry_px - 25",
                            "trail": {
                              "step": "5"
                            }
                          }
                        },
                        "valid_until": null,
                        "state": "active",
                        "transition_seq": 1,
                        "reason": null,
                        "created_at": "2026-10-26T15:48:09.715+05:30",
                        "updated_at": "2026-10-26T15:48:09.719+05:30",
                        "protection": {
                          "stop_loss": {
                            "held_by": "server",
                            "broker_order_id": null,
                            "level": 2480,
                            "adjusted_by_server": false,
                            "status": "held_by_server",
                            "note": null
                          },
                          "target": {
                            "held_by": "server",
                            "broker_order_id": null,
                            "level": 2550,
                            "adjusted_by_server": false,
                            "status": "held_by_server",
                            "note": null
                          },
                          "trail": {
                            "held_by": "server",
                            "broker_order_id": null,
                            "level": 2475,
                            "adjusted_by_server": false,
                            "status": "held_by_server",
                            "note": null
                          }
                        },
                        "created_via": "app",
                        "route": "trigger"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`trigger_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "An id that is not the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_not_found",
                        "message": "Trigger not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "delete": {
        "tags": [
          "triggers"
        ],
        "summary": "Cancel a v2 trigger",
        "description": "Cancels a v2 trigger. `202`: the engine ends it within moments (`state` `cancelled`); one that fires first ends as fired instead. Protection the broker holds (`route` `gtt` / `stop_order`) is cancelled at the broker first (a stop order is read back final; one that already went off is exiting and is kept: `502`, retry), then the trigger (a protection held as a v1 record, see `GET /v2/triggers`, is removed through v1's own code with its paired target): `broker_cancel` says how the broker answered. A refusal never removes it on its own: shown ended at the broker it is removed (`cancelled`), shown fired it ends as fired (`409`), otherwise it stays live with `state` `cancel_pending` (`broker_cancel` `pending`) and is re-checked until the broker shows a final state.",
        "operationId": "cancel_trigger_v2",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The trigger's id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2Accepted"
                },
                "examples": {
                  "success": {
                    "summary": "Cancel handed to the engine",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M4GF38B4NDN7T4SDYK85MKNM",
                        "command_id": "01M4GF38BK9BQ5Z9NTES6C5R31",
                        "status": "accepted"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_idempotency_key": {
                    "summary": "The Idempotency-Key is not 1-128 printable characters",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_idempotency_key",
                        "message": "Idempotency-Key must be 1-128 printable characters",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user, or an MCP connection's limits refuse it: trading off, or an account it may not act on (unlisted; a real one when paper only). A `risk_limit` at `level` `user` acts on every account and needs every account listed and paper only off. Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`trigger_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "An id that is not the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_not_found",
                        "message": "Trigger not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`trigger_fired`: the trigger already ended. Or `request_in_progress`: an earlier request with this Idempotency-Key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "ended": {
                    "summary": "The trigger already ended",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_fired",
                        "message": "This trigger already ended (cancelled)",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`idempotency_key_reused`: the Idempotency-Key was already used for another request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "The Idempotency-Key was already used for another request",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used with a different request",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "`broker_refused`: the broker did not answer the cancel of the protection it holds, or the session expired; it is kept, retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: the trigger engine did not take the command; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "engine_unavailable": {
                    "summary": "The trigger engine did not take the command; nothing was changed",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Triggers are temporarily unavailable; nothing was changed. Retry shortly",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "triggers"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "triggers"
      },
      "patch": {
        "tags": [
          "triggers"
        ],
        "summary": "Change a v2 trigger",
        "description": "Replaces a v2 trigger's spec (and optionally its expiry). The new spec is checked like on create; the engine then applies what the trigger's state allows (for example a stop-loss is never loosened, an entry cannot change once active). `202`: read the trigger to see the result. Protection the broker holds (`route` `gtt` / `stop_order`) is changed at the broker first and answered once the broker agreed: its spec must stay a plain price stop-loss / target with the same parts, and `valid_until` cannot be set. A protection held as a v1 record (see `GET /v2/triggers`) is changed through v1's own code, at the broker first where the broker holds it, with v1's rules (a bracket keeps both parts, a cover a stop-loss only): its spec stays plain price levels with the same parts, its quantity and a trailing stop-loss as shown (`422` otherwise); a trailing stop-loss is never set looser than where its trail moved it (`409` `trigger_busy`, `field` `rules`: cancel and protect again for a looser stop). `valid_until`: absent keeps the expiry, `null` removes it. `route`: the current route (or `auto`) changes nothing; another is refused (422 `route`: cancel and create the trigger again). `POST /v2/triggers/{trigger_id}/validate` checks a change without making it.",
        "operationId": "modify_trigger_v2",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The trigger's id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModifyTriggerV2Request"
              },
              "examples": {
                "remove_expiry": {
                  "summary": "`valid_until: null` removes the expiry",
                  "value": {
                    "spec": {
                      "entry_px": 2500,
                      "target": {
                        "when": "ltp >= entry_px * 1.02"
                      },
                      "stop_loss": {
                        "init_sl": "entry_px - 25"
                      }
                    },
                    "valid_until": null
                  }
                },
                "success": {
                  "summary": "A tighter stop-loss",
                  "value": {
                    "spec": {
                      "entry_px": 2500,
                      "target": {
                        "when": "ltp >= entry_px * 1.02"
                      },
                      "stop_loss": {
                        "init_sl": "entry_px - 20",
                        "trail": {
                          "step": "5"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Accepted.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2Accepted"
                },
                "examples": {
                  "remove_expiry": {
                    "summary": "`valid_until: null` removes the expiry",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M5YAYXAHWREX15A3Q3FMNGF9",
                        "command_id": "01M5YAYXAXT49C0SMG4JJACVFQ",
                        "status": "accepted"
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A tighter stop-loss",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M4GF38AQ39WVJZHH8YWWNNQZ",
                        "command_id": "01M4GF38BEE9Y3N9T9M8EHNXKX",
                        "status": "accepted"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`. Or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "client_id": {
                    "summary": "A field the change does not take (here an id) is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `id`, expected one of `spec`, `valid_until`, `route`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user, or an MCP connection's limits (trading, accounts, paper only, order value, orders a day; for a trigger without legs, what it acts on: a `risk_limit` at `level` `user` acts on every account and needs every account listed and paper only off) refuse it; nothing was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`trigger_not_found` or `account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "An id that is not the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_not_found",
                        "message": "Trigger not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`trigger_fired`: the trigger already ended; `broker_held`: broker-held protection that cannot be changed here; `trigger_busy` (`field` `rules`): a looser stop-loss than where the trail moved it (a protection held as a v1 record; nothing was sent). Or `request_in_progress`: an earlier request with this Idempotency-Key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "ended": {
                    "summary": "The trigger already ended",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_fired",
                        "message": "This trigger already ended (sl_hit)",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: the new spec does not compile, or a change broker-held protection cannot take (nothing was sent). Or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_spec": {
                    "summary": "A spec with an unknown field is refused, never read as no stop-loss",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "spec: unknown field `stop_los`, expected one of `entry`, `entry_px`, `target`, `stop_loss`",
                        "field": "spec"
                      }
                    }
                  },
                  "route_refused": {
                    "summary": "The route stays the one chosen at create",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "the route is chosen at create and stays `trigger`: moving the protection would leave the position unprotected in between; cancel the trigger and create it again with the route you want",
                        "field": "route"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "`broker_refused`: the broker refused the change of the protection it holds, or the session expired; nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: the trigger engine did not take the command; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "engine_unavailable": {
                    "summary": "The trigger engine did not take the command; nothing was changed",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Triggers are temporarily unavailable; nothing was changed. Retry shortly",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "`broker_outcome_unknown`: the broker did not answer in time; it may or may not hold the new levels. Check before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "triggers"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "triggers"
      }
    },
    "/v2/triggers/{trigger_id}/pause": {
      "post": {
        "tags": [
          "triggers"
        ],
        "summary": "Pause a v2 trigger",
        "description": "Pauses a v2 trigger: the engine stops evaluating it (`state` `paused`) until it is resumed. A paused trigger does not act on any condition, its stop-loss included; a part the broker holds stays at the broker. `202`: the engine applies it within moments; read the trigger to see the result. A protection held as a v1 record (made before 2026-10-28, or a broker bracket / cover placed with an entry) cannot be paused (`422`).",
        "operationId": "pause_trigger_v2",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The trigger's id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2Accepted"
                },
                "examples": {
                  "success": {
                    "summary": "Pause handed to the engine",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M4QNBZ1SPDJ4F3K9NA9H72SC",
                        "command_id": "01M4QNBZ21PD87BG3EHS08AN78",
                        "status": "accepted"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_idempotency_key": {
                    "summary": "The Idempotency-Key is not 1-128 printable characters",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_idempotency_key",
                        "message": "Idempotency-Key must be 1-128 printable characters",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user, or an MCP connection's limits refuse it: trading off, or an account it may not act on (unlisted; a real one when paper only). A `risk_limit` at `level` `user` acts on every account and needs every account listed and paper only off. Nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`trigger_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "An id that is not the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_not_found",
                        "message": "Trigger not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`trigger_fired`: the trigger already ended. Or `request_in_progress`: an earlier request with this Idempotency-Key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "ended": {
                    "summary": "The trigger already ended",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_fired",
                        "message": "This trigger already ended (cancelled)",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` `trigger_id`): a protection held as a v1 record cannot be paused; nothing changed. Or `idempotency_key_reused`: the Idempotency-Key was already used for another request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "v1_record": {
                    "summary": "A protection held as a v1 record has no pause",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "this protection is a v1 record (made before 2026-10-28, or a broker bracket / cover) and cannot be paused: it keeps protecting the position; change its levels or cancel it",
                        "field": "trigger_id"
                      }
                    }
                  },
                  "idempotency_key_reused": {
                    "summary": "The Idempotency-Key was already used for another request",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used with a different request",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: the trigger engine did not take the command; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "engine_unavailable": {
                    "summary": "The trigger engine did not take the command; nothing was changed",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Triggers are temporarily unavailable; nothing was changed. Retry shortly",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "triggers"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "triggers"
      }
    },
    "/v2/triggers/{trigger_id}/resume": {
      "post": {
        "tags": [
          "triggers"
        ],
        "summary": "Resume a paused v2 trigger",
        "description": "Resumes a paused v2 trigger: the engine evaluates it again from the next tick, in the state it was paused in. `202`: read the trigger to see the result (the engine refuses a resume of a trigger that is not paused). A protection held as a v1 record is never paused (`422`).",
        "operationId": "resume_trigger_v2",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The trigger's id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2Accepted"
                },
                "examples": {
                  "success": {
                    "summary": "Resume of a paused trigger handed to the engine",
                    "value": {
                      "status": "success",
                      "data": {
                        "trigger_id": "01M4QNBZ1SH6BRRRMPJ7RRSVMY",
                        "command_id": "01M4QNBZ1Z8KTB78CXT3BMKEBB",
                        "status": "accepted"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_idempotency_key": {
                    "summary": "The Idempotency-Key is not 1-128 printable characters",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_idempotency_key",
                        "message": "Idempotency-Key must be 1-128 printable characters",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user, the user may not trade, or the MCP connection's limits (trading, accounts, paper only; a `risk_limit` at `level` `user` acts on every account and needs every account listed and paper only off) refuse it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`trigger_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "An id that is not the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_not_found",
                        "message": "Trigger not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`trigger_fired`: the trigger already ended. Or `request_in_progress`: an earlier request with this Idempotency-Key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "ended": {
                    "summary": "The trigger already ended",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_fired",
                        "message": "This trigger already ended (cancelled)",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` `trigger_id`): a protection held as a v1 record is never paused; nothing changed. Or `idempotency_key_reused`: the Idempotency-Key was already used for another request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "v1_record": {
                    "summary": "A protection held as a v1 record has no pause",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "this protection is a v1 record (made before 2026-10-28, or a broker bracket / cover) and cannot be resumed: it keeps protecting the position; change its levels or cancel it",
                        "field": "trigger_id"
                      }
                    }
                  },
                  "idempotency_key_reused": {
                    "summary": "The Idempotency-Key was already used for another request",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used with a different request",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: the trigger engine did not take the command; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "engine_unavailable": {
                    "summary": "The trigger engine did not take the command; nothing was changed",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Triggers are temporarily unavailable; nothing was changed. Retry shortly",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "triggers"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "triggers"
      }
    },
    "/v2/triggers/validate": {
      "post": {
        "tags": [
          "triggers"
        ],
        "summary": "Check a v2 trigger without creating it",
        "description": "A dry run of `POST /v2/triggers` with the same body: nothing is sent to the engine, stored or counted against the account's order budget. `200` with `valid` and every reason create would refuse it (`errors`, the same `field` and `message` as create's `422`), what its conditions read (`reads`), where it stands against the limits (`limits`) and, for `bracket` / `ladder`, who would hold each part of its protection on this account and product (`protection`: the broker or the server).\n\n**Expressions** (a strict CEL subset; numbers are doubles). Variables: leg 0's tick fields `ltp`, `bid`, `ask`, `bid_qty`, `ask_qty`, `volume`, `oi`, `atp`, `open`, `high`, `low`; `prev.<field>` (previous tick); `legs[i].<field>` and `legs[i].prev.<field>`; `entry_px`, `sl_px`, `state`; `account.mtm`, `user.mtm`, `strategy.mtm`, `position.qty`; `now_ist` (minutes since midnight IST, 09:15 = 555). Functions: `crosses_above(a, b)` / `crosses_below(a, b)` (against the previous tick; a gap counts), `min`, `max`, `abs`. Operators: `|| && ! == != < <= > >= + - * /` and `c ? a : b`. Prices (`init_sl`, `trail.step`, ladder `price`) read only `entry_px` and literals. Limits: 2048 bytes and 32 levels of nesting per condition; the per-trigger limits in `limits`. Errors name the spec path and byte, e.g. `when: unknown variable `ltpp` (at byte 0)`. Full reference with examples per kind: `docs/api/trigger-expressions.md`.",
        "operationId": "validate_trigger_v2",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTriggerV2Request"
              },
              "examples": {
                "invalid_condition": {
                  "summary": "A condition that does not compile: listed with create's message",
                  "value": {
                    "account": "P1",
                    "kind": "bracket",
                    "legs": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "quantity": 5,
                        "product": "MIS"
                      }
                    ],
                    "spec": {
                      "entry_px": 2500,
                      "target": {
                        "when": "ltp >= entry_px *"
                      },
                      "stop_loss": {
                        "init_sl": "entry_px - 25"
                      }
                    }
                  }
                },
                "risk_limit_levels": {
                  "summary": "A risk limit: each level in plain English (`risk_levels`)",
                  "value": {
                    "account": "P1",
                    "kind": "risk_limit",
                    "legs": [],
                    "spec": {
                      "level": "account",
                      "mtm_floor": -5000,
                      "profit_lock": {
                        "arm_at": 4000,
                        "floor": 2000
                      }
                    }
                  }
                },
                "risk_targets_off": {
                  "summary": "Risk limit targets on a server where they are not available yet",
                  "value": {
                    "account": "P1",
                    "kind": "risk_limit",
                    "legs": [],
                    "spec": {
                      "level": "account",
                      "mtm_floor": -5000,
                      "targets": [
                        {
                          "mtm": 4000,
                          "action": "book_pct",
                          "pct": 50
                        },
                        {
                          "mtm": 8000,
                          "action": "flatten"
                        }
                      ]
                    }
                  }
                },
                "success": {
                  "summary": "A bracket that would be accepted, with what it reads and its protection plan",
                  "value": {
                    "account": "P1",
                    "kind": "bracket",
                    "legs": [
                      {
                        "instrument_token": "CT:TEST:RELIANCE",
                        "side": "BUY",
                        "quantity": 5,
                        "product": "MIS"
                      }
                    ],
                    "spec": {
                      "entry_px": 2500,
                      "target": {
                        "when": "ltp >= entry_px * 1.02"
                      },
                      "stop_loss": {
                        "init_sl": "entry_px - 25"
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The dry run's answer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2Validation"
                },
                "examples": {
                  "invalid_condition": {
                    "summary": "A condition that does not compile: listed with create's message",
                    "value": {
                      "status": "success",
                      "data": {
                        "valid": false,
                        "errors": [
                          {
                            "field": "spec",
                            "message": "target.when: condition ends too early (at byte 17)"
                          }
                        ],
                        "reads": {
                          "symbols": [],
                          "fields": [],
                          "variables": []
                        },
                        "limits": {
                          "ok": true,
                          "reason": null,
                          "legs": 1,
                          "max_legs": 8,
                          "expressions": 2,
                          "max_expressions": 32,
                          "bytes": 305,
                          "max_bytes": 16384
                        },
                        "protection": null
                      },
                      "error": null
                    }
                  },
                  "risk_limit_levels": {
                    "summary": "A risk limit: each level in plain English (`risk_levels`)",
                    "value": {
                      "status": "success",
                      "data": {
                        "valid": true,
                        "errors": [],
                        "reads": {
                          "symbols": [],
                          "fields": [],
                          "variables": [
                            "account.mtm"
                          ]
                        },
                        "limits": {
                          "ok": true,
                          "reason": null,
                          "legs": 0,
                          "max_legs": 8,
                          "expressions": 1,
                          "max_expressions": 32,
                          "bytes": 225,
                          "max_bytes": 16384
                        },
                        "protection": null,
                        "risk_levels": [
                          {
                            "field": "spec.mtm_floor",
                            "text": "When the account's MTM falls to ₹-5000 or lower, every position in the account is exited and the limit ends."
                          },
                          {
                            "field": "spec.profit_lock",
                            "text": "Once the account's MTM reaches ₹4000, the profit lock arms; if it then falls back to ₹2000, every position in the account is exited and the limit ends."
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "risk_targets_off": {
                    "summary": "Risk limit targets on a server where they are not available yet",
                    "value": {
                      "status": "success",
                      "data": {
                        "valid": false,
                        "errors": [
                          {
                            "field": "spec.targets",
                            "message": "risk limit targets and profit trails are not available yet on this server"
                          }
                        ],
                        "reads": {
                          "symbols": [],
                          "fields": [],
                          "variables": []
                        },
                        "limits": {
                          "ok": true,
                          "reason": null,
                          "legs": 0,
                          "max_legs": 8,
                          "expressions": 3,
                          "max_expressions": 32,
                          "bytes": 268,
                          "max_bytes": 16384
                        },
                        "protection": null
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A bracket that would be accepted, with what it reads and its protection plan",
                    "value": {
                      "status": "success",
                      "data": {
                        "valid": true,
                        "errors": [],
                        "reads": {
                          "symbols": [
                            "CT:TEST:RELIANCE"
                          ],
                          "fields": [
                            "ltp"
                          ],
                          "variables": [
                            "entry_px",
                            "sl_px"
                          ]
                        },
                        "limits": {
                          "ok": true,
                          "reason": null,
                          "legs": 1,
                          "max_legs": 8,
                          "expressions": 2,
                          "max_expressions": 32,
                          "bytes": 310,
                          "max_bytes": 16384
                        },
                        "protection": {
                          "parts": {
                            "stop_loss": {
                              "held_by": "server",
                              "level": 2475,
                              "adjusted_by_server": false,
                              "note": null
                            },
                            "target": {
                              "held_by": "server",
                              "level": 2550,
                              "adjusted_by_server": false,
                              "note": null
                            }
                          },
                          "reason": "the position has not been checked yet"
                        },
                        "route": "stop_order",
                        "route_reason": "broker stop-loss order holds the stop-loss, a server-side trigger the target"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "client_id": {
                    "summary": "Ids are made by the server: a request carrying one is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `id`, expected one of `account`, `kind`, `strategy`, `legs`, `spec`, `valid_until`, `watch`, `route`, `group`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "An account that is not the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account not found for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: market data unavailable; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "triggers"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "triggers"
      }
    },
    "/v2/triggers/{trigger_id}/validate": {
      "post": {
        "tags": [
          "triggers"
        ],
        "summary": "Check a change to a v2 trigger without making it",
        "description": "A dry run of `PATCH /v2/triggers/{trigger_id}` with the same body: nothing is sent to the engine or the broker. `200` with `valid` and every reason the change would be refused (`errors`, the same `field` and `message` as the change's `422`), what changes in the spec (`diff`) and the expiry the trigger would have.",
        "operationId": "validate_trigger_change_v2",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The trigger's id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModifyTriggerV2Request"
              },
              "examples": {
                "invalid_condition": {
                  "summary": "A change whose condition does not compile",
                  "value": {
                    "spec": {
                      "entry_px": 2500,
                      "target": {
                        "when": "ltp >= entry_px *"
                      },
                      "stop_loss": {
                        "init_sl": "entry_px - 20"
                      }
                    }
                  }
                },
                "success": {
                  "summary": "A change that would be accepted, with its diff",
                  "value": {
                    "spec": {
                      "entry_px": 2500,
                      "target": {
                        "when": "ltp >= entry_px * 1.02"
                      },
                      "stop_loss": {
                        "init_sl": "entry_px - 20"
                      }
                    },
                    "valid_until": null
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The dry run's answer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2ChangeValidation"
                },
                "examples": {
                  "invalid_condition": {
                    "summary": "A change whose condition does not compile",
                    "value": {
                      "status": "success",
                      "data": {
                        "valid": false,
                        "errors": [
                          {
                            "field": "spec",
                            "message": "target.when: condition ends too early (at byte 17)"
                          }
                        ],
                        "diff": [
                          {
                            "path": "stop_loss.init_sl",
                            "from": "entry_px - 25",
                            "to": "entry_px - 20"
                          },
                          {
                            "path": "target.when",
                            "from": "ltp >= entry_px * 1.02",
                            "to": "ltp >= entry_px *"
                          }
                        ],
                        "valid_until": "2026-10-27T13:27:16.003960+00:00"
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A change that would be accepted, with its diff",
                    "value": {
                      "status": "success",
                      "data": {
                        "valid": true,
                        "errors": [],
                        "diff": [
                          {
                            "path": "stop_loss.init_sl",
                            "from": "entry_px - 25",
                            "to": "entry_px - 20"
                          }
                        ],
                        "valid_until": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "malformed": {
                    "summary": "An unknown field",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `id`, expected one of `spec`, `valid_until`, `route`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`trigger_not_found` or `account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "trigger_not_found": {
                    "summary": "An id that is not one of the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_not_found",
                        "message": "Trigger not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`trigger_fired`: the trigger already ended.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "triggers"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "triggers"
      }
    },
    "/v2/triggers/capabilities": {
      "get": {
        "tags": [
          "triggers"
        ],
        "summary": "What v2 triggers can do",
        "description": "The kinds and their spec fields, the expression language (variables, functions, operators and its size limits), the limits this deployment runs with and, with `?account=`, what that account's broker can hold (order types, and each protection fact `verified` or `unverified`) and whether broker protection is on. See `docs/api/trigger-expressions.md`.",
        "operationId": "get_trigger_capabilities_v2",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "One of the caller's accounts: adds what its broker can hold.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Capabilities.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2Capabilities"
                },
                "examples": {
                  "success": {
                    "summary": "Kinds, the expression language and the limits",
                    "value": {
                      "status": "success",
                      "data": {
                        "kinds": [
                          {
                            "kind": "alert",
                            "description": "Notifies once `when` holds, then ends (`fired`).",
                            "legs": "one or more",
                            "spec_fields": [
                              {
                                "name": "when",
                                "type": "condition",
                                "required": true,
                                "description": "Tick fields of every leg, risk variables, `now_ist`."
                              },
                              {
                                "name": "on",
                                "type": "string",
                                "required": false,
                                "description": "When the condition next to it is checked: `close` (default when it reads an indicator: at each candle close, with closed values) or `tick` (every price tick, with the forming candle)."
                              },
                              {
                                "name": "hold_s",
                                "type": "number",
                                "required": false,
                                "description": "Tick mode: seconds the condition must stay true before acting (0 to 300). A bracket in tick mode waits 10 s by default and at least 5 s."
                              },
                              {
                                "name": "repeat.cooldown_bars",
                                "type": "number",
                                "required": false,
                                "description": "A repeating alert: notifies each time (the crossing must re-arm), with at least this many candles of its smallest timeframe between alerts (1 to 100, default 1). Needs a condition on candles (an indicator or `bar_close`)."
                              },
                              {
                                "name": "repeat.max_per_day",
                                "type": "number",
                                "required": false,
                                "description": "A repeating alert: at most this many alerts a day (1 to 50, default 10)."
                              }
                            ]
                          },
                          {
                            "kind": "bracket",
                            "description": "Entry (a condition, or a known `entry_px`), target, stop-loss and trailing stop on one position.",
                            "legs": "one",
                            "spec_fields": [
                              {
                                "name": "entry.when",
                                "type": "condition",
                                "required": false,
                                "description": "Waits (`pending`) until it holds; `entry_px` becomes that tick's LTP. Exclusive with `entry_px`."
                              },
                              {
                                "name": "entry.on",
                                "type": "string",
                                "required": false,
                                "description": "When the condition next to it is checked: `close` (default when it reads an indicator: at each candle close, with closed values) or `tick` (every price tick, with the forming candle)."
                              },
                              {
                                "name": "entry.hold_s",
                                "type": "number",
                                "required": false,
                                "description": "Tick mode: seconds the condition must stay true before acting (0 to 300). A bracket in tick mode waits 10 s by default and at least 5 s."
                              },
                              {
                                "name": "entry_px",
                                "type": "number",
                                "required": false,
                                "description": "The entry price of a position already held (starts `active`). Exclusive with `entry`."
                              },
                              {
                                "name": "target.when",
                                "type": "condition",
                                "required": false,
                                "description": "Exits everything when it holds (`target_hit`). Reads ticks, `entry_px`, `state`, risk variables."
                              },
                              {
                                "name": "target.on",
                                "type": "string",
                                "required": false,
                                "description": "When the condition next to it is checked: `close` (default when it reads an indicator: at each candle close, with closed values) or `tick` (every price tick, with the forming candle)."
                              },
                              {
                                "name": "target.hold_s",
                                "type": "number",
                                "required": false,
                                "description": "Tick mode: seconds the condition must stay true before acting (0 to 300). A bracket in tick mode waits 10 s by default and at least 5 s."
                              },
                              {
                                "name": "stop_loss.when",
                                "type": "condition",
                                "required": false,
                                "description": "Exits everything when it holds (`sl_hit`); default `ltp <= sl_px` (BUY) / `ltp >= sl_px` (SELL)."
                              },
                              {
                                "name": "stop_loss.on",
                                "type": "string",
                                "required": false,
                                "description": "When the condition next to it is checked: `close` (default when it reads an indicator: at each candle close, with closed values) or `tick` (every price tick, with the forming candle)."
                              },
                              {
                                "name": "stop_loss.hold_s",
                                "type": "number",
                                "required": false,
                                "description": "Tick mode: seconds the condition must stay true before acting (0 to 300). A bracket in tick mode waits 10 s by default and at least 5 s."
                              },
                              {
                                "name": "stop_loss.init_sl",
                                "type": "price",
                                "required": false,
                                "description": "The first stop level (`sl_px`); reads `entry_px` and literals, fixed at entry."
                              },
                              {
                                "name": "stop_loss.trail.step",
                                "type": "price",
                                "required": false,
                                "description": "Trailing step; reads `entry_px` and literals. The stop only tightens."
                              }
                            ]
                          },
                          {
                            "kind": "ladder",
                            "description": "Several targets on a position held at `entry_px`; each rung moves the stop-loss up.",
                            "legs": "one",
                            "spec_fields": [
                              {
                                "name": "entry_px",
                                "type": "number",
                                "required": true,
                                "description": "The position's entry price."
                              },
                              {
                                "name": "targets[].price",
                                "type": "price",
                                "required": true,
                                "description": "Rung level; reads `entry_px` and literals; strictly moving away from the entry in the profit direction."
                              },
                              {
                                "name": "targets[].qty",
                                "type": "number",
                                "required": false,
                                "description": "Units an intermediate rung exits (without it the rung only notifies); the last rung exits everything."
                              },
                              {
                                "name": "stop_loss.init_sl",
                                "type": "price",
                                "required": false,
                                "description": "The first stop level; reads `entry_px` and literals."
                              },
                              {
                                "name": "stop_loss.trail.step",
                                "type": "price",
                                "required": false,
                                "description": "Trailing step while no rung is hit."
                              }
                            ]
                          },
                          {
                            "kind": "risk_limit",
                            "description": "Loss / profit limits on the account or the user (strategy level is not supported yet): a loss floor, a fixed or trailing profit floor, and profit targets that notify, book part of every position or exit everything.",
                            "legs": "none",
                            "spec_fields": [
                              {
                                "name": "level",
                                "type": "string",
                                "required": true,
                                "description": "`account` or `user`."
                              },
                              {
                                "name": "mtm_floor",
                                "type": "number",
                                "required": false,
                                "description": "Breaches when MTM is at or below it."
                              },
                              {
                                "name": "profit_lock.arm_at",
                                "type": "number",
                                "required": false,
                                "description": "Arms once MTM reaches it."
                              },
                              {
                                "name": "profit_lock.floor",
                                "type": "number",
                                "required": false,
                                "description": "Once armed, breaches when MTM falls to it."
                              },
                              {
                                "name": "profit_trail.arm_at",
                                "type": "number",
                                "required": false,
                                "description": "A trailing profit floor: arms once MTM reaches it (above 0). Exclusive with `profit_lock`. Needs `risk_targets_enabled`."
                              },
                              {
                                "name": "profit_trail.step",
                                "type": "number",
                                "required": false,
                                "description": "Once armed, the floor is the peak MTM minus this many rupees (above 0, below `arm_at`); it only ever rises, and MTM at or below it does `on_breach`. Exactly one of `step` or `pct`."
                              },
                              {
                                "name": "profit_trail.pct",
                                "type": "number",
                                "required": false,
                                "description": "Once armed, the floor is the peak MTM less this percent of it (above 0, below 100); it only ever rises. Exactly one of `step` or `pct`."
                              },
                              {
                                "name": "targets[].mtm",
                                "type": "number",
                                "required": false,
                                "description": "A profit target: fires once MTM is at or above it (above 0). Levels strictly increase; each fires once, in order (the trigger's `risk_progress.targets_fired`). At most 10. Needs `risk_targets_enabled`."
                              },
                              {
                                "name": "targets[].action",
                                "type": "string",
                                "required": false,
                                "description": "`notify` (only notifies), `book_pct` (exits `pct`% of every open position in the scope, each rounded down to its lot size; a position under one lot is skipped and reported) or `flatten` (exits everything and ends the limit, reason `target`; must be the last target). The loss floor still applies after a booking."
                              },
                              {
                                "name": "targets[].pct",
                                "type": "number",
                                "required": false,
                                "description": "`book_pct` only: the share of each position to exit, 1 to 100."
                              },
                              {
                                "name": "when",
                                "type": "condition",
                                "required": false,
                                "description": "Breaches when it holds; reads risk variables and `now_ist`."
                              },
                              {
                                "name": "on_breach",
                                "type": "string",
                                "required": false,
                                "description": "`flatten` (default), `pause` or `notify`: what a breach of the loss floor, the profit lock, the profit trail or `when` does."
                              }
                            ]
                          }
                        ],
                        "expressions": {
                          "variables": [
                            {
                              "name": "ltp",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "bid",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "ask",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "bid_qty",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "ask_qty",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "volume",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "oi",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "atp",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "open",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "high",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "low",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "prev.ltp",
                              "description": "Any tick field of leg 0 on the previous tick (`prev.bid`, ...)."
                            },
                            {
                              "name": "legs[i].ltp",
                              "description": "Any tick field of leg i (`legs[1].bid`, `legs[1].prev.oi`)."
                            },
                            {
                              "name": "entry_px",
                              "description": "The entry price (bracket, ladder)."
                            },
                            {
                              "name": "sl_px",
                              "description": "The current stop-loss level (bracket stop condition)."
                            },
                            {
                              "name": "state",
                              "description": "The trigger's state name, a string (bracket target / stop)."
                            },
                            {
                              "name": "account.mtm",
                              "description": "The account's mark-to-market."
                            },
                            {
                              "name": "user.mtm",
                              "description": "The user's mark-to-market across accounts."
                            },
                            {
                              "name": "strategy.mtm",
                              "description": "The strategy's mark-to-market (triggers with a strategy)."
                            },
                            {
                              "name": "position.qty",
                              "description": "Net quantity held in leg 0's instrument on the account."
                            },
                            {
                              "name": "now_ist",
                              "description": "Minutes since midnight IST (09:15 is 555)."
                            }
                          ],
                          "functions": [
                            {
                              "name": "crosses_above",
                              "description": "crosses_above(a, b[, band]): a was at or below b on the previous tick and is above it now. Over an indicator, or with a dead band `band` (a number 0 or more), it fires once per real crossing: values inside b ± band keep the last side, and the first side seen only arms. Tick mode on a bracket defaults the band to 1 point (RSI, Stochastic) or 0.05 % of the level (prices)."
                            },
                            {
                              "name": "crosses_below",
                              "description": "crosses_below(a, b[, band]): a was at or above b on the previous tick and is below it now; `band` as for crosses_above."
                            },
                            {
                              "name": "min",
                              "description": "min(a, b, ...): the smallest number."
                            },
                            {
                              "name": "max",
                              "description": "max(a, b, ...): the largest number."
                            },
                            {
                              "name": "abs",
                              "description": "abs(a): the absolute value."
                            }
                          ],
                          "operators": [
                            "||",
                            "&&",
                            "!",
                            "==",
                            "!=",
                            "<",
                            "<=",
                            ">",
                            ">=",
                            "+",
                            "-",
                            "*",
                            "/",
                            "? :"
                          ],
                          "max_source_bytes": 2048,
                          "max_depth": 32,
                          "max_nodes": 256
                        },
                        "limits": {
                          "max_triggers": 500,
                          "max_legs": 8,
                          "max_expressions": 32,
                          "max_symbols": 100,
                          "max_trigger_bytes": 16384,
                          "max_rungs": 20
                        },
                        "entries_enabled": false,
                        "risk_targets_enabled": false,
                        "products": [
                          {
                            "segment": "equity",
                            "exchanges": [
                              "NSE",
                              "BSE"
                            ],
                            "products": [
                              "MIS",
                              "DELIVERY",
                              "MTF"
                            ]
                          },
                          {
                            "segment": "derivatives",
                            "exchanges": [
                              "NFO",
                              "BFO",
                              "MCX",
                              "CDS",
                              "BCD",
                              "NCDEX"
                            ],
                            "products": [
                              "MIS",
                              "CARRYFORWARD"
                            ]
                          }
                        ],
                        "account": null
                      },
                      "error": null
                    }
                  },
                  "with_account": {
                    "summary": "Also what the account's broker can hold",
                    "value": {
                      "status": "success",
                      "data": {
                        "kinds": [
                          {
                            "kind": "alert",
                            "description": "Notifies once `when` holds, then ends (`fired`).",
                            "legs": "one or more",
                            "spec_fields": [
                              {
                                "name": "when",
                                "type": "condition",
                                "required": true,
                                "description": "Tick fields of every leg, risk variables, `now_ist`."
                              },
                              {
                                "name": "on",
                                "type": "string",
                                "required": false,
                                "description": "When the condition next to it is checked: `close` (default when it reads an indicator: at each candle close, with closed values) or `tick` (every price tick, with the forming candle)."
                              },
                              {
                                "name": "hold_s",
                                "type": "number",
                                "required": false,
                                "description": "Tick mode: seconds the condition must stay true before acting (0 to 300). A bracket in tick mode waits 10 s by default and at least 5 s."
                              },
                              {
                                "name": "repeat.cooldown_bars",
                                "type": "number",
                                "required": false,
                                "description": "A repeating alert: notifies each time (the crossing must re-arm), with at least this many candles of its smallest timeframe between alerts (1 to 100, default 1). Needs a condition on candles (an indicator or `bar_close`)."
                              },
                              {
                                "name": "repeat.max_per_day",
                                "type": "number",
                                "required": false,
                                "description": "A repeating alert: at most this many alerts a day (1 to 50, default 10)."
                              }
                            ]
                          },
                          {
                            "kind": "bracket",
                            "description": "Entry (a condition, or a known `entry_px`), target, stop-loss and trailing stop on one position.",
                            "legs": "one",
                            "spec_fields": [
                              {
                                "name": "entry.when",
                                "type": "condition",
                                "required": false,
                                "description": "Waits (`pending`) until it holds; `entry_px` becomes that tick's LTP. Exclusive with `entry_px`."
                              },
                              {
                                "name": "entry.on",
                                "type": "string",
                                "required": false,
                                "description": "When the condition next to it is checked: `close` (default when it reads an indicator: at each candle close, with closed values) or `tick` (every price tick, with the forming candle)."
                              },
                              {
                                "name": "entry.hold_s",
                                "type": "number",
                                "required": false,
                                "description": "Tick mode: seconds the condition must stay true before acting (0 to 300). A bracket in tick mode waits 10 s by default and at least 5 s."
                              },
                              {
                                "name": "entry_px",
                                "type": "number",
                                "required": false,
                                "description": "The entry price of a position already held (starts `active`). Exclusive with `entry`."
                              },
                              {
                                "name": "target.when",
                                "type": "condition",
                                "required": false,
                                "description": "Exits everything when it holds (`target_hit`). Reads ticks, `entry_px`, `state`, risk variables."
                              },
                              {
                                "name": "target.on",
                                "type": "string",
                                "required": false,
                                "description": "When the condition next to it is checked: `close` (default when it reads an indicator: at each candle close, with closed values) or `tick` (every price tick, with the forming candle)."
                              },
                              {
                                "name": "target.hold_s",
                                "type": "number",
                                "required": false,
                                "description": "Tick mode: seconds the condition must stay true before acting (0 to 300). A bracket in tick mode waits 10 s by default and at least 5 s."
                              },
                              {
                                "name": "stop_loss.when",
                                "type": "condition",
                                "required": false,
                                "description": "Exits everything when it holds (`sl_hit`); default `ltp <= sl_px` (BUY) / `ltp >= sl_px` (SELL)."
                              },
                              {
                                "name": "stop_loss.on",
                                "type": "string",
                                "required": false,
                                "description": "When the condition next to it is checked: `close` (default when it reads an indicator: at each candle close, with closed values) or `tick` (every price tick, with the forming candle)."
                              },
                              {
                                "name": "stop_loss.hold_s",
                                "type": "number",
                                "required": false,
                                "description": "Tick mode: seconds the condition must stay true before acting (0 to 300). A bracket in tick mode waits 10 s by default and at least 5 s."
                              },
                              {
                                "name": "stop_loss.init_sl",
                                "type": "price",
                                "required": false,
                                "description": "The first stop level (`sl_px`); reads `entry_px` and literals, fixed at entry."
                              },
                              {
                                "name": "stop_loss.trail.step",
                                "type": "price",
                                "required": false,
                                "description": "Trailing step; reads `entry_px` and literals. The stop only tightens."
                              }
                            ]
                          },
                          {
                            "kind": "ladder",
                            "description": "Several targets on a position held at `entry_px`; each rung moves the stop-loss up.",
                            "legs": "one",
                            "spec_fields": [
                              {
                                "name": "entry_px",
                                "type": "number",
                                "required": true,
                                "description": "The position's entry price."
                              },
                              {
                                "name": "targets[].price",
                                "type": "price",
                                "required": true,
                                "description": "Rung level; reads `entry_px` and literals; strictly moving away from the entry in the profit direction."
                              },
                              {
                                "name": "targets[].qty",
                                "type": "number",
                                "required": false,
                                "description": "Units an intermediate rung exits (without it the rung only notifies); the last rung exits everything."
                              },
                              {
                                "name": "stop_loss.init_sl",
                                "type": "price",
                                "required": false,
                                "description": "The first stop level; reads `entry_px` and literals."
                              },
                              {
                                "name": "stop_loss.trail.step",
                                "type": "price",
                                "required": false,
                                "description": "Trailing step while no rung is hit."
                              }
                            ]
                          },
                          {
                            "kind": "risk_limit",
                            "description": "Loss / profit limits on the account or the user (strategy level is not supported yet): a loss floor, a fixed or trailing profit floor, and profit targets that notify, book part of every position or exit everything.",
                            "legs": "none",
                            "spec_fields": [
                              {
                                "name": "level",
                                "type": "string",
                                "required": true,
                                "description": "`account` or `user`."
                              },
                              {
                                "name": "mtm_floor",
                                "type": "number",
                                "required": false,
                                "description": "Breaches when MTM is at or below it."
                              },
                              {
                                "name": "profit_lock.arm_at",
                                "type": "number",
                                "required": false,
                                "description": "Arms once MTM reaches it."
                              },
                              {
                                "name": "profit_lock.floor",
                                "type": "number",
                                "required": false,
                                "description": "Once armed, breaches when MTM falls to it."
                              },
                              {
                                "name": "profit_trail.arm_at",
                                "type": "number",
                                "required": false,
                                "description": "A trailing profit floor: arms once MTM reaches it (above 0). Exclusive with `profit_lock`. Needs `risk_targets_enabled`."
                              },
                              {
                                "name": "profit_trail.step",
                                "type": "number",
                                "required": false,
                                "description": "Once armed, the floor is the peak MTM minus this many rupees (above 0, below `arm_at`); it only ever rises, and MTM at or below it does `on_breach`. Exactly one of `step` or `pct`."
                              },
                              {
                                "name": "profit_trail.pct",
                                "type": "number",
                                "required": false,
                                "description": "Once armed, the floor is the peak MTM less this percent of it (above 0, below 100); it only ever rises. Exactly one of `step` or `pct`."
                              },
                              {
                                "name": "targets[].mtm",
                                "type": "number",
                                "required": false,
                                "description": "A profit target: fires once MTM is at or above it (above 0). Levels strictly increase; each fires once, in order (the trigger's `risk_progress.targets_fired`). At most 10. Needs `risk_targets_enabled`."
                              },
                              {
                                "name": "targets[].action",
                                "type": "string",
                                "required": false,
                                "description": "`notify` (only notifies), `book_pct` (exits `pct`% of every open position in the scope, each rounded down to its lot size; a position under one lot is skipped and reported) or `flatten` (exits everything and ends the limit, reason `target`; must be the last target). The loss floor still applies after a booking."
                              },
                              {
                                "name": "targets[].pct",
                                "type": "number",
                                "required": false,
                                "description": "`book_pct` only: the share of each position to exit, 1 to 100."
                              },
                              {
                                "name": "when",
                                "type": "condition",
                                "required": false,
                                "description": "Breaches when it holds; reads risk variables and `now_ist`."
                              },
                              {
                                "name": "on_breach",
                                "type": "string",
                                "required": false,
                                "description": "`flatten` (default), `pause` or `notify`: what a breach of the loss floor, the profit lock, the profit trail or `when` does."
                              }
                            ]
                          }
                        ],
                        "expressions": {
                          "variables": [
                            {
                              "name": "ltp",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "bid",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "ask",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "bid_qty",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "ask_qty",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "volume",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "oi",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "atp",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "open",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "high",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "low",
                              "description": "Leg 0's tick field; `prev.<field>` the previous tick's, `legs[i].<field>` leg i's."
                            },
                            {
                              "name": "prev.ltp",
                              "description": "Any tick field of leg 0 on the previous tick (`prev.bid`, ...)."
                            },
                            {
                              "name": "legs[i].ltp",
                              "description": "Any tick field of leg i (`legs[1].bid`, `legs[1].prev.oi`)."
                            },
                            {
                              "name": "entry_px",
                              "description": "The entry price (bracket, ladder)."
                            },
                            {
                              "name": "sl_px",
                              "description": "The current stop-loss level (bracket stop condition)."
                            },
                            {
                              "name": "state",
                              "description": "The trigger's state name, a string (bracket target / stop)."
                            },
                            {
                              "name": "account.mtm",
                              "description": "The account's mark-to-market."
                            },
                            {
                              "name": "user.mtm",
                              "description": "The user's mark-to-market across accounts."
                            },
                            {
                              "name": "strategy.mtm",
                              "description": "The strategy's mark-to-market (triggers with a strategy)."
                            },
                            {
                              "name": "position.qty",
                              "description": "Net quantity held in leg 0's instrument on the account."
                            },
                            {
                              "name": "now_ist",
                              "description": "Minutes since midnight IST (09:15 is 555)."
                            }
                          ],
                          "functions": [
                            {
                              "name": "crosses_above",
                              "description": "crosses_above(a, b[, band]): a was at or below b on the previous tick and is above it now. Over an indicator, or with a dead band `band` (a number 0 or more), it fires once per real crossing: values inside b ± band keep the last side, and the first side seen only arms. Tick mode on a bracket defaults the band to 1 point (RSI, Stochastic) or 0.05 % of the level (prices)."
                            },
                            {
                              "name": "crosses_below",
                              "description": "crosses_below(a, b[, band]): a was at or above b on the previous tick and is below it now; `band` as for crosses_above."
                            },
                            {
                              "name": "min",
                              "description": "min(a, b, ...): the smallest number."
                            },
                            {
                              "name": "max",
                              "description": "max(a, b, ...): the largest number."
                            },
                            {
                              "name": "abs",
                              "description": "abs(a): the absolute value."
                            }
                          ],
                          "operators": [
                            "||",
                            "&&",
                            "!",
                            "==",
                            "!=",
                            "<",
                            "<=",
                            ">",
                            ">=",
                            "+",
                            "-",
                            "*",
                            "/",
                            "? :"
                          ],
                          "max_source_bytes": 2048,
                          "max_depth": 32,
                          "max_nodes": 256
                        },
                        "limits": {
                          "max_triggers": 500,
                          "max_legs": 8,
                          "max_expressions": 32,
                          "max_symbols": 100,
                          "max_trigger_bytes": 16384,
                          "max_rungs": 20
                        },
                        "entries_enabled": false,
                        "risk_targets_enabled": false,
                        "products": [
                          {
                            "segment": "equity",
                            "exchanges": [
                              "NSE",
                              "BSE"
                            ],
                            "products": [
                              "MIS",
                              "DELIVERY",
                              "MTF"
                            ]
                          },
                          {
                            "segment": "derivatives",
                            "exchanges": [
                              "NFO",
                              "BFO",
                              "MCX",
                              "CDS",
                              "BCD",
                              "NCDEX"
                            ],
                            "products": [
                              "MIS",
                              "CARRYFORWARD"
                            ]
                          }
                        ],
                        "account": {
                          "account": "Z1",
                          "broker_protection_enabled": false,
                          "holds": {
                            "bracket": false,
                            "cover": false,
                            "gtt": true,
                            "gtt_two_leg": true
                          },
                          "facts": {
                            "gtt_modify": {
                              "status": "unverified",
                              "value": null
                            },
                            "leg_identity": {
                              "status": "unverified",
                              "value": null
                            },
                            "leg_modify": {
                              "status": "unverified",
                              "value": null
                            },
                            "leg_units": {
                              "status": "unverified",
                              "value": null
                            },
                            "modify_limit": {
                              "status": "unverified",
                              "value": null
                            },
                            "modify_qty_basis": {
                              "status": "unverified",
                              "value": null
                            },
                            "native_trail": {
                              "status": "unverified",
                              "value": null
                            },
                            "qty_unit": {
                              "status": "unverified",
                              "value": null
                            },
                            "stop_type_after_modify": {
                              "status": "unverified",
                              "value": null
                            },
                            "stop_type_after_trigger": {
                              "status": "unverified",
                              "value": null
                            },
                            "trigger_price_after_modify": {
                              "status": "unverified",
                              "value": null
                            }
                          }
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "An account that is not the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account not found for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/triggers/{trigger_id}/journey": {
      "get": {
        "tags": [
          "triggers"
        ],
        "summary": "A v2 trigger's journey",
        "description": "Everything that happened to one of the caller's v2 triggers, newest first: what was asked (`api`: created, modified with the spec diff, paused, resumed, cancelled, with who asked), what the engine did and why (`engine`: each transition with the condition that decided it and the values it read, e.g. `ltp=2479.5, sl_px=2480 in `ltp <= sl_px``; notes such as an input not known), commands it refused (`result`), exit orders (`exit`) and the broker protection (`protection`). Kept for 90 days by default, also after the trigger ended. Another user's trigger is not found.",
        "operationId": "get_trigger_journey_v2",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The trigger's id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Entries per page, 1 to 200 (default 50).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` of the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source",
            "in": "query",
            "description": "Only entries from `api`, `engine`, `result`, `exit` or `protection`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2Journey"
                },
                "examples": {
                  "success": {
                    "summary": "Created in the app, then the engine trailed the stop-loss",
                    "value": {
                      "status": "success",
                      "data": {
                        "entries": [
                          {
                            "entry_id": "evt:01M4QRFDBAQC442FN7H0ATGR3A:1",
                            "at": "2026-10-12T15:23:05.396+05:30",
                            "seq": 1,
                            "source": "engine",
                            "kind": "transition",
                            "summary": "active -> active",
                            "actor": null,
                            "details": {
                              "from": "active",
                              "to": "active",
                              "actions": [
                                {
                                  "type": "move_sl",
                                  "legs": [
                                    0
                                  ],
                                  "price": 2480
                                }
                              ],
                              "tick": {
                                "symbol": "CT:TEST:RELIANCE",
                                "ltp": 2551
                              },
                              "reason": null,
                              "explain": null
                            }
                          },
                          {
                            "entry_id": "api:01M4QRFDBBMKYVDBYQ05TTGVX2",
                            "at": "2026-10-12T15:23:05.386+05:30",
                            "seq": 0,
                            "source": "api",
                            "kind": "created",
                            "summary": "created in the app (command 01M4QRFDBBMKYVDBYQ05TTGVX2)",
                            "actor": {
                              "user": "user-01M4QRFD9EACA9SER6K3EHY0BQ",
                              "credential": "app"
                            },
                            "details": {
                              "kind": "bracket",
                              "legs": [
                                {
                                  "symbol": "CT:TEST:RELIANCE",
                                  "side": "BUY",
                                  "qty": 5,
                                  "product": "MIS"
                                }
                              ],
                              "spec": {
                                "entry_px": 2500,
                                "target": {
                                  "when": "ltp >= entry_px * 1.02"
                                },
                                "stop_loss": {
                                  "init_sl": "entry_px - 25"
                                }
                              },
                              "valid_until": null
                            }
                          }
                        ],
                        "next_cursor": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: a bad `limit`, `cursor` or `source`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_query": {
                    "summary": "A page size outside 1 to 200",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_query",
                        "message": "limit must be 1 to 200",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_enabled": {
                    "summary": "v2 triggers are not enabled for this user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Triggers v2 are not enabled for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`trigger_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "An id that is not the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "trigger_not_found",
                        "message": "Trigger not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/triggers/{trigger_id}/indicators": {
      "get": {
        "tags": [
          "triggers"
        ],
        "summary": "A v2 trigger's indicator values now",
        "description": "Each indicator a trigger's conditions read, as the engine holds it now: the last closed candle's value, the forming candle's, its warm-up status, how far it is from the condition's level and a tick-mode hold in progress. Read from the engine's memory (nothing is computed or stored for it); poll every 2 s while a page shows it. `status` `unavailable` when the engine did not answer within 500 ms. At most one request per second per trigger.",
        "operationId": "get_trigger_indicators_v2",
        "parameters": [
          {
            "name": "trigger_id",
            "in": "path",
            "description": "The trigger's id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TriggerV2IndicatorValues"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: v2 triggers are not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`trigger_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/portfolio/{kind}": {
      "get": {
        "tags": [
          "portfolio"
        ],
        "summary": "Order book, positions, holdings, trades or funds",
        "description": "One kind of data for every linked account (or only `account`), from the live per-account snapshots: no broker call on the read path. Each account with data is under `accounts` (a tracked account with no orders today has an empty `orders` list), each without under `missing` with a `code` (`no_session`: no active broker session; `not_supported`: broker not supported yet; `stale`: the only data is from an earlier broker session, read before today's 04:00 IST, so it is not shown) and the reason. The shape of each `data` depends on `kind`: `orders` (today's order book, newest first): a list of `OrderData`; `positions`: a list of `PositionRow`; `holdings`: a list of `HoldingRow`; `trades` (today's fills): a list of `TradeRow`; `margins`: one `MarginRow` object. Rows carry instrument details and live prices when known.",
        "operationId": "get_portfolio",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "description": "Which data: `orders`, `positions`, `holdings`, `trades` or `margins`.",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/SnapshotKind"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Only this linked account (its id).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per-account data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_PortfolioResponse"
                },
                "examples": {
                  "holdings": {
                    "summary": "Holdings of one account",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "P1",
                            "updated_at": "2026-09-29T12:02:21.872057Z",
                            "data": [
                              {
                                "account": "P1",
                                "cirrus_token": "CT:TEST:RELIANCE",
                                "tradingsymbol": "RELIANCE-EQ",
                                "product": "DELIVERY",
                                "quantity": 10,
                                "average_price": 2400,
                                "invested_amount": 24000,
                                "pnl": 1000,
                                "pnl_percent": 4.17,
                                "lot_size": 1,
                                "exchange": "NSE",
                                "instrument_type": "EQUITY",
                                "symbol": "RELIANCE",
                                "expiry": "",
                                "strike": 0,
                                "option_type": "",
                                "ltp": 2500,
                                "prev_close": 2490,
                                "instrument_token": "CT:TEST:RELIANCE"
                              }
                            ]
                          }
                        ],
                        "missing": []
                      },
                      "error": null
                    }
                  },
                  "margins": {
                    "summary": "Funds of one account (one object)",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "P1",
                            "updated_at": "2026-09-29T12:02:21.873473Z",
                            "data": {
                              "account": "P1",
                              "opening_balance": 100000,
                              "available": 90000.8,
                              "utilised": 9999.2
                            }
                          }
                        ],
                        "missing": []
                      },
                      "error": null
                    }
                  },
                  "orders": {
                    "summary": "Today's order book of one account",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "P1",
                            "updated_at": "2026-09-29T12:02:21.873796Z",
                            "data": [
                              {
                                "cirrus_tag": "01M3PGPS1H2ZQB73V1CP2ARKM4",
                                "broker_tag": "a1b2c3",
                                "order_id": "240927000012345",
                                "parent_tag": null,
                                "username": "user-01M3PGPS0BTN9PZC9GTZ5JP0V5",
                                "account": "P1",
                                "broker": "paper",
                                "cirrus_token": "CT:TEST:RELIANCE",
                                "tradingsymbol": "RELIANCE-EQ",
                                "side": "BUY",
                                "order_type": "LIMIT",
                                "product": "DELIVERY",
                                "quantity": 1,
                                "price": 2500,
                                "trigger_price": null,
                                "state": "OPEN",
                                "filled_qty": 0,
                                "average_price": null,
                                "status_message": null,
                                "broker_updated_at": "2026-09-29T12:02:21.873796Z",
                                "created_at": "2026-09-29T12:02:21.873796Z",
                                "status_history": [
                                  {
                                    "from": "SUBMITTED",
                                    "to": "OPEN",
                                    "at": "2026-09-29T12:02:21.873796Z",
                                    "message": null
                                  }
                                ],
                                "lot_size": 1,
                                "exchange": "NSE",
                                "instrument_type": "EQUITY",
                                "symbol": "RELIANCE",
                                "expiry": "",
                                "strike": 0,
                                "option_type": "",
                                "ltp": 2500,
                                "prev_close": 2490,
                                "instrument_token": "CT:TEST:RELIANCE",
                                "order_tag": "01M3PGPS1H2ZQB73V1CP2ARKM4"
                              }
                            ]
                          }
                        ],
                        "missing": []
                      },
                      "error": null
                    }
                  },
                  "positions": {
                    "summary": "Open positions of one account",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "P1",
                            "updated_at": "2026-09-29T12:02:21.869612Z",
                            "data": [
                              {
                                "account": "P1",
                                "cirrus_token": "CT:TEST:RELIANCE",
                                "tradingsymbol": "RELIANCE-EQ",
                                "product": "MIS",
                                "net_qty": 4,
                                "buy_qty": 4,
                                "sell_qty": 0,
                                "buy_value": 9999.2,
                                "sell_value": 0,
                                "average_price": 2499.8,
                                "buy_average_price": 2499.8,
                                "sell_average_price": 0,
                                "pnl": 0.8,
                                "lot_size": 1,
                                "exchange": "NSE",
                                "instrument_type": "EQUITY",
                                "symbol": "RELIANCE",
                                "expiry": "",
                                "strike": 0,
                                "option_type": "",
                                "ltp": 2500,
                                "prev_close": 2490,
                                "instrument_token": "CT:TEST:RELIANCE"
                              }
                            ]
                          }
                        ],
                        "missing": []
                      },
                      "error": null
                    }
                  },
                  "stale_account": {
                    "summary": "Data from an earlier broker session is not shown: missing as stale",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [],
                        "missing": [
                          {
                            "account": "P2",
                            "code": "stale",
                            "reason": "No data since 29 Sep 19:20 IST: log in to the broker"
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "trades": {
                    "summary": "Today's fills of one account",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "P1",
                            "updated_at": "2026-09-29T12:02:21.872897Z",
                            "data": [
                              {
                                "account": "P1",
                                "order_id": "240927000012345",
                                "cirrus_token": "CT:TEST:RELIANCE",
                                "tradingsymbol": "RELIANCE-EQ",
                                "side": "BUY",
                                "quantity": 4,
                                "fill_price": 2499.8,
                                "trade_value": 9999.2,
                                "filled_at": "2026-09-29T12:02:21.869597Z",
                                "lot_size": 1,
                                "exchange": "NSE",
                                "instrument_type": "EQUITY",
                                "symbol": "RELIANCE",
                                "expiry": "",
                                "strike": 0,
                                "option_type": "",
                                "ltp": 2500,
                                "prev_close": 2490,
                                "instrument_token": "CT:TEST:RELIANCE"
                              }
                            ]
                          }
                        ],
                        "missing": []
                      },
                      "error": null
                    }
                  },
                  "with_missing_accounts": {
                    "summary": "Every account: those without data are listed under missing",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "P1",
                            "updated_at": "2026-09-29T12:02:21.873473Z",
                            "data": {
                              "account": "P1",
                              "opening_balance": 100000,
                              "available": 90000.8,
                              "utilised": 9999.2
                            }
                          }
                        ],
                        "missing": [
                          {
                            "account": "P2",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          },
                          {
                            "account": "Z1",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          },
                          {
                            "account": "PF1",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          },
                          {
                            "account": "U1",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          },
                          {
                            "account": "5P1",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          },
                          {
                            "account": "MO1",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          },
                          {
                            "account": "TJ1",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: the query string does not parse (e.g. an unknown parameter).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`account_not_found`: `account` is not one of the caller's linked accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "The account is not one of the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account not found for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `kind`): unknown kind (checked only when the caller has at least one account).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_kind": {
                    "summary": "An unknown kind is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "kind must be one of orders, positions, holdings, trades, margins",
                        "field": "kind"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or snapshots are temporarily unavailable; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/portfolio/refresh": {
      "post": {
        "tags": [
          "portfolio"
        ],
        "summary": "Re-read positions, holdings and funds",
        "description": "Asks the live workers of every linked account (or only `account`) to re-read positions, holdings, trades and funds from the broker now. Returns at once (202); the new data reaches `GET /v1/portfolio/{kind}` and the stream within seconds. Recorded in the activity log.",
        "operationId": "refresh_portfolio",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Only this linked account (its id).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Refresh requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_PortfolioRefresh"
                },
                "examples": {
                  "success": {
                    "summary": "One account asked to re-read",
                    "value": {
                      "status": "success",
                      "data": {
                        "requested": 1
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: the query string does not parse (e.g. an unknown parameter).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`account_not_found`: `account` is not one of the caller's linked accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "The account is not one of the caller's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account not found for this user",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: the refresh could not be requested (or accounts could not be loaded); retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/strategies": {
      "get": {
        "tags": [
          "strategies"
        ],
        "summary": "Your strategies today",
        "description": "Positions and P&L of each strategy across every linked account, for today (IST trading day). A strategy is the `strategy` an order was placed with (on `POST /v1/orders` or by a v2 trigger); everything else is `Unassigned` (`name` null). Per account: each instrument and product with net quantity, average price, realized P&L and unrealized P&L at our latest price (`ltp_stale` when that price is not current). `recon` says whether the strategy's open positions add up to the broker's. Accounts with no ledger yet today are under `missing` (`available` is false while none has one): not an error.",
        "operationId": "get_strategies",
        "responses": {
          "200": {
            "description": "The strategies.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_StrategiesView"
                },
                "examples": {
                  "not_available_yet": {
                    "summary": "No ledger yet today: not an error",
                    "value": {
                      "status": "success",
                      "data": {
                        "trading_day": "2026-10-16",
                        "available": false,
                        "strategies": [],
                        "missing": [
                          {
                            "account": "P1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "P2",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "Z1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "PF1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "U1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "5P1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "MO1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "TJ1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "options_summary": {
                    "summary": "An options strategy with its analytics summary",
                    "value": {
                      "status": "success",
                      "data": {
                        "trading_day": "2026-10-16",
                        "available": true,
                        "strategies": [
                          {
                            "name": "strangle.1",
                            "label": "strangle.1",
                            "accounts": [
                              {
                                "account": "P1",
                                "at": "2026-10-16T12:09:02.889720Z",
                                "stale": false,
                                "rows": [
                                  {
                                    "cirrus_token": "CT:TEST:NIFTY30DEC25500CE",
                                    "symbol": "NIFTY",
                                    "tradingsymbol": "NIFTY30DEC25500CE",
                                    "product": "CARRYFORWARD",
                                    "net_qty": -75,
                                    "avg_price": 7000,
                                    "realized": 0,
                                    "ltp": 6800,
                                    "ltp_stale": false,
                                    "unrealized": 15000,
                                    "instrument_token": "CT:TEST:NIFTY30DEC25500CE"
                                  },
                                  {
                                    "cirrus_token": "CT:TEST:NIFTY30DEC24500PE",
                                    "symbol": "NIFTY",
                                    "tradingsymbol": "NIFTY30DEC24500PE",
                                    "product": "CARRYFORWARD",
                                    "net_qty": -75,
                                    "avg_price": 850,
                                    "realized": 0,
                                    "ltp": 800,
                                    "ltp_stale": false,
                                    "unrealized": 3750,
                                    "instrument_token": "CT:TEST:NIFTY30DEC24500PE"
                                  }
                                ],
                                "totals": {
                                  "realized": 0,
                                  "unrealized": 18750,
                                  "total": 18750,
                                  "ltp_stale": false
                                }
                              }
                            ],
                            "totals": {
                              "realized": 0,
                              "unrealized": 18750,
                              "total": 18750,
                              "ltp_stale": false
                            },
                            "recon": {
                              "status": "ok",
                              "note": "Matches the broker's positions."
                            },
                            "at": "2026-10-16T12:09:02.889720Z",
                            "analytics": {
                              "underlying": "NIFTY",
                              "spot": 25000,
                              "model": "black_scholes",
                              "rate": 0.065,
                              "greeks": {
                                "delta": -49.03,
                                "gamma": -0.004267,
                                "theta_per_day": 229.06,
                                "vega_per_vol_point": -19605.02
                              },
                              "breakevens": [
                                16650,
                                33350
                              ],
                              "max_profit": 588750,
                              "max_profit_unlimited": false,
                              "max_loss": null,
                              "max_loss_unlimited": true,
                              "probability_of_profit": 0.5446,
                              "note": null
                            }
                          }
                        ],
                        "missing": [
                          {
                            "account": "P2",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "Z1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "PF1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "U1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "5P1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "MO1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "TJ1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A strategy in two accounts and the unassigned rest",
                    "value": {
                      "status": "success",
                      "data": {
                        "trading_day": "2026-10-16",
                        "available": true,
                        "strategies": [
                          {
                            "name": "momo.1",
                            "label": "momo.1",
                            "accounts": [
                              {
                                "account": "P1",
                                "at": "2026-10-16T11:26:45.364286Z",
                                "stale": false,
                                "rows": [
                                  {
                                    "cirrus_token": "CT:TEST:RELIANCE",
                                    "symbol": "RELIANCE",
                                    "tradingsymbol": "RELIANCE-EQ",
                                    "product": "MIS",
                                    "net_qty": 10,
                                    "avg_price": 2490,
                                    "realized": 150.5,
                                    "ltp": 2500,
                                    "ltp_stale": false,
                                    "unrealized": 100,
                                    "instrument_token": "CT:TEST:RELIANCE"
                                  }
                                ],
                                "totals": {
                                  "realized": 150.5,
                                  "unrealized": 100,
                                  "total": 250.5,
                                  "ltp_stale": false
                                }
                              },
                              {
                                "account": "P2",
                                "at": "2026-10-16T11:26:45.364736Z",
                                "stale": false,
                                "rows": [
                                  {
                                    "cirrus_token": "CT:TEST:RELIANCE",
                                    "symbol": "RELIANCE",
                                    "tradingsymbol": "RELIANCE-EQ",
                                    "product": "MIS",
                                    "net_qty": -4,
                                    "avg_price": 2510,
                                    "realized": 0,
                                    "ltp": 2500,
                                    "ltp_stale": false,
                                    "unrealized": 40,
                                    "instrument_token": "CT:TEST:RELIANCE"
                                  }
                                ],
                                "totals": {
                                  "realized": 0,
                                  "unrealized": 40,
                                  "total": 40,
                                  "ltp_stale": false
                                }
                              }
                            ],
                            "totals": {
                              "realized": 150.5,
                              "unrealized": 140,
                              "total": 290.5,
                              "ltp_stale": false
                            },
                            "recon": {
                              "status": "ok",
                              "note": "Matches the broker's positions."
                            },
                            "at": "2026-10-16T11:26:45.364286Z"
                          },
                          {
                            "name": null,
                            "label": "Unassigned",
                            "accounts": [
                              {
                                "account": "P1",
                                "at": "2026-10-16T11:26:45.364286Z",
                                "stale": false,
                                "rows": [
                                  {
                                    "cirrus_token": "CT:TEST:RELIANCE",
                                    "symbol": "RELIANCE",
                                    "tradingsymbol": "RELIANCE-EQ",
                                    "product": "DELIVERY",
                                    "net_qty": 5,
                                    "avg_price": 2400,
                                    "realized": 0,
                                    "ltp": 2500,
                                    "ltp_stale": false,
                                    "unrealized": 500,
                                    "instrument_token": "CT:TEST:RELIANCE"
                                  }
                                ],
                                "totals": {
                                  "realized": 0,
                                  "unrealized": 500,
                                  "total": 500,
                                  "ltp_stale": false
                                }
                              }
                            ],
                            "totals": {
                              "realized": 0,
                              "unrealized": 500,
                              "total": 500,
                              "ltp_stale": false
                            },
                            "recon": {
                              "status": "ok",
                              "note": "Matches the broker's positions."
                            },
                            "at": "2026-10-16T11:26:45.364286Z"
                          }
                        ],
                        "missing": [
                          {
                            "account": "Z1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "PF1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "U1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "5P1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "MO1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "TJ1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the read scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or ledgers are temporarily unavailable; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/strategies/{name}": {
      "get": {
        "tags": [
          "strategies"
        ],
        "summary": "One strategy today",
        "description": "One strategy, as in `GET /v1/strategies`, with its v2 triggers. `~unassigned` names the unassigned rest. A strategy with nothing today answers with no accounts and zero totals.",
        "operationId": "get_strategy",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "The strategy's name, or `~unassigned`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scenario",
            "in": "query",
            "description": "`1`: add the analytics scenario grid (P&L today for spot −5% to\n+5% × IV −5, 0, +5 points).",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The strategy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_StrategyDetailView"
                },
                "examples": {
                  "options_analytics": {
                    "summary": "A short strangle: IV, greeks and payoff",
                    "value": {
                      "status": "success",
                      "data": {
                        "trading_day": "2026-10-16",
                        "available": true,
                        "strategy": {
                          "name": "strangle.1",
                          "label": "strangle.1",
                          "accounts": [
                            {
                              "account": "P1",
                              "at": "2026-10-16T12:09:02.889720Z",
                              "stale": false,
                              "rows": [
                                {
                                  "cirrus_token": "CT:TEST:NIFTY30DEC25500CE",
                                  "symbol": "NIFTY",
                                  "tradingsymbol": "NIFTY30DEC25500CE",
                                  "product": "CARRYFORWARD",
                                  "net_qty": -75,
                                  "avg_price": 7000,
                                  "realized": 0,
                                  "ltp": 6800,
                                  "ltp_stale": false,
                                  "unrealized": 15000,
                                  "instrument_token": "CT:TEST:NIFTY30DEC25500CE"
                                },
                                {
                                  "cirrus_token": "CT:TEST:NIFTY30DEC24500PE",
                                  "symbol": "NIFTY",
                                  "tradingsymbol": "NIFTY30DEC24500PE",
                                  "product": "CARRYFORWARD",
                                  "net_qty": -75,
                                  "avg_price": 850,
                                  "realized": 0,
                                  "ltp": 800,
                                  "ltp_stale": false,
                                  "unrealized": 3750,
                                  "instrument_token": "CT:TEST:NIFTY30DEC24500PE"
                                }
                              ],
                              "totals": {
                                "realized": 0,
                                "unrealized": 18750,
                                "total": 18750,
                                "ltp_stale": false
                              }
                            }
                          ],
                          "totals": {
                            "realized": 0,
                            "unrealized": 18750,
                            "total": 18750,
                            "ltp_stale": false
                          },
                          "recon": {
                            "status": "ok",
                            "note": "Matches the broker's positions."
                          },
                          "at": "2026-10-16T12:09:02.889720Z",
                          "analytics": {
                            "underlying": "NIFTY",
                            "spot": 25000,
                            "model": "black_scholes",
                            "rate": 0.065,
                            "greeks": {
                              "delta": -49.03,
                              "gamma": -0.004267,
                              "theta_per_day": 229.06,
                              "vega_per_vol_point": -19605.02
                            },
                            "breakevens": [
                              16650,
                              33350
                            ],
                            "max_profit": 588750,
                            "max_profit_unlimited": false,
                            "max_loss": null,
                            "max_loss_unlimited": true,
                            "probability_of_profit": 0.5446,
                            "note": null,
                            "legs": [
                              {
                                "cirrus_token": "CT:TEST:NIFTY30DEC24500PE",
                                "tradingsymbol": "NIFTY30DEC24500PE",
                                "instrument": "option",
                                "option_type": "PE",
                                "strike": 24500,
                                "expiry": "2030-12-26",
                                "days_to_expiry": 1531.91,
                                "net_qty": -75,
                                "avg_price": 850,
                                "ltp": 800,
                                "iv_pct": 16.73,
                                "greeks": {
                                  "delta": 11.43,
                                  "gamma": -0.002062,
                                  "theta_per_day": -12.14,
                                  "vega_per_vol_point": -9051.73
                                },
                                "note": null,
                                "instrument_token": "CT:TEST:NIFTY30DEC24500PE"
                              },
                              {
                                "cirrus_token": "CT:TEST:NIFTY30DEC25500CE",
                                "tradingsymbol": "NIFTY30DEC25500CE",
                                "instrument": "option",
                                "option_type": "CE",
                                "strike": 25500,
                                "expiry": "2030-12-26",
                                "days_to_expiry": 1531.91,
                                "net_qty": -75,
                                "avg_price": 7000,
                                "ltp": 6800,
                                "iv_pct": 18.25,
                                "greeks": {
                                  "delta": -60.46,
                                  "gamma": -0.002205,
                                  "theta_per_day": 241.2,
                                  "vega_per_vol_point": -10553.29
                                },
                                "note": null,
                                "instrument_token": "CT:TEST:NIFTY30DEC25500CE"
                              }
                            ],
                            "payoff": {
                              "spots": [
                                22500,
                                22583.33,
                                22666.67,
                                22750,
                                22833.33,
                                22916.67,
                                23000,
                                23083.33,
                                23166.67,
                                23250,
                                23333.33,
                                23416.67,
                                23500,
                                23583.33,
                                23666.67,
                                23750,
                                23833.33,
                                23916.67,
                                24000,
                                24083.33,
                                24166.67,
                                24250,
                                24333.33,
                                24416.67,
                                24500,
                                24583.33,
                                24666.67,
                                24750,
                                24833.33,
                                24916.67,
                                25000,
                                25083.33,
                                25166.67,
                                25250,
                                25333.33,
                                25416.67,
                                25500,
                                25583.33,
                                25666.67,
                                25750,
                                25833.33,
                                25916.67,
                                26000,
                                26083.33,
                                26166.67,
                                26250,
                                26333.33,
                                26416.67,
                                26500,
                                26583.33,
                                26666.67,
                                26750,
                                26833.33,
                                26916.67,
                                27000,
                                27083.33,
                                27166.67,
                                27250,
                                27333.33,
                                27416.67,
                                27500
                              ],
                              "at_expiry": [
                                438750,
                                445000,
                                451250,
                                457500,
                                463750,
                                470000,
                                476250,
                                482500,
                                488750,
                                495000,
                                501250,
                                507500,
                                513750,
                                520000,
                                526250,
                                532500,
                                538750,
                                545000,
                                551250,
                                557500,
                                563750,
                                570000,
                                576250,
                                582500,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                582500,
                                576250,
                                570000,
                                563750,
                                557500,
                                551250,
                                545000,
                                538750,
                                532500,
                                526250,
                                520000,
                                513750,
                                507500,
                                501250,
                                495000,
                                488750,
                                482500,
                                476250,
                                470000,
                                463750,
                                457500,
                                451250,
                                445000,
                                438750
                              ],
                              "today": [
                                126271,
                                123228.12,
                                120144.01,
                                117019.1,
                                113853.84,
                                110648.65,
                                107403.95,
                                104120.17,
                                100797.74,
                                97437.08,
                                94038.6,
                                90602.72,
                                87129.85,
                                83620.41,
                                80074.81,
                                76493.45,
                                72876.73,
                                69225.05,
                                65538.83,
                                61818.44,
                                58064.28,
                                54276.75,
                                50456.23,
                                46603.11,
                                42717.76,
                                38800.57,
                                34851.91,
                                30872.15,
                                26861.67,
                                22820.83,
                                18750,
                                14649.53,
                                10519.79,
                                6361.13,
                                2173.9,
                                -2041.54,
                                -6284.87,
                                -10555.72,
                                -14853.76,
                                -19178.66,
                                -23530.08,
                                -27907.69,
                                -32311.16,
                                -36740.17,
                                -41194.4,
                                -45673.54,
                                -50177.25,
                                -54705.24,
                                -59257.19,
                                -63832.81,
                                -68431.78,
                                -73053.8,
                                -77698.59,
                                -82365.85,
                                -87055.28,
                                -91766.6,
                                -96499.52,
                                -101253.77,
                                -106029.07,
                                -110825.14,
                                -115641.7
                              ]
                            }
                          }
                        },
                        "missing": [
                          {
                            "account": "P2",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "Z1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "PF1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "U1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "5P1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "MO1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "TJ1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          }
                        ],
                        "triggers": []
                      },
                      "error": null
                    }
                  },
                  "options_scenario": {
                    "summary": "With `scenario=1`: P&L today for spot × IV shifts",
                    "value": {
                      "status": "success",
                      "data": {
                        "trading_day": "2026-10-16",
                        "available": true,
                        "strategy": {
                          "name": "strangle.1",
                          "label": "strangle.1",
                          "accounts": [
                            {
                              "account": "P1",
                              "at": "2026-10-16T12:09:02.889720Z",
                              "stale": false,
                              "rows": [
                                {
                                  "cirrus_token": "CT:TEST:NIFTY30DEC25500CE",
                                  "symbol": "NIFTY",
                                  "tradingsymbol": "NIFTY30DEC25500CE",
                                  "product": "CARRYFORWARD",
                                  "net_qty": -75,
                                  "avg_price": 7000,
                                  "realized": 0,
                                  "ltp": 6800,
                                  "ltp_stale": false,
                                  "unrealized": 15000,
                                  "instrument_token": "CT:TEST:NIFTY30DEC25500CE"
                                },
                                {
                                  "cirrus_token": "CT:TEST:NIFTY30DEC24500PE",
                                  "symbol": "NIFTY",
                                  "tradingsymbol": "NIFTY30DEC24500PE",
                                  "product": "CARRYFORWARD",
                                  "net_qty": -75,
                                  "avg_price": 850,
                                  "realized": 0,
                                  "ltp": 800,
                                  "ltp_stale": false,
                                  "unrealized": 3750,
                                  "instrument_token": "CT:TEST:NIFTY30DEC24500PE"
                                }
                              ],
                              "totals": {
                                "realized": 0,
                                "unrealized": 18750,
                                "total": 18750,
                                "ltp_stale": false
                              }
                            }
                          ],
                          "totals": {
                            "realized": 0,
                            "unrealized": 18750,
                            "total": 18750,
                            "ltp_stale": false
                          },
                          "recon": {
                            "status": "ok",
                            "note": "Matches the broker's positions."
                          },
                          "at": "2026-10-16T12:09:02.889720Z",
                          "analytics": {
                            "underlying": "NIFTY",
                            "spot": 25000,
                            "model": "black_scholes",
                            "rate": 0.065,
                            "greeks": {
                              "delta": -49.03,
                              "gamma": -0.004267,
                              "theta_per_day": 229.06,
                              "vega_per_vol_point": -19605.02
                            },
                            "breakevens": [
                              16650,
                              33350
                            ],
                            "max_profit": 588750,
                            "max_profit_unlimited": false,
                            "max_loss": null,
                            "max_loss_unlimited": true,
                            "probability_of_profit": 0.5446,
                            "note": null,
                            "legs": [
                              {
                                "cirrus_token": "CT:TEST:NIFTY30DEC24500PE",
                                "tradingsymbol": "NIFTY30DEC24500PE",
                                "instrument": "option",
                                "option_type": "PE",
                                "strike": 24500,
                                "expiry": "2030-12-26",
                                "days_to_expiry": 1531.91,
                                "net_qty": -75,
                                "avg_price": 850,
                                "ltp": 800,
                                "iv_pct": 16.73,
                                "greeks": {
                                  "delta": 11.43,
                                  "gamma": -0.002062,
                                  "theta_per_day": -12.14,
                                  "vega_per_vol_point": -9051.73
                                },
                                "note": null,
                                "instrument_token": "CT:TEST:NIFTY30DEC24500PE"
                              },
                              {
                                "cirrus_token": "CT:TEST:NIFTY30DEC25500CE",
                                "tradingsymbol": "NIFTY30DEC25500CE",
                                "instrument": "option",
                                "option_type": "CE",
                                "strike": 25500,
                                "expiry": "2030-12-26",
                                "days_to_expiry": 1531.91,
                                "net_qty": -75,
                                "avg_price": 7000,
                                "ltp": 6800,
                                "iv_pct": 18.25,
                                "greeks": {
                                  "delta": -60.46,
                                  "gamma": -0.002205,
                                  "theta_per_day": 241.2,
                                  "vega_per_vol_point": -10553.29
                                },
                                "note": null,
                                "instrument_token": "CT:TEST:NIFTY30DEC25500CE"
                              }
                            ],
                            "payoff": {
                              "spots": [
                                22500,
                                22583.33,
                                22666.67,
                                22750,
                                22833.33,
                                22916.67,
                                23000,
                                23083.33,
                                23166.67,
                                23250,
                                23333.33,
                                23416.67,
                                23500,
                                23583.33,
                                23666.67,
                                23750,
                                23833.33,
                                23916.67,
                                24000,
                                24083.33,
                                24166.67,
                                24250,
                                24333.33,
                                24416.67,
                                24500,
                                24583.33,
                                24666.67,
                                24750,
                                24833.33,
                                24916.67,
                                25000,
                                25083.33,
                                25166.67,
                                25250,
                                25333.33,
                                25416.67,
                                25500,
                                25583.33,
                                25666.67,
                                25750,
                                25833.33,
                                25916.67,
                                26000,
                                26083.33,
                                26166.67,
                                26250,
                                26333.33,
                                26416.67,
                                26500,
                                26583.33,
                                26666.67,
                                26750,
                                26833.33,
                                26916.67,
                                27000,
                                27083.33,
                                27166.67,
                                27250,
                                27333.33,
                                27416.67,
                                27500
                              ],
                              "at_expiry": [
                                438750,
                                445000,
                                451250,
                                457500,
                                463750,
                                470000,
                                476250,
                                482500,
                                488750,
                                495000,
                                501250,
                                507500,
                                513750,
                                520000,
                                526250,
                                532500,
                                538750,
                                545000,
                                551250,
                                557500,
                                563750,
                                570000,
                                576250,
                                582500,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                588750,
                                582500,
                                576250,
                                570000,
                                563750,
                                557500,
                                551250,
                                545000,
                                538750,
                                532500,
                                526250,
                                520000,
                                513750,
                                507500,
                                501250,
                                495000,
                                488750,
                                482500,
                                476250,
                                470000,
                                463750,
                                457500,
                                451250,
                                445000,
                                438750
                              ],
                              "today": [
                                126271,
                                123228.12,
                                120144.01,
                                117019.1,
                                113853.84,
                                110648.65,
                                107403.95,
                                104120.17,
                                100797.74,
                                97437.08,
                                94038.6,
                                90602.72,
                                87129.85,
                                83620.41,
                                80074.81,
                                76493.45,
                                72876.73,
                                69225.05,
                                65538.83,
                                61818.44,
                                58064.28,
                                54276.75,
                                50456.23,
                                46603.11,
                                42717.76,
                                38800.57,
                                34851.91,
                                30872.15,
                                26861.67,
                                22820.83,
                                18750,
                                14649.53,
                                10519.79,
                                6361.13,
                                2173.9,
                                -2041.54,
                                -6284.87,
                                -10555.72,
                                -14853.76,
                                -19178.66,
                                -23530.08,
                                -27907.69,
                                -32311.16,
                                -36740.17,
                                -41194.4,
                                -45673.54,
                                -50177.25,
                                -54705.24,
                                -59257.19,
                                -63832.81,
                                -68431.78,
                                -73053.8,
                                -77698.59,
                                -82365.85,
                                -87055.28,
                                -91766.6,
                                -96499.52,
                                -101253.77,
                                -106029.07,
                                -110825.14,
                                -115641.7
                              ]
                            },
                            "scenario": {
                              "spot_shifts_pct": [
                                -5,
                                -4,
                                -3,
                                -2,
                                -1,
                                0,
                                1,
                                2,
                                3,
                                4,
                                5
                              ],
                              "iv_shifts": [
                                -5,
                                0,
                                5
                              ],
                              "today_pnl": [
                                [
                                  174552.44,
                                  161617.2,
                                  148329.8,
                                  134708.53,
                                  120771.05,
                                  106534.37,
                                  92014.86,
                                  77228.21,
                                  62189.48,
                                  46913.06,
                                  31412.71
                                ],
                                [
                                  76493.45,
                                  65538.83,
                                  54276.75,
                                  42717.76,
                                  30872.15,
                                  18750,
                                  6361.13,
                                  -6284.87,
                                  -19178.66,
                                  -32311.16,
                                  -45673.54
                                ],
                                [
                                  -33151.62,
                                  -43106.38,
                                  -53318.85,
                                  -63782.1,
                                  -74489.35,
                                  -85433.94,
                                  -96609.35,
                                  -108009.2,
                                  -119627.26,
                                  -131457.41,
                                  -143493.69
                                ]
                              ]
                            }
                          }
                        },
                        "missing": [
                          {
                            "account": "P2",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "Z1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "PF1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "U1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "5P1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "MO1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "TJ1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          }
                        ],
                        "triggers": []
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "One strategy across two accounts",
                    "value": {
                      "status": "success",
                      "data": {
                        "trading_day": "2026-10-16",
                        "available": true,
                        "strategy": {
                          "name": "momo.1",
                          "label": "momo.1",
                          "accounts": [
                            {
                              "account": "P1",
                              "at": "2026-10-16T11:30:11.811504Z",
                              "stale": false,
                              "rows": [
                                {
                                  "cirrus_token": "CT:TEST:RELIANCE",
                                  "symbol": "RELIANCE",
                                  "tradingsymbol": "RELIANCE-EQ",
                                  "product": "MIS",
                                  "net_qty": 10,
                                  "avg_price": 2490,
                                  "realized": 150.5,
                                  "ltp": 2500,
                                  "ltp_stale": false,
                                  "unrealized": 100,
                                  "instrument_token": "CT:TEST:RELIANCE"
                                }
                              ],
                              "totals": {
                                "realized": 150.5,
                                "unrealized": 100,
                                "total": 250.5,
                                "ltp_stale": false
                              }
                            },
                            {
                              "account": "P2",
                              "at": "2026-10-16T11:30:11.812357Z",
                              "stale": false,
                              "rows": [
                                {
                                  "cirrus_token": "CT:TEST:RELIANCE",
                                  "symbol": "RELIANCE",
                                  "tradingsymbol": "RELIANCE-EQ",
                                  "product": "MIS",
                                  "net_qty": -4,
                                  "avg_price": 2510,
                                  "realized": 0,
                                  "ltp": 2500,
                                  "ltp_stale": false,
                                  "unrealized": 40,
                                  "instrument_token": "CT:TEST:RELIANCE"
                                }
                              ],
                              "totals": {
                                "realized": 0,
                                "unrealized": 40,
                                "total": 40,
                                "ltp_stale": false
                              }
                            }
                          ],
                          "totals": {
                            "realized": 150.5,
                            "unrealized": 140,
                            "total": 290.5,
                            "ltp_stale": false
                          },
                          "recon": {
                            "status": "ok",
                            "note": "Matches the broker's positions."
                          },
                          "at": "2026-10-16T11:30:11.811504Z"
                        },
                        "missing": [
                          {
                            "account": "Z1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "PF1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "U1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "5P1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "MO1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "TJ1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          }
                        ],
                        "triggers": [
                          {
                            "trigger_id": "01M527M374SGJ48V6D45YMQWJ2",
                            "account": "P1",
                            "kind": "bracket",
                            "state": "submitted",
                            "ended": false
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "unassigned": {
                    "summary": "The unassigned rest",
                    "value": {
                      "status": "success",
                      "data": {
                        "trading_day": "2026-10-16",
                        "available": true,
                        "strategy": {
                          "name": null,
                          "label": "Unassigned",
                          "accounts": [
                            {
                              "account": "P1",
                              "at": "2026-10-16T11:30:11.811504Z",
                              "stale": false,
                              "rows": [
                                {
                                  "cirrus_token": "CT:TEST:RELIANCE",
                                  "symbol": "RELIANCE",
                                  "tradingsymbol": "RELIANCE-EQ",
                                  "product": "DELIVERY",
                                  "net_qty": 5,
                                  "avg_price": 2400,
                                  "realized": 0,
                                  "ltp": 2500,
                                  "ltp_stale": false,
                                  "unrealized": 500,
                                  "instrument_token": "CT:TEST:RELIANCE"
                                }
                              ],
                              "totals": {
                                "realized": 0,
                                "unrealized": 500,
                                "total": 500,
                                "ltp_stale": false
                              }
                            }
                          ],
                          "totals": {
                            "realized": 0,
                            "unrealized": 500,
                            "total": 500,
                            "ltp_stale": false
                          },
                          "recon": {
                            "status": "ok",
                            "note": "Matches the broker's positions."
                          },
                          "at": "2026-10-16T11:30:11.811504Z"
                        },
                        "missing": [
                          {
                            "account": "Z1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "PF1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "U1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "5P1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "MO1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          },
                          {
                            "account": "TJ1",
                            "code": "not_available_yet",
                            "reason": "Not available yet: no strategy ledger for this account today. It appears once the account has a live broker session and its trades are read."
                          }
                        ],
                        "triggers": []
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: an unknown query parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_parameter": {
                    "summary": "An unknown query parameter",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_query",
                        "message": "invalid query string: unknown field `senario`, expected `scenario`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the read scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` `scenario`): not 0 or 1.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_scenario": {
                    "summary": "`scenario` is 0 or 1",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "scenario must be 0 or 1",
                        "field": "scenario"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or ledgers are temporarily unavailable; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/strategies": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List strategies",
        "description": "The caller's strategies, most recently changed first (at most 200), with the display status derived from their deployments.",
        "operationId": "list_auto_strategies",
        "parameters": [
          {
            "name": "archived",
            "in": "query",
            "description": "Include archived strategies (default false).",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Strategies.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoStrategyItem"
                },
                "examples": {
                  "success": {
                    "summary": "The caller's strategies",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "id": "01M59F60KB7GW11NNBWTQPQ8YX",
                          "name": "NIFTY straddle",
                          "description": "",
                          "tags": [
                            "weekly"
                          ],
                          "display_status": "draft",
                          "latest_version": 0,
                          "revision": 1,
                          "deployments": {
                            "active": 0,
                            "paused": 0,
                            "error": 0,
                            "stopped": 0
                          },
                          "updated_at": "2026-10-19T06:57:00.011Z",
                          "pnl": {
                            "trading_day": "2026-10-19",
                            "realized": 0,
                            "unrealized": 0,
                            "total": 0,
                            "ltp_stale": false
                          }
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Create a strategy",
        "description": "Creates a strategy draft from a portable document (`document`: an object, or its JSON or YAML text; or the raw YAML body with `Content-Type: application/yaml`) or from a definition (`definition` + `name`). The document is checked with the same code as validate and import: problems are refused (422 `invalid_document`, one per line, `field` naming the first), blockers (a component not released yet) are saved and listed. Never deploys. Takes an optional `Idempotency-Key`.",
        "operationId": "create_auto_strategy",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoDocumentInput"
              },
              "examples": {
                "success": {
                  "summary": "A short straddle saved as a draft",
                  "value": {
                    "document": {
                      "schema_version": 1,
                      "kind": "cirrus.strategy",
                      "metadata": {
                        "name": "NIFTY straddle",
                        "tags": [
                          "weekly"
                        ]
                      },
                      "spec": {
                        "underlying": {
                          "name": "NIFTY",
                          "exchange": "NFO"
                        },
                        "legs": {
                          "selector": "chain@1",
                          "items": [
                            {
                              "id": "sc",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "call",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            },
                            {
                              "id": "sp",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "put",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            }
                          ]
                        },
                        "entry": {
                          "window": {
                            "start": "09:30",
                            "end": "13:30"
                          }
                        },
                        "risk": {
                          "combined": {
                            "type": "combined@1",
                            "stop_loss": {
                              "rupees": 3000
                            },
                            "target": {
                              "rupees": 2000
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStrategy"
                },
                "examples": {
                  "success": {
                    "summary": "A short straddle saved as a draft",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VKA19TCCDQSGVJ9EN831",
                        "name": "NIFTY straddle",
                        "description": "",
                        "tags": [
                          "weekly"
                        ],
                        "display_status": "draft",
                        "latest_version": 0,
                        "revision": 1,
                        "visibility": "private",
                        "forked_from": null,
                        "archived": false,
                        "deployments": {
                          "active": 0,
                          "paused": 0,
                          "error": 0,
                          "stopped": 0
                        },
                        "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "deployable": true,
                        "blockers": [],
                        "warnings": [],
                        "schema_version": 1,
                        "draft": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "NIFTY straddle",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": {
                                  "rupees": 2000
                                },
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        },
                        "created_at": "2026-10-18T09:18:04.097Z",
                        "updated_at": "2026-10-18T09:18:04.097Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "malformed_json": {
                    "summary": "An unknown body field",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `documnet`, expected one of `document`, `definition`, `name`, `description`, `tags`, `revision`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: automated strategies are not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_document`: the document has problems (all listed in `message`); or `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_document": {
                    "summary": "Every problem, per field, in plain words",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_document",
                        "message": "2 problems:\nLeg 2 · Strike: delta must be between 0.05 and 0.5 (found 0.8).\nWhen · Exit: This file has `spec.exit.trailing_magic`, which isn't recognised. It may come from a newer version or a typo.",
                        "field": "spec.legs.items[1].strike.delta"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited` (60 writes a minute).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/{strategy_id}": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Get a strategy",
        "description": "One strategy with its draft document (normalized), its plain-English summary, and its blockers and warnings as this server sees them now.",
        "operationId": "get_auto_strategy",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The strategy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStrategy"
                },
                "examples": {
                  "success": {
                    "summary": "One strategy with its normalized draft",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VKA19TCCDQSGVJ9EN831",
                        "name": "NIFTY straddle",
                        "description": "",
                        "tags": [
                          "weekly"
                        ],
                        "display_status": "draft",
                        "latest_version": 0,
                        "revision": 1,
                        "visibility": "private",
                        "forked_from": null,
                        "archived": false,
                        "deployments": {
                          "active": 0,
                          "paused": 0,
                          "error": 0,
                          "stopped": 0
                        },
                        "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "deployable": true,
                        "blockers": [],
                        "warnings": [],
                        "schema_version": 1,
                        "draft": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "NIFTY straddle",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": {
                                  "rupees": 2000
                                },
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        },
                        "created_at": "2026-10-18T09:18:04.097Z",
                        "updated_at": "2026-10-18T09:18:04.097Z"
                      },
                      "error": null
                    }
                  },
                  "update_available": {
                    "summary": "A fork whose source has a newer version",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M59PAXDGXDRKKW2BBQ8T7AZ7",
                        "name": "NIFTY straddle",
                        "description": "",
                        "tags": [
                          "weekly"
                        ],
                        "display_status": "draft",
                        "latest_version": 0,
                        "revision": 1,
                        "visibility": "private",
                        "forked_from": {
                          "strategy_id": "01M59PAX5AS3FKX3W9D93JY57E",
                          "version": 1
                        },
                        "archived": false,
                        "deployments": {
                          "active": 0,
                          "paused": 0,
                          "error": 0,
                          "stopped": 0
                        },
                        "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "deployable": true,
                        "blockers": [],
                        "warnings": [],
                        "schema_version": 1,
                        "draft": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "NIFTY straddle",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": null,
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        },
                        "created_at": "2026-10-19T09:02:00.624Z",
                        "updated_at": "2026-10-19T09:02:00.624Z",
                        "update_available": {
                          "version": 2,
                          "forked_version": 1,
                          "message": "A newer version (v2) from @user… is available. Your draft and running deployments don't change unless you update them."
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such strategy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "delete": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Archive a strategy",
        "description": "Archives the strategy (its versions are kept). Refused while a deployment of it is not stopped (409 `strategy_in_use`): stop it first.",
        "operationId": "archive_auto_strategy",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStrategy"
                },
                "examples": {
                  "success": {
                    "summary": "Archived after its deployment stopped",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VKA19TCCDQSGVJ9EN831",
                        "name": "NIFTY straddle, edited again",
                        "description": "",
                        "tags": [
                          "weekly"
                        ],
                        "display_status": "stopped",
                        "latest_version": 2,
                        "revision": 4,
                        "visibility": "private",
                        "forked_from": null,
                        "archived": true,
                        "deployments": {
                          "active": 0,
                          "paused": 0,
                          "error": 0,
                          "stopped": 1
                        },
                        "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "deployable": true,
                        "blockers": [],
                        "warnings": [],
                        "schema_version": 1,
                        "draft": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "NIFTY straddle, edited again",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": {
                                  "rupees": 2000
                                },
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        },
                        "created_at": "2026-10-18T09:18:04.097Z",
                        "updated_at": "2026-10-18T09:18:07.208Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such strategy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`strategy_in_use`: a deployment is active, paused or in error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "in_use": {
                    "summary": "A deployment is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_in_use",
                        "message": "Stop this strategy's deployments before archiving it",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      },
      "patch": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Edit a strategy's draft",
        "description": "Replaces the draft with a new document (same body as create). Versions never change: save the draft as a version to deploy it. With `revision`, a draft changed since that revision is refused (409 `strategy_busy`) instead of overwritten.",
        "operationId": "update_auto_strategy",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoDocumentInput"
              },
              "examples": {
                "success": {
                  "summary": "A new draft (revision checked)",
                  "value": {
                    "document": {
                      "schema_version": 1,
                      "kind": "cirrus.strategy",
                      "metadata": {
                        "name": "NIFTY straddle, 2 lots",
                        "tags": [
                          "weekly"
                        ]
                      },
                      "spec": {
                        "underlying": {
                          "name": "NIFTY",
                          "exchange": "NFO"
                        },
                        "legs": {
                          "selector": "chain@1",
                          "items": [
                            {
                              "id": "sc",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "call",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              },
                              "lots": 2
                            },
                            {
                              "id": "sp",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "put",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              },
                              "lots": 2
                            }
                          ]
                        },
                        "entry": {
                          "window": {
                            "start": "09:30",
                            "end": "13:30"
                          }
                        },
                        "risk": {
                          "combined": {
                            "type": "combined@1",
                            "stop_loss": {
                              "rupees": 3000
                            },
                            "target": {
                              "rupees": 2000
                            }
                          }
                        }
                      }
                    },
                    "revision": 1
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The updated strategy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStrategy"
                },
                "examples": {
                  "success": {
                    "summary": "A new draft (revision checked)",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VKA19TCCDQSGVJ9EN831",
                        "name": "NIFTY straddle, 2 lots",
                        "description": "",
                        "tags": [
                          "weekly"
                        ],
                        "display_status": "draft",
                        "latest_version": 0,
                        "revision": 2,
                        "visibility": "private",
                        "forked_from": null,
                        "archived": false,
                        "deployments": {
                          "active": 0,
                          "paused": 0,
                          "error": 0,
                          "stopped": 0
                        },
                        "summary": "Sell 2 lots of an ATM call (weekly expiry) and sell 2 lots of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "deployable": true,
                        "blockers": [],
                        "warnings": [],
                        "schema_version": 1,
                        "draft": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "NIFTY straddle, 2 lots",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 2,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 2,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": {
                                  "rupees": 2000
                                },
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        },
                        "created_at": "2026-10-18T09:18:04.097Z",
                        "updated_at": "2026-10-18T09:18:05.038Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such strategy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`strategy_busy`: changed since `revision`, or archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "stale_revision": {
                    "summary": "The draft changed since revision 1",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_busy",
                        "message": "The strategy changed since it was read (or is archived); read it again and retry",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_document`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_document": {
                    "summary": "A draft with problems is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_document",
                        "message": "2 problems:\nLeg 2 · Strike: delta must be between 0.05 and 0.5 (found 0.8).\nWhen · Exit: This file has `spec.exit.trailing_magic`, which isn't recognised. It may come from a newer version or a typo.",
                        "field": "spec.legs.items[1].strike.delta"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/{strategy_id}/versions": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List a strategy's versions",
        "description": "Every saved version, newest first (documents left out).",
        "operationId": "list_auto_strategy_versions",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Versions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoStrategyVersion"
                },
                "examples": {
                  "success": {
                    "summary": "Every version, newest first",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "strategy_id": "01M574VKA19TCCDQSGVJ9EN831",
                          "n": 1,
                          "schema_version": 1,
                          "compiled_hash": "sha256:c17de463c06b305846097f5abda141dc76f1ea91ebdd5ced4adce96223a8a7a4",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "summary": "Sell 2 lots of an ATM call (weekly expiry) and sell 2 lots of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "created_at": "2026-10-18T09:18:05.615Z"
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such strategy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Save the draft as a version",
        "description": "Saves the draft as the next immutable version (numbered from 1). A version never changes afterwards: deployments run exactly what it holds. With `revision`, a draft changed since is refused (409). Takes an optional `Idempotency-Key`.",
        "operationId": "save_auto_strategy_version",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "description": "Optional.",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoSaveVersionInput"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "examples": {
                "success": {
                  "summary": "Version 1 saved from the draft",
                  "value": {
                    "revision": 2
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStrategyVersion"
                },
                "examples": {
                  "success": {
                    "summary": "Version 1 saved from the draft",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy_id": "01M574VKA19TCCDQSGVJ9EN831",
                        "n": 1,
                        "schema_version": 1,
                        "compiled_hash": "sha256:c17de463c06b305846097f5abda141dc76f1ea91ebdd5ced4adce96223a8a7a4",
                        "components": [
                          "chain@1",
                          "combined@1",
                          "conditions@1",
                          "fixed_lots@1",
                          "limits@1",
                          "per_leg@1",
                          "protected_limit@1"
                        ],
                        "summary": "Sell 2 lots of an ATM call (weekly expiry) and sell 2 lots of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "deployable": true,
                        "blockers": [],
                        "warnings": [],
                        "created_at": "2026-10-18T09:18:05.615Z",
                        "document": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "NIFTY straddle, 2 lots",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 2,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 2,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": {
                                  "rupees": 2000
                                },
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such strategy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`strategy_busy`: the draft changed since `revision`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "stale_revision": {
                    "summary": "The draft changed since",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_busy",
                        "message": "The strategy changed since it was read (or is archived); read it again and retry",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/{strategy_id}/versions/{n}": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Get a version",
        "description": "One immutable version with its normalized document.",
        "operationId": "get_auto_strategy_version",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "n",
            "in": "path",
            "description": "Version number.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStrategyVersion"
                },
                "examples": {
                  "success": {
                    "summary": "Version 1, unchanged by later edits",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy_id": "01M574VKA19TCCDQSGVJ9EN831",
                        "n": 1,
                        "schema_version": 1,
                        "compiled_hash": "sha256:c17de463c06b305846097f5abda141dc76f1ea91ebdd5ced4adce96223a8a7a4",
                        "components": [
                          "chain@1",
                          "combined@1",
                          "conditions@1",
                          "fixed_lots@1",
                          "limits@1",
                          "per_leg@1",
                          "protected_limit@1"
                        ],
                        "summary": "Sell 2 lots of an ATM call (weekly expiry) and sell 2 lots of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "deployable": true,
                        "blockers": [],
                        "warnings": [],
                        "created_at": "2026-10-18T09:18:05.615Z",
                        "document": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "NIFTY straddle, 2 lots",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 2,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 2,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": {
                                  "rupees": 2000
                                },
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`version_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such version",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "version_not_found",
                        "message": "Version not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/strategies/{strategy_id}/clone": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Clone a strategy",
        "description": "A new draft from one of the strategy's versions (or its draft), recording where it came from. Never deploys.",
        "operationId": "clone_auto_strategy",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "description": "Optional.",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoCloneInput"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "examples": {
                "success": {
                  "summary": "A new draft from version 1",
                  "value": {
                    "version": 1,
                    "name": "My copy"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new draft.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStrategy"
                },
                "examples": {
                  "success": {
                    "summary": "A new draft from version 1",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VNT35HA09X24PQ7N0TD5",
                        "name": "My copy",
                        "description": "",
                        "tags": [
                          "weekly"
                        ],
                        "display_status": "draft",
                        "latest_version": 0,
                        "revision": 1,
                        "visibility": "private",
                        "forked_from": {
                          "strategy_id": "01M574VKA19TCCDQSGVJ9EN831",
                          "version": 1
                        },
                        "archived": false,
                        "deployments": {
                          "active": 0,
                          "paused": 0,
                          "error": 0,
                          "stopped": 0
                        },
                        "summary": "Sell 2 lots of an ATM call (weekly expiry) and sell 2 lots of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "deployable": true,
                        "blockers": [],
                        "warnings": [],
                        "schema_version": 1,
                        "draft": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "My copy",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 2,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 2,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": {
                                  "rupees": 2000
                                },
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        },
                        "created_at": "2026-10-18T09:18:06.659Z",
                        "updated_at": "2026-10-18T09:18:06.659Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found` or `version_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such version",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "version_not_found",
                        "message": "Version not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/{strategy_id}/export": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Export a strategy",
        "description": "The portable document of the draft or a version: canonical (defaults written out, stable key order), with no account, secret or URL. JSON comes as `document`, YAML as `document_yaml` (text). Importing it back gives the same document.",
        "operationId": "export_auto_strategy",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "description": "`json` (default) or `yaml`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "query",
            "description": "A version (default: the draft).",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStrategyExport"
                },
                "examples": {
                  "json": {
                    "summary": "The draft as JSON",
                    "value": {
                      "status": "success",
                      "data": {
                        "format": "json",
                        "filename": "nifty-straddle.strategy.json",
                        "version": null,
                        "schema_version": 1,
                        "document": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "NIFTY straddle",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": {
                                  "rupees": 2000
                                },
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        },
                        "document_yaml": null
                      },
                      "error": null
                    }
                  },
                  "yaml": {
                    "summary": "The draft as YAML",
                    "value": {
                      "status": "success",
                      "data": {
                        "format": "yaml",
                        "filename": "nifty-straddle.strategy.yaml",
                        "version": null,
                        "schema_version": 1,
                        "document": null,
                        "document_yaml": "$schema: /v2/strategies/schema/1.json\nschema_version: 1\nkind: cirrus.strategy\nmetadata:\n  name: NIFTY straddle\n  description: \"\"\n  tags: [weekly]\nspec:\n  underlying:\n    name: NIFTY\n    exchange: NFO\n    reference: future\n  watch: {}\n  positional: false\n  legs:\n    selector: \"chain@1\"\n    items:\n      - id: sc\n        instrument: option\n        side: sell\n        option_type: call\n        expiry:\n          kind: weekly\n          \"n\": 0\n        strike:\n          by: atm\n          offset: 0\n        lots: 1\n        hedge_for: null\n        risk: null\n        liquidity:\n          max_spread_pct: 3\n          min_oi: 0\n          min_premium: 1\n      - id: sp\n        instrument: option\n        side: sell\n        option_type: put\n        expiry:\n          kind: weekly\n          \"n\": 0\n        strike:\n          by: atm\n          offset: 0\n        lots: 1\n        hedge_for: null\n        risk: null\n        liquidity:\n          max_spread_pct: 3\n          min_oi: 0\n          min_premium: 1\n  entry:\n    source:\n      type: \"conditions@1\"\n      when: null\n      \"on\": close\n      hold_s: 0\n    window:\n      start: \"09:30\"\n      end: \"13:30\"\n    skip_first_min: 0\n    skip_last_min: 0\n    days: [mon, tue, wed, thu, fri]\n    expiry_day: normal\n    active_from: null\n    active_until: null\n  exit:\n    sources: []\n    square_off: \"15:15\"\n    expiry_day_exit: null\n    max_hold_min: null\n  sizing:\n    type: \"fixed_lots@1\"\n    max_lots: 10\n  execution:\n    type: \"protected_limit@1\"\n    order: auto\n    hedge_wait_ms: 5000\n    stagger_ms: 0\n    buffer_pct: 0.5\n    chase:\n      every_ms: 1000\n      max_slippage_pct: 1\n      max_attempts: 10\n    on_incomplete: safest\n    retry_next_signal: null\n  risk:\n    per_leg:\n      type: \"per_leg@1\"\n      stop_loss: null\n      target: null\n      trail: null\n      on_leg_stop: nothing\n      at_broker: false\n    combined:\n      type: \"combined@1\"\n      scope: account\n      basis: rupees\n      stop_loss:\n        rupees: 3000\n      target:\n        rupees: 2000\n      breakeven: null\n      trail: null\n      lock_ladder: []\n      deployment: null\n    limits:\n      type: \"limits@1\"\n      max_loss_per_day: null\n      max_profit_per_day: null\n      max_loss_per_week: null\n      max_cycles_per_day: 3\n      max_orders_per_day: 50\n      exit_on_limit: true\n      on_breaker: nothing\n  reentry:\n    \"on\": []\n    max: 0\n    delay_s: 300\n    require_fresh_signal: true\n    same_direction_only: true\n    until: null\n  adjustments: []\n  notify: []\n  costs:\n    model: auto\n    slippage_pct: null\n"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: `format` is not json or yaml.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_format": {
                    "summary": "Only json or yaml",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_query",
                        "message": "format must be json or yaml",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found` or `version_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such strategy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/strategies/import": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Import a strategy",
        "description": "Creates the caller's own draft from a pasted or uploaded document (`document`: an object or its JSON / YAML text; or the raw YAML body) or from one of the caller's versions (`from`). Imported documents are untrusted: at most 64 KiB (checked before parsing), YAML without anchors, aliases, merge keys or tags, nesting at most 20 deep, and the same limits as the wizard. Unknown fields and newer formats are refused with a problem naming them, never dropped; components not released yet are saved as blockers. Never deploys. Takes an optional `Idempotency-Key`.",
        "operationId": "import_auto_strategy",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoImportInput"
              },
              "examples": {
                "fork_shared": {
                  "summary": "A version shared with you, forked into your own draft",
                  "value": {
                    "from": {
                      "strategy_id": "01M59PAX5AS3FKX3W9D93JY57E"
                    }
                  }
                },
                "success": {
                  "summary": "A pasted YAML document becomes a draft",
                  "value": {
                    "document": "$schema: /v2/strategies/schema/1.json\nschema_version: 1\nkind: cirrus.strategy\nmetadata:\n  name: NIFTY straddle\n  description: \"\"\n  tags: [weekly]\nspec:\n  underlying:\n    name: NIFTY\n    exchange: NFO\n    reference: future\n  watch: {}\n  positional: false\n  legs:\n    selector: \"chain@1\"\n    items:\n      - id: sc\n        instrument: option\n        side: sell\n        option_type: call\n        expiry:\n          kind: weekly\n          \"n\": 0\n        strike:\n          by: atm\n          offset: 0\n        lots: 1\n        hedge_for: null\n        risk: null\n        liquidity:\n          max_spread_pct: 3\n          min_oi: 0\n          min_premium: 1\n      - id: sp\n        instrument: option\n        side: sell\n        option_type: put\n        expiry:\n          kind: weekly\n          \"n\": 0\n        strike:\n          by: atm\n          offset: 0\n        lots: 1\n        hedge_for: null\n        risk: null\n        liquidity:\n          max_spread_pct: 3\n          min_oi: 0\n          min_premium: 1\n  entry:\n    source:\n      type: \"conditions@1\"\n      when: null\n      \"on\": close\n      hold_s: 0\n    window:\n      start: \"09:30\"\n      end: \"13:30\"\n    skip_first_min: 0\n    skip_last_min: 0\n    days: [mon, tue, wed, thu, fri]\n    expiry_day: normal\n    active_from: null\n    active_until: null\n  exit:\n    sources: []\n    square_off: \"15:15\"\n    expiry_day_exit: null\n    max_hold_min: null\n  sizing:\n    type: \"fixed_lots@1\"\n    max_lots: 10\n  execution:\n    type: \"protected_limit@1\"\n    order: auto\n    hedge_wait_ms: 5000\n    stagger_ms: 0\n    buffer_pct: 0.5\n    chase:\n      every_ms: 1000\n      max_slippage_pct: 1\n      max_attempts: 10\n    on_incomplete: safest\n    retry_next_signal: null\n  risk:\n    per_leg:\n      type: \"per_leg@1\"\n      stop_loss: null\n      target: null\n      trail: null\n      on_leg_stop: nothing\n      at_broker: false\n    combined:\n      type: \"combined@1\"\n      scope: account\n      basis: rupees\n      stop_loss:\n        rupees: 3000\n      target:\n        rupees: 2000\n      breakeven: null\n      trail: null\n      lock_ladder: []\n      deployment: null\n    limits:\n      type: \"limits@1\"\n      max_loss_per_day: null\n      max_profit_per_day: null\n      max_loss_per_week: null\n      max_cycles_per_day: 3\n      max_orders_per_day: 50\n      exit_on_limit: true\n      on_breaker: nothing\n  reentry:\n    \"on\": []\n    max: 0\n    delay_s: 300\n    require_fresh_signal: true\n    same_direction_only: true\n    until: null\n  adjustments: []\n  notify: []\n  costs:\n    model: auto\n    slippage_pct: null\n"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The new draft.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoImportResult"
                },
                "examples": {
                  "fork_shared": {
                    "summary": "A version shared with you, forked into your own draft",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy": {
                          "id": "01M59PAXDGXDRKKW2BBQ8T7AZ7",
                          "name": "NIFTY straddle",
                          "description": "",
                          "tags": [
                            "weekly"
                          ],
                          "display_status": "draft",
                          "latest_version": 0,
                          "revision": 1,
                          "visibility": "private",
                          "forked_from": {
                            "strategy_id": "01M59PAX5AS3FKX3W9D93JY57E",
                            "version": 1
                          },
                          "archived": false,
                          "deployments": {
                            "active": 0,
                            "paused": 0,
                            "error": 0,
                            "stopped": 0
                          },
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "schema_version": 1,
                          "draft": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY straddle",
                              "description": "",
                              "tags": [
                                "weekly"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "sc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": null,
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "13:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 3000
                                  },
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          },
                          "created_at": "2026-10-19T09:02:00.624Z",
                          "updated_at": "2026-10-19T09:02:00.624Z"
                        },
                        "validation": {
                          "ok": true,
                          "deployable": true,
                          "schema_version": 1,
                          "migrated_from": null,
                          "errors": [],
                          "blockers": [],
                          "warnings": [],
                          "needs_ack": [],
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "compiled_hash": "sha256:44ffd35c2d50344cd553dba925e707521b55be5023eae9a4a165acdc1190a9cf",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "warm_up": null
                        }
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A pasted YAML document becomes a draft",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy": {
                          "id": "01M574VMP7NY5WR1XNRJ9WF4P5",
                          "name": "NIFTY straddle",
                          "description": "",
                          "tags": [
                            "weekly"
                          ],
                          "display_status": "draft",
                          "latest_version": 0,
                          "revision": 1,
                          "visibility": "private",
                          "forked_from": null,
                          "archived": false,
                          "deployments": {
                            "active": 0,
                            "paused": 0,
                            "error": 0,
                            "stopped": 0
                          },
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "schema_version": 1,
                          "draft": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY straddle",
                              "description": "",
                              "tags": [
                                "weekly"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "sc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": null,
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "13:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 3000
                                  },
                                  "target": {
                                    "rupees": 2000
                                  },
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          },
                          "created_at": "2026-10-18T09:18:05.511Z",
                          "updated_at": "2026-10-18T09:18:05.511Z"
                        },
                        "validation": {
                          "ok": true,
                          "deployable": true,
                          "schema_version": 1,
                          "migrated_from": null,
                          "errors": [],
                          "blockers": [],
                          "warnings": [],
                          "needs_ack": [],
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "compiled_hash": "sha256:c030cdecce518bdf50067237a17de0b5508d3e962e743a87dd41e7df3ef01ff9",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "warm_up": null
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "malformed_json": {
                    "summary": "An unknown body field",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `doc`, expected `document` or `from`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found` or `version_not_found` (`from`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such strategy to copy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_document`: every problem in `message`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_field": {
                    "summary": "Unknown fields are refused, never dropped",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_document",
                        "message": "When · Exit: This file has `spec.exit.trailing_magic`, which isn't recognised. It may come from a newer version or a typo.",
                        "field": "spec.exit.trailing_magic"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/{strategy_id}/sharing": {
      "put": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Share a strategy",
        "description": "Shares the newest saved version (never the draft) with named users (`visibility: users`, `shared_with`) or by link (`visibility: link`; the token is in this answer only, `link: create` makes a new one and the old one stops working), or makes it private again. Viewers see the version's document and summary, read-only, and may fork it into their own draft; they never see accounts, deployments, orders, P&L, journeys or webhooks. Stopping a share never touches existing forks. Off when `OMS_AUTO_STRATEGIES` is off. Takes an optional `Idempotency-Key`.",
        "operationId": "share_auto_strategy",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoSharingInput"
              },
              "examples": {
                "link": {
                  "summary": "Shared by link (the token is shown once)",
                  "value": {
                    "visibility": "link"
                  }
                },
                "success": {
                  "summary": "Version 1 shared with one user",
                  "value": {
                    "visibility": "users",
                    "shared_with": [
                      "owner-01M59PAX3ZRBAGC80PT5N24KQR"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The sharing now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoSharing"
                },
                "examples": {
                  "link": {
                    "summary": "Shared by link (the token is shown once)",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy_id": "01M59PAX5AVPZXACR63HAP9ZMM",
                        "visibility": "link",
                        "shared_with": [],
                        "link": {
                          "token": "sl_ZYTSyMlELpCrijnpbQq9qAeoPwGUt2ZiIDb8uynW",
                          "created_at": "2026-10-19T09:02:00.375Z"
                        },
                        "shared_version": 1
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "Version 1 shared with one user",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy_id": "01M59PAX5AS3FKX3W9D93JY57E",
                        "visibility": "users",
                        "shared_with": [
                          "owner-01M59PAX3ZRBAGC80PT5N24KQR"
                        ],
                        "link": null,
                        "shared_version": 1
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: automated strategies or sharing are not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "strategy_not_found": {
                    "summary": "Someone else's strategy: as if it did not exist",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`no_saved_version`: save a version first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "no_saved_version": {
                    "summary": "Nothing saved yet",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "no_saved_version",
                        "message": "Save a version first: a share is a saved version, never the draft.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: e.g. `public` (the gallery comes later), no users, more than 50 users.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "public_later": {
                    "summary": "The public gallery comes later",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "the public gallery comes later; share with users or by link",
                        "field": "visibility"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      },
      "delete": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Stop sharing a strategy",
        "description": "Makes the strategy private: named users lose access and the link stops working at once. Forks already made stay their owners'. Takes an optional `Idempotency-Key`.",
        "operationId": "unshare_auto_strategy",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Private now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoSharing"
                },
                "examples": {
                  "success": {
                    "summary": "Private again",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy_id": "01M59PAX5AS3FKX3W9D93JY57E",
                        "visibility": "private",
                        "shared_with": [],
                        "link": null,
                        "shared_version": 2
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "strategy_not_found": {
                    "summary": "Someone else's strategy: as if it did not exist",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/shared": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Strategies shared with you",
        "description": "Strategies other users shared with you by name, newest change first (at most 200), without their documents.",
        "operationId": "list_shared_auto_strategies",
        "responses": {
          "200": {
            "description": "Shared with you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoSharedStrategy"
                },
                "examples": {
                  "success": {
                    "summary": "Strategies shared with you",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "strategy_id": "01M59PAX5AS3FKX3W9D93JY57E",
                          "name": "NIFTY straddle",
                          "description": "",
                          "tags": [
                            "weekly"
                          ],
                          "owner": "@user…",
                          "version": 1,
                          "summary": "",
                          "read_only": true
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/shared/strategies/{strategy_id}": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Get a strategy shared with you",
        "description": "The newest saved version of a strategy its owner shared with you by name, read-only.",
        "operationId": "get_shared_auto_strategy",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The shared version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoSharedStrategy"
                },
                "examples": {
                  "success": {
                    "summary": "A version shared with you, read-only",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy_id": "01M59PAX5AS3FKX3W9D93JY57E",
                        "name": "NIFTY straddle",
                        "description": "",
                        "tags": [
                          "weekly"
                        ],
                        "owner": "@user…",
                        "version": 1,
                        "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "read_only": true,
                        "document": {
                          "$schema": "/v2/strategies/schema/1.json",
                          "schema_version": 1,
                          "kind": "cirrus.strategy",
                          "metadata": {
                            "name": "NIFTY straddle",
                            "description": "",
                            "tags": [
                              "weekly"
                            ]
                          },
                          "spec": {
                            "underlying": {
                              "name": "NIFTY",
                              "exchange": "NFO",
                              "reference": "future"
                            },
                            "watch": {},
                            "positional": false,
                            "legs": {
                              "selector": "chain@1",
                              "items": [
                                {
                                  "id": "sc",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "call",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                },
                                {
                                  "id": "sp",
                                  "instrument": "option",
                                  "side": "sell",
                                  "option_type": "put",
                                  "expiry": {
                                    "kind": "weekly",
                                    "n": 0
                                  },
                                  "strike": {
                                    "by": "atm",
                                    "offset": 0
                                  },
                                  "lots": 1,
                                  "hedge_for": null,
                                  "risk": null,
                                  "liquidity": {
                                    "max_spread_pct": 3,
                                    "min_oi": 0,
                                    "min_premium": 1
                                  }
                                }
                              ]
                            },
                            "entry": {
                              "source": {
                                "type": "conditions@1",
                                "when": null,
                                "on": "close",
                                "hold_s": 0
                              },
                              "window": {
                                "start": "09:30",
                                "end": "13:30"
                              },
                              "skip_first_min": 0,
                              "skip_last_min": 0,
                              "days": [
                                "mon",
                                "tue",
                                "wed",
                                "thu",
                                "fri"
                              ],
                              "expiry_day": "normal",
                              "active_from": null,
                              "active_until": null
                            },
                            "exit": {
                              "sources": [],
                              "square_off": "15:15",
                              "expiry_day_exit": null,
                              "max_hold_min": null
                            },
                            "sizing": {
                              "type": "fixed_lots@1",
                              "max_lots": 10
                            },
                            "execution": {
                              "type": "protected_limit@1",
                              "order": "auto",
                              "hedge_wait_ms": 5000,
                              "stagger_ms": 0,
                              "buffer_pct": 0.5,
                              "chase": {
                                "every_ms": 1000,
                                "max_slippage_pct": 1,
                                "max_attempts": 10
                              },
                              "on_incomplete": "safest",
                              "retry_next_signal": null
                            },
                            "risk": {
                              "per_leg": {
                                "type": "per_leg@1",
                                "stop_loss": null,
                                "target": null,
                                "trail": null,
                                "on_leg_stop": "nothing",
                                "at_broker": false
                              },
                              "combined": {
                                "type": "combined@1",
                                "scope": "account",
                                "basis": "rupees",
                                "stop_loss": {
                                  "rupees": 3000
                                },
                                "target": null,
                                "breakeven": null,
                                "trail": null,
                                "lock_ladder": [],
                                "deployment": null
                              },
                              "limits": {
                                "type": "limits@1",
                                "max_loss_per_day": null,
                                "max_profit_per_day": null,
                                "max_loss_per_week": null,
                                "max_cycles_per_day": 3,
                                "max_orders_per_day": 50,
                                "exit_on_limit": true,
                                "on_breaker": "nothing"
                              }
                            },
                            "reentry": {
                              "on": [],
                              "max": 0,
                              "delay_s": 300,
                              "require_fresh_signal": true,
                              "same_direction_only": true,
                              "until": null
                            },
                            "adjustments": [],
                            "notify": [],
                            "costs": {
                              "model": "auto",
                              "slippage_pct": null
                            }
                          }
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`shared_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "shared_not_found": {
                    "summary": "No longer shared with you",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "shared_not_found",
                        "message": "Nothing is shared with you here: the share was stopped, or never existed.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/strategies/validate": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Validate a strategy document",
        "description": "Checks a document (same body as create) with the code create, import and versions use, and answers 200 whatever it finds: `errors` (refused), `blockers` (saved, not deployable yet), `warnings` (`needs_ack`: to acknowledge at deploy), each with the document path (`field`), the wizard label and a plain-English message; the summary; and the hash of the compiled strategy (equal for any way of writing it). Everything a deploy would refuse for the document is a blocker here first: the engine plan compiled for a stand-in paper account and checked by the engine (`engine_refuses`), symbols not in today's instrument list (`not_in_instrument_list`), underlyings not open, alerts not available. With `accounts` (and `mode`, default `paper`), the deploy's account rules come back as warnings with the deploy's own code and words, except the e2e test account / instrument rule (an e2e account trades only e2e instruments and an e2e instrument only e2e accounts), which no acknowledgement lifts: a blocker (`invalid_request`) on the account (`accounts[i].account`) or on the e2e symbol's field. Fast enough to call as the user types (no broker calls).",
        "operationId": "validate_auto_strategy",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoValidateInput"
              },
              "examples": {
                "blockers_and_warnings": {
                  "summary": "Saved but not deployable; a warning to acknowledge",
                  "value": {
                    "document": {
                      "schema_version": 1,
                      "kind": "cirrus.strategy",
                      "metadata": {
                        "name": "Naked straddle",
                        "tags": [
                          "weekly"
                        ]
                      },
                      "spec": {
                        "underlying": {
                          "name": "NIFTY",
                          "exchange": "NFO"
                        },
                        "legs": {
                          "selector": "chain@1",
                          "items": [
                            {
                              "id": "sc",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "call",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            },
                            {
                              "id": "sp",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "put",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            }
                          ]
                        },
                        "entry": {
                          "window": {
                            "start": "09:30",
                            "end": "13:30"
                          },
                          "source": {
                            "type": "conditions@1",
                            "when": "rsi(14, '5m') > 60"
                          }
                        },
                        "risk": {},
                        "adjustments": [
                          {
                            "type": "delta_hedge@1",
                            "when": "abs(net.delta) > 0.5",
                            "with": "future",
                            "target": 0.1,
                            "min_interval_s": 300,
                            "max_per_cycle": 3
                          }
                        ]
                      }
                    }
                  }
                },
                "newer_format": {
                  "summary": "A file made for a newer format",
                  "value": {
                    "document": {
                      "schema_version": 3,
                      "kind": "cirrus.strategy",
                      "metadata": {
                        "name": "x",
                        "tags": [
                          "weekly"
                        ]
                      },
                      "spec": {
                        "underlying": {
                          "name": "NIFTY",
                          "exchange": "NFO"
                        },
                        "legs": {
                          "selector": "chain@1",
                          "items": [
                            {
                              "id": "sc",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "call",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            },
                            {
                              "id": "sp",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "put",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            }
                          ]
                        },
                        "entry": {
                          "window": {
                            "start": "09:30",
                            "end": "13:30"
                          }
                        },
                        "risk": {
                          "combined": {
                            "type": "combined@1",
                            "stop_loss": {
                              "rupees": 3000
                            },
                            "target": {
                              "rupees": 2000
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "success": {
                  "summary": "A clean document: summary and hash",
                  "value": {
                    "document": {
                      "schema_version": 1,
                      "kind": "cirrus.strategy",
                      "metadata": {
                        "name": "NIFTY straddle",
                        "tags": [
                          "weekly"
                        ]
                      },
                      "spec": {
                        "underlying": {
                          "name": "NIFTY",
                          "exchange": "NFO"
                        },
                        "legs": {
                          "selector": "chain@1",
                          "items": [
                            {
                              "id": "sc",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "call",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            },
                            {
                              "id": "sp",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "put",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            }
                          ]
                        },
                        "entry": {
                          "window": {
                            "start": "09:30",
                            "end": "13:30"
                          }
                        },
                        "risk": {
                          "combined": {
                            "type": "combined@1",
                            "stop_loss": {
                              "rupees": 3000
                            },
                            "target": {
                              "rupees": 2000
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "What the check found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStrategyValidation"
                },
                "examples": {
                  "blockers_and_warnings": {
                    "summary": "Saved but not deployable; a warning to acknowledge",
                    "value": {
                      "status": "success",
                      "data": {
                        "ok": true,
                        "deployable": false,
                        "schema_version": 1,
                        "migrated_from": null,
                        "errors": [],
                        "blockers": [
                          {
                            "field": "spec.entry.source.when",
                            "label": "When · Entry",
                            "message": "`rsi(14, '5m') > 60` uses rsi, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                            "code": "not_available_yet",
                            "needs_ack": false
                          },
                          {
                            "field": "spec.adjustments[0].when",
                            "label": "Protect · Adjustment",
                            "message": "`abs(net.delta) > 0.5` uses net.delta, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                            "code": "not_available_yet",
                            "needs_ack": false
                          }
                        ],
                        "warnings": [
                          {
                            "field": "spec.risk.combined.stop_loss",
                            "label": "Protect · Combined protection",
                            "message": "Combined stop is missing for a short option: your loss would be unlimited.",
                            "code": "unlimited_loss",
                            "needs_ack": true
                          }
                        ],
                        "needs_ack": [
                          "unlimited_loss"
                        ],
                        "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter when rsi(14, '5m') > 60 (checked at each bar close), between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: no combined stop or target; no per-leg stops; at most 3 trades a day. No re-entries. Adjust: hedge the net delta when abs(net.delta) > 0.5.",
                        "compiled_hash": "sha256:650ddfdbbe519dbc38b434980bce7d9e9629ef1c21c4dd30363112871eb0c0ef",
                        "components": [
                          "chain@1",
                          "combined@1",
                          "conditions@1",
                          "delta_hedge@1",
                          "fixed_lots@1",
                          "limits@1",
                          "per_leg@1",
                          "protected_limit@1"
                        ],
                        "warm_up": null
                      },
                      "error": null
                    }
                  },
                  "newer_format": {
                    "summary": "A file made for a newer format",
                    "value": {
                      "status": "success",
                      "data": {
                        "ok": false,
                        "deployable": false,
                        "schema_version": 1,
                        "migrated_from": null,
                        "errors": [
                          {
                            "field": "schema_version",
                            "label": "",
                            "message": "This file was made for a newer version (format 3); we support up to 1. Update the app or ask the author for an older export.",
                            "code": "newer_format",
                            "needs_ack": false
                          }
                        ],
                        "blockers": [],
                        "warnings": [],
                        "needs_ack": [],
                        "summary": null,
                        "compiled_hash": null,
                        "components": [],
                        "warm_up": null
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A clean document: summary and hash",
                    "value": {
                      "status": "success",
                      "data": {
                        "ok": true,
                        "deployable": true,
                        "schema_version": 1,
                        "migrated_from": null,
                        "errors": [],
                        "blockers": [],
                        "warnings": [],
                        "needs_ack": [],
                        "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "compiled_hash": "sha256:c030cdecce518bdf50067237a17de0b5508d3e962e743a87dd41e7df3ef01ff9",
                        "components": [
                          "chain@1",
                          "combined@1",
                          "conditions@1",
                          "fixed_lots@1",
                          "limits@1",
                          "per_leg@1",
                          "protected_limit@1"
                        ],
                        "warm_up": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "malformed_json": {
                    "summary": "An unknown body field",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `doc`, expected one of `document`, `definition`, `name`, `description`, `tags`, `revision`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_document`: the document could not be read at all (too large, not JSON / YAML, YAML anchors or tags).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unreadable": {
                    "summary": "YAML anchors are refused before parsing values",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_document",
                        "message": "The document is not accepted: anchors (&name) are not allowed in strategy documents (line 2, column 7).",
                        "field": "document"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited` (240 validations a minute, apart from dry-runs).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/dry-run": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Dry-run a strategy",
        "description": "What the strategy would do right now, without orders: wait (outside its window or days, or for a signal), enter (with the contracts it would pick from the live chain), skip (and why), or `cannot_decide` when something it needs is not available on this server yet (the strategy engine, live chain picking). Body: a document as for validate, or `strategy_id` (and `version`). The validation result is included.",
        "operationId": "dry_run_auto_strategy",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoDryRunInput"
              },
              "examples": {
                "success": {
                  "summary": "A document with problems would not run",
                  "value": {
                    "document": {
                      "schema_version": 1,
                      "kind": "cirrus.strategy",
                      "metadata": {
                        "name": "Broken",
                        "tags": [
                          "weekly"
                        ]
                      },
                      "spec": {
                        "underlying": {
                          "name": "NIFTY",
                          "exchange": "NFO"
                        },
                        "legs": {
                          "selector": "chain@1",
                          "items": [
                            {
                              "id": "sc",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "call",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            },
                            {
                              "id": "sp",
                              "instrument": "option",
                              "side": "sell",
                              "option_type": "put",
                              "expiry": {
                                "kind": "weekly"
                              },
                              "strike": {
                                "by": "atm"
                              }
                            }
                          ]
                        },
                        "entry": {
                          "window": {
                            "start": "14:00",
                            "end": "10:00"
                          }
                        },
                        "risk": {
                          "combined": {
                            "type": "combined@1",
                            "stop_loss": {
                              "rupees": 3000
                            },
                            "target": {
                              "rupees": 2000
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The decision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoDryRunResult"
                },
                "examples": {
                  "success": {
                    "summary": "A document with problems would not run",
                    "value": {
                      "status": "success",
                      "data": {
                        "decision": "invalid",
                        "text": "Would not run: fix the problems first.",
                        "legs": [],
                        "net_premium": null,
                        "validation": {
                          "ok": false,
                          "deployable": false,
                          "schema_version": 1,
                          "migrated_from": null,
                          "errors": [
                            {
                              "field": "spec.entry.window",
                              "label": "When · Entry · Window",
                              "message": "The entry window must start before it ends.",
                              "code": "invalid_combination",
                              "needs_ack": false
                            }
                          ],
                          "blockers": [],
                          "warnings": [],
                          "needs_ack": [],
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 14:00 and 10:00, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "compiled_hash": null,
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "warm_up": null
                        },
                        "analytics_note": "No analytics: no contracts were picked."
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "malformed_json": {
                    "summary": "An unknown body field",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `x`, expected one of `document`, `definition`, `name`, `description`, `tags`, `strategy_id`, `version`, `account`, `at`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found` or `version_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such strategy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited` (60 checks a minute).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/condition-values": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "A condition's values now",
        "description": "For the strategy builder: the indicator values a condition reads and whether it is true right now, e.g. `RSI(14,15m) = 62.3`. The condition is compiled, its symbols resolved and its values computed by the same code a running strategy uses (the document's `entry` / `exit` condition rules, the engine's indicators and evaluator), from recent history and the last price; nothing is saved and nothing trades. `true_now` is null when it cannot be known yet (`reason`): an indicator still warming up, no price yet, or a value only a running trade has (`cycle.minutes`). A crossing is true when it crossed at the last candle close; a hold is not waited for. Poll at most every few seconds while the builder shows it.",
        "operationId": "get_condition_values",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConditionValuesInput"
              },
              "examples": {
                "not_known_yet": {
                  "summary": "An exit condition only a running trade can answer: not known, and why",
                  "value": {
                    "when": "cycle.minutes > 30",
                    "underlying": {
                      "name": "NIFTY",
                      "exchange": "NFO"
                    },
                    "place": "exit"
                  }
                },
                "true_now": {
                  "summary": "A price condition that holds now",
                  "value": {
                    "when": "u.ltp > 24800",
                    "underlying": {
                      "name": "NIFTY",
                      "exchange": "NFO"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The condition now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_ConditionValues"
                },
                "examples": {
                  "not_known_yet": {
                    "summary": "An exit condition only a running trade can answer: not known, and why",
                    "value": {
                      "status": "success",
                      "data": {
                        "true_now": null,
                        "status": "ok",
                        "reason": "cycle.minutes is known only while a trade is open",
                        "on": "tick",
                        "at": "2026-10-20T10:33:10.157Z",
                        "values": []
                      },
                      "error": null
                    }
                  },
                  "true_now": {
                    "summary": "A price condition that holds now",
                    "value": {
                      "status": "success",
                      "data": {
                        "true_now": true,
                        "status": "ok",
                        "reason": null,
                        "on": "tick",
                        "at": "2026-10-20T10:33:10.156Z",
                        "values": []
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: the condition does not compile (`field` `when`, with the engine's words), or a symbol isn't in today's instrument list (`underlying`, `watch.<name>`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid": {
                    "summary": "A condition that does not compile",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "condition ends too early (at byte 7)",
                        "field": "when"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited` (120 a minute).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: the instrument list is not loaded yet; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/components": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List strategy components",
        "description": "Every component type a strategy can use (sources, leg selectors, sizers, executors, risk rules, adjusters, notifiers), each with its parameters' JSON Schema, release status and phase, and whether a version using it can be deployed now. The wizard, import and validation read this one list.",
        "operationId": "list_auto_strategy_components",
        "responses": {
          "200": {
            "description": "The registry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoStrategyComponent"
                },
                "examples": {
                  "success": {
                    "summary": "The component registry",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "id": "conditions@1",
                          "name": "conditions",
                          "major": 1,
                          "slots": [
                            "entry_source",
                            "exit_source"
                          ],
                          "label": "Conditions",
                          "explain": "Indicators, prices and time, checked by the server.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "conditions@1"
                              },
                              "when": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2048,
                                    "x-expression": true
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Condition",
                                "description": "Leave empty to enter as soon as the window opens (time-only).",
                                "default": null
                              },
                              "on": {
                                "enum": [
                                  "close",
                                  "tick"
                                ],
                                "x-labels": {
                                  "close": "At each candle close",
                                  "tick": "On every price change"
                                },
                                "title": "Checked on",
                                "description": "close: at each bar close (default); tick: on every price change.",
                                "default": "close"
                              },
                              "hold_s": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 300,
                                "title": "Hold for",
                                "description": "Seconds the condition must stay true before it counts.",
                                "default": 0
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Conditions",
                            "description": "Indicators, prices and time, checked by the server.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "manual@1",
                          "name": "manual",
                          "major": 1,
                          "slots": [
                            "entry_source",
                            "exit_source"
                          ],
                          "label": "Manual",
                          "explain": "You decide when, with a button in the app.",
                          "group": "You",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "manual@1"
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Manual",
                            "description": "You decide when, with a button in the app.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "api@1",
                          "name": "api",
                          "major": 1,
                          "slots": [
                            "entry_source",
                            "exit_source"
                          ],
                          "label": "Your code (API)",
                          "explain": "Your program sends enter or exit signals to the API.",
                          "group": "You",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "api@1"
                              },
                              "max_signal_age_s": {
                                "type": "integer",
                                "minimum": 30,
                                "maximum": 120,
                                "title": "Refuse signals older than (seconds)",
                                "default": 30
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Your code (API)",
                            "description": "Your program sends enter or exit signals to the API.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "webhook@1",
                          "name": "webhook",
                          "major": 1,
                          "slots": [
                            "entry_source",
                            "exit_source"
                          ],
                          "label": "Alerts (signal URL)",
                          "explain": "Alerts from a charting or screener tool, on a signal URL chosen at deploy.",
                          "group": "Alerts",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "webhook@1"
                              },
                              "trigger_only": {
                                "type": "boolean",
                                "title": "The alert only starts the entry or exit",
                                "description": "On: the strategy trades its own legs and the alert only says when. Off: use legs from the signal (from_signal@1) so the alert's instruments are traded.",
                                "default": false
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Alerts (signal URL)",
                            "description": "Alerts from a charting or screener tool, on a signal URL chosen at deploy.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "chain@1",
                          "name": "chain",
                          "major": 1,
                          "slots": [
                            "legs"
                          ],
                          "label": "From the option chain",
                          "explain": "Contracts picked from the live chain when the entry fires.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": false,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "selector": {
                                "const": "chain@1"
                              },
                              "items": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                      "title": "Leg id",
                                      "description": "Short name other fields refer to (sc, lp, fut)."
                                    },
                                    "instrument": {
                                      "enum": [
                                        "option",
                                        "future",
                                        "stock"
                                      ],
                                      "x-labels": {
                                        "option": "Option",
                                        "future": "Future",
                                        "stock": "Stock"
                                      },
                                      "title": "Instrument"
                                    },
                                    "side": {
                                      "enum": [
                                        "buy",
                                        "sell"
                                      ],
                                      "x-labels": {
                                        "buy": "Buy",
                                        "sell": "Sell"
                                      },
                                      "title": "Side"
                                    },
                                    "option_type": {
                                      "anyOf": [
                                        {
                                          "enum": [
                                            "call",
                                            "put"
                                          ],
                                          "x-labels": {
                                            "call": "Call",
                                            "put": "Put"
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ],
                                      "title": "Option type",
                                      "default": null
                                    },
                                    "expiry": {
                                      "anyOf": [
                                        {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "enum": [
                                                    "weekly",
                                                    "monthly"
                                                  ],
                                                  "x-labels": {
                                                    "weekly": "Weekly",
                                                    "monthly": "Monthly"
                                                  },
                                                  "title": "Expiry"
                                                },
                                                "n": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "maximum": 12,
                                                  "title": "Which one",
                                                  "description": "0 is the current expiry, 1 the next.",
                                                  "default": 0
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "min_dte": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "maximum": 90,
                                                  "title": "At least days to expiry"
                                                }
                                              },
                                              "required": [
                                                "min_dte"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "date": {
                                                  "type": "string",
                                                  "format": "date",
                                                  "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
                                                  "title": "Expiry date"
                                                }
                                              },
                                              "required": [
                                                "date"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ],
                                      "title": "Expiry",
                                      "default": null
                                    },
                                    "strike": {
                                      "anyOf": [
                                        {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "by": {
                                                  "const": "atm"
                                                },
                                                "offset": {
                                                  "type": "integer",
                                                  "minimum": -20,
                                                  "maximum": 20,
                                                  "title": "Strikes from ATM",
                                                  "description": "Positive is out of the money for calls and puts alike.",
                                                  "default": 0
                                                }
                                              },
                                              "additionalProperties": false,
                                              "required": [
                                                "by"
                                              ],
                                              "title": "At the money"
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "by": {
                                                  "const": "pct_otm"
                                                },
                                                "pct": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 20,
                                                  "title": "Percent OTM"
                                                }
                                              },
                                              "additionalProperties": false,
                                              "required": [
                                                "by",
                                                "pct"
                                              ],
                                              "title": "Percent out of the money"
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "by": {
                                                  "const": "delta"
                                                },
                                                "delta": {
                                                  "type": "number",
                                                  "minimum": 0.05,
                                                  "maximum": 0.5,
                                                  "title": "Delta",
                                                  "description": "Absolute delta; the sign follows the option type."
                                                }
                                              },
                                              "additionalProperties": false,
                                              "required": [
                                                "by",
                                                "delta"
                                              ],
                                              "title": "Delta"
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "by": {
                                                  "const": "premium"
                                                },
                                                "premium": {
                                                  "type": "number",
                                                  "exclusiveMinimum": 0,
                                                  "maximum": 100000,
                                                  "title": "Premium"
                                                },
                                                "mode": {
                                                  "enum": [
                                                    "nearest",
                                                    "at_least",
                                                    "at_most"
                                                  ],
                                                  "x-labels": {
                                                    "nearest": "Nearest to",
                                                    "at_least": "At least",
                                                    "at_most": "At most"
                                                  },
                                                  "title": "Match",
                                                  "default": "nearest"
                                                }
                                              },
                                              "additionalProperties": false,
                                              "required": [
                                                "by",
                                                "premium"
                                              ],
                                              "title": "Premium"
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "by": {
                                                  "const": "expected_move"
                                                },
                                                "k": {
                                                  "type": "number",
                                                  "minimum": 0.5,
                                                  "maximum": 3,
                                                  "title": "Times the expected move"
                                                }
                                              },
                                              "additionalProperties": false,
                                              "required": [
                                                "by",
                                                "k"
                                              ],
                                              "title": "Expected move",
                                              "x-phase": "b"
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "by": {
                                                  "const": "relative"
                                                },
                                                "to": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                                  "title": "Relative to leg"
                                                },
                                                "width_strikes": {
                                                  "anyOf": [
                                                    {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 50
                                                    },
                                                    {
                                                      "type": "null"
                                                    }
                                                  ],
                                                  "title": "Width in strikes",
                                                  "default": null
                                                },
                                                "width_points": {
                                                  "anyOf": [
                                                    {
                                                      "type": "number",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 100000
                                                    },
                                                    {
                                                      "type": "null"
                                                    }
                                                  ],
                                                  "title": "Width in points",
                                                  "default": null
                                                }
                                              },
                                              "additionalProperties": false,
                                              "required": [
                                                "by",
                                                "to"
                                              ],
                                              "title": "Relative to another leg"
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "by": {
                                                  "const": "strike"
                                                },
                                                "strike": {
                                                  "type": "number",
                                                  "exclusiveMinimum": 0,
                                                  "maximum": 10000000,
                                                  "title": "Strike"
                                                }
                                              },
                                              "additionalProperties": false,
                                              "required": [
                                                "by",
                                                "strike"
                                              ],
                                              "title": "Exact strike"
                                            }
                                          ]
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ],
                                      "title": "Strike",
                                      "default": null
                                    },
                                    "lots": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 100,
                                      "title": "Lots",
                                      "description": "A ratio: sizing multiplies it.",
                                      "default": 1
                                    },
                                    "hedge_for": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,15}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ],
                                      "title": "Hedge for leg",
                                      "description": "The short leg this bought option protects (paired automatically when empty).",
                                      "default": null
                                    },
                                    "risk": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "stop_loss": {
                                              "anyOf": [
                                                {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "pct": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 1000,
                                                          "title": "Percent"
                                                        }
                                                      },
                                                      "required": [
                                                        "pct"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "points": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 100000,
                                                          "title": "Points"
                                                        }
                                                      },
                                                      "required": [
                                                        "points"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "price": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 10000000,
                                                          "title": "Price"
                                                        }
                                                      },
                                                      "required": [
                                                        "price"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ],
                                              "title": "Stop loss",
                                              "default": null
                                            },
                                            "target": {
                                              "anyOf": [
                                                {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "pct": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 1000,
                                                          "title": "Percent"
                                                        }
                                                      },
                                                      "required": [
                                                        "pct"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "points": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 100000,
                                                          "title": "Points"
                                                        }
                                                      },
                                                      "required": [
                                                        "points"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "price": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 10000000,
                                                          "title": "Price"
                                                        }
                                                      },
                                                      "required": [
                                                        "price"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ],
                                              "title": "Target",
                                              "default": null
                                            },
                                            "trail": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "step": {
                                                      "type": "number",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 100000,
                                                      "title": "Every"
                                                    },
                                                    "move_by": {
                                                      "type": "number",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 100000,
                                                      "title": "Move the stop by"
                                                    }
                                                  },
                                                  "required": [
                                                    "step",
                                                    "move_by"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ],
                                              "title": "Trailing stop",
                                              "default": null
                                            }
                                          },
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ],
                                      "title": "Leg protection",
                                      "description": "Overrides the per-leg protection for this leg.",
                                      "default": null
                                    },
                                    "liquidity": {
                                      "type": "object",
                                      "properties": {
                                        "max_spread_pct": {
                                          "type": "number",
                                          "minimum": 0.1,
                                          "maximum": 10,
                                          "title": "Widest price gap (percent of mid)",
                                          "default": 3
                                        },
                                        "min_oi": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000000,
                                          "title": "Least open interest",
                                          "default": 0
                                        },
                                        "min_premium": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 10000,
                                          "title": "Least premium for a short",
                                          "default": 1
                                        }
                                      },
                                      "additionalProperties": false,
                                      "title": "Liquidity guard",
                                      "default": {}
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "instrument",
                                    "side"
                                  ],
                                  "additionalProperties": false
                                },
                                "minItems": 1,
                                "maxItems": 6,
                                "title": "Legs"
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "selector",
                              "items"
                            ],
                            "title": "From the option chain",
                            "description": "Contracts picked from the live chain when the entry fires.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "fixed@1",
                          "name": "fixed",
                          "major": 1,
                          "slots": [
                            "legs"
                          ],
                          "label": "Exact contracts",
                          "explain": "The contracts you name, every cycle.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": false,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "selector": {
                                "const": "fixed@1"
                              },
                              "items": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                      "title": "Leg id"
                                    },
                                    "symbol": {
                                      "type": "string",
                                      "pattern": "^([A-Z0-9_]+:[A-Za-z0-9 &_.-]+|@future\\([A-Z0-9&_-]{1,32}, ?[0-3]\\))$",
                                      "maxLength": 64,
                                      "title": "Contract",
                                      "description": "EXCHANGE:SYMBOL, e.g. NFO:NIFTY26OCT23400CE."
                                    },
                                    "side": {
                                      "enum": [
                                        "buy",
                                        "sell"
                                      ],
                                      "x-labels": {
                                        "buy": "Buy",
                                        "sell": "Sell"
                                      },
                                      "title": "Side"
                                    },
                                    "lots": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 100,
                                      "title": "Lots",
                                      "default": 1
                                    },
                                    "hedge_for": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,15}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ],
                                      "title": "Hedge for leg",
                                      "default": null
                                    },
                                    "risk": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "stop_loss": {
                                              "anyOf": [
                                                {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "pct": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 1000,
                                                          "title": "Percent"
                                                        }
                                                      },
                                                      "required": [
                                                        "pct"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "points": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 100000,
                                                          "title": "Points"
                                                        }
                                                      },
                                                      "required": [
                                                        "points"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "price": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 10000000,
                                                          "title": "Price"
                                                        }
                                                      },
                                                      "required": [
                                                        "price"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ],
                                              "title": "Stop loss",
                                              "default": null
                                            },
                                            "target": {
                                              "anyOf": [
                                                {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "pct": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 1000,
                                                          "title": "Percent"
                                                        }
                                                      },
                                                      "required": [
                                                        "pct"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "points": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 100000,
                                                          "title": "Points"
                                                        }
                                                      },
                                                      "required": [
                                                        "points"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "price": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 10000000,
                                                          "title": "Price"
                                                        }
                                                      },
                                                      "required": [
                                                        "price"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ],
                                              "title": "Target",
                                              "default": null
                                            },
                                            "trail": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "step": {
                                                      "type": "number",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 100000,
                                                      "title": "Every"
                                                    },
                                                    "move_by": {
                                                      "type": "number",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 100000,
                                                      "title": "Move the stop by"
                                                    }
                                                  },
                                                  "required": [
                                                    "step",
                                                    "move_by"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ],
                                              "title": "Trailing stop",
                                              "default": null
                                            }
                                          },
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ],
                                      "title": "Leg protection",
                                      "default": null
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "symbol",
                                    "side"
                                  ],
                                  "additionalProperties": false
                                },
                                "minItems": 1,
                                "maxItems": 6,
                                "title": "Legs"
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "selector",
                              "items"
                            ],
                            "title": "Exact contracts",
                            "description": "The contracts you name, every cycle.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "from_signal@1",
                          "name": "from_signal",
                          "major": 1,
                          "slots": [
                            "legs"
                          ],
                          "label": "From the signal",
                          "explain": "The alert names what to trade (Chartink stocks, a TradingView alert's instrument); only allowed ones, within your limits.",
                          "group": "Alerts",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "selector": {
                                "const": "from_signal@1"
                              },
                              "underlyings": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "pattern": "^[A-Z0-9&_-]{1,32}$"
                                },
                                "maxItems": 20,
                                "title": "Allowed underlyings",
                                "description": "Only these are traded; empty: any the alert names.",
                                "default": []
                              },
                              "max_lots": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100,
                                "title": "At most lots per leg",
                                "default": 1
                              },
                              "instrument": {
                                "enum": [
                                  "signal",
                                  "stock",
                                  "future",
                                  "option"
                                ],
                                "x-labels": {
                                  "signal": "As the alert says",
                                  "stock": "The stock",
                                  "future": "Its nearest future",
                                  "option": "Its nearest option"
                                },
                                "title": "Trade each one as",
                                "description": "signal: as the alert says (a scanned stock is the stock); stock; future: its nearest monthly future; option: its nearest monthly option at ATM ± offset.",
                                "default": "signal"
                              },
                              "side": {
                                "enum": [
                                  "signal",
                                  "buy",
                                  "sell"
                                ],
                                "x-labels": {
                                  "signal": "As the alert says",
                                  "buy": "Buy",
                                  "sell": "Sell"
                                },
                                "title": "Side",
                                "description": "signal: as the alert says (TradingView leg, Chartink buy / sell).",
                                "default": "signal"
                              },
                              "option_type": {
                                "enum": [
                                  "call",
                                  "put"
                                ],
                                "x-labels": {
                                  "call": "Call",
                                  "put": "Put"
                                },
                                "title": "Option type",
                                "default": "call"
                              },
                              "strike_offset": {
                                "type": "integer",
                                "minimum": -20,
                                "maximum": 20,
                                "title": "Strikes from ATM",
                                "default": 0
                              },
                              "lots": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100000,
                                "title": "Lots per instrument (shares for a stock)",
                                "description": "What the strategy's fixed sizing multiplies; the signal's own size with from_signal sizing.",
                                "default": 1
                              },
                              "max_shares": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100000,
                                "title": "At most shares per stock",
                                "default": 1000
                              },
                              "max_per_alert": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 6,
                                "title": "At most instruments per alert",
                                "default": 5
                              },
                              "max_per_day": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 50,
                                "title": "At most instruments per day",
                                "description": "Each instrument is traded at most once a day.",
                                "default": 10
                              },
                              "skip_held": {
                                "type": "boolean",
                                "title": "Skip what the account already holds",
                                "default": true
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "selector"
                            ],
                            "title": "From the signal",
                            "description": "The alert names what to trade (Chartink stocks, a TradingView alert's instrument); only allowed ones, within your limits.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "fixed_lots@1",
                          "name": "fixed_lots",
                          "major": 1,
                          "slots": [
                            "sizing"
                          ],
                          "label": "Fixed lots",
                          "explain": "The same lots every cycle.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "fixed_lots@1"
                              },
                              "max_lots": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100,
                                "title": "At most lots per leg",
                                "default": 10
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Fixed lots",
                            "description": "The same lots every cycle.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "max_premium@1",
                          "name": "max_premium",
                          "major": 1,
                          "slots": [
                            "sizing"
                          ],
                          "label": "Premium cap",
                          "explain": "Fewer lots when premiums are high, so each cycle stays under a cap.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": false,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "max_premium@1"
                              },
                              "max_premium": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "maximum": 100000000,
                                "title": "Most premium per cycle"
                              },
                              "max_lots": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100,
                                "title": "At most lots per leg",
                                "default": 10
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "max_premium"
                            ],
                            "title": "Premium cap",
                            "description": "Fewer lots when premiums are high, so each cycle stays under a cap.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "risk@1",
                          "name": "risk",
                          "major": 1,
                          "slots": [
                            "sizing"
                          ],
                          "label": "Risk per trade",
                          "explain": "Lots from the most you are willing to lose per trade.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": false,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "risk@1"
                              },
                              "risk_rupees": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "maximum": 100000000,
                                "title": "Risk per trade"
                              },
                              "max_lots": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100,
                                "title": "At most lots per leg",
                                "default": 10
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "risk_rupees"
                            ],
                            "title": "Risk per trade",
                            "description": "Lots from the most you are willing to lose per trade.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "capital_pct@1",
                          "name": "capital_pct",
                          "major": 1,
                          "slots": [
                            "sizing"
                          ],
                          "label": "Percent of capital",
                          "explain": "Lots from a share of your available margin.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": false,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "capital_pct@1"
                              },
                              "capital_pct": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "maximum": 100,
                                "title": "Percent of available margin"
                              },
                              "max_lots": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100,
                                "title": "At most lots per leg",
                                "default": 10
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "capital_pct"
                            ],
                            "title": "Percent of capital",
                            "description": "Lots from a share of your available margin.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "from_signal@1",
                          "name": "from_signal",
                          "major": 1,
                          "slots": [
                            "sizing"
                          ],
                          "label": "From the signal",
                          "explain": "The signal says how much (a TradingView leg's lots or amount, a Chartink strategy's quantity or amount per stock), up to a cap. Only with legs from the signal.",
                          "group": "Alerts",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "from_signal@1"
                              },
                              "max_lots": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100,
                                "title": "At most lots per leg",
                                "default": 10
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "From the signal",
                            "description": "The signal says how much (a TradingView leg's lots or amount, a Chartink strategy's quantity or amount per stock), up to a cap. Only with legs from the signal.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "protected_limit@1",
                          "name": "protected_limit",
                          "major": 1,
                          "slots": [
                            "execution"
                          ],
                          "label": "Protected limit",
                          "explain": "Limit orders a little beyond the market, re-priced until filled or the slippage cap.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "protected_limit@1"
                              },
                              "order": {
                                "enum": [
                                  "auto",
                                  "hedge_first",
                                  "simultaneous",
                                  "stagger"
                                ],
                                "x-labels": {
                                  "auto": "Automatic",
                                  "hedge_first": "Hedges first",
                                  "simultaneous": "All legs together",
                                  "stagger": "One after another"
                                },
                                "title": "Order of legs",
                                "description": "auto: hedges first when a bought option protects a sold one, else together.",
                                "default": "auto"
                              },
                              "hedge_wait_ms": {
                                "type": "integer",
                                "minimum": 1000,
                                "maximum": 30000,
                                "title": "Wait for hedges (ms)",
                                "default": 5000
                              },
                              "stagger_ms": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 60000,
                                "title": "Gap between legs (ms)",
                                "default": 0
                              },
                              "buffer_pct": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 3,
                                "title": "Price buffer (percent)",
                                "default": 0.5
                              },
                              "chase": {
                                "type": "object",
                                "properties": {
                                  "every_ms": {
                                    "type": "integer",
                                    "minimum": 200,
                                    "maximum": 10000,
                                    "title": "Re-price every (ms)",
                                    "default": 1000
                                  },
                                  "max_slippage_pct": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 5,
                                    "title": "Most slippage (percent)",
                                    "default": 1
                                  },
                                  "max_attempts": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 50,
                                    "title": "Most re-prices",
                                    "default": 10
                                  }
                                },
                                "additionalProperties": false,
                                "title": "Chase",
                                "default": {}
                              },
                              "on_incomplete": {
                                "enum": [
                                  "safest",
                                  "keep_and_manage",
                                  "close_opened"
                                ],
                                "x-labels": {
                                  "safest": "Do the safest thing",
                                  "keep_and_manage": "Keep and manage what filled",
                                  "close_opened": "Close what filled"
                                },
                                "title": "If only some legs fill",
                                "description": "safest: close a sold option left without its hedge at once, keep and manage the rest.",
                                "default": "safest"
                              },
                              "exit": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "buffer_pct": {
                                        "anyOf": [
                                          {
                                            "type": "number",
                                            "minimum": 0,
                                            "maximum": 5
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "title": "Exit price buffer (percent)",
                                        "description": "Not set: the entry buffer.",
                                        "default": null
                                      },
                                      "chase": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "every_ms": {
                                                "anyOf": [
                                                  {
                                                    "type": "integer",
                                                    "minimum": 200,
                                                    "maximum": 10000
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ],
                                                "title": "Re-price exits every (ms)",
                                                "default": null
                                              },
                                              "max_slippage_pct": {
                                                "anyOf": [
                                                  {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 10
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ],
                                                "title": "Most exit slippage per placement (percent)",
                                                "default": null
                                              },
                                              "max_attempts": {
                                                "anyOf": [
                                                  {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 50
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ],
                                                "title": "Most exit re-prices per placement",
                                                "default": null
                                              }
                                            },
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "title": "Exit chase",
                                        "description": "Each setting not given is the entry chase's.",
                                        "default": null
                                      },
                                      "retry_every_ms": {
                                        "type": "integer",
                                        "minimum": 2000,
                                        "maximum": 60000,
                                        "title": "Place an unfilled exit again every (ms)",
                                        "description": "A refused or unfilled remainder is placed again from a fresh position read.",
                                        "default": 10000
                                      },
                                      "market_after_s": {
                                        "anyOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 30,
                                            "maximum": 900
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "title": "Send at market after (seconds)",
                                        "description": "Off unless set: an exit still not filled this long after it started sends the remainder as a market order (with the broker's market protection), in market hours only, once per leg.",
                                        "default": null
                                      },
                                      "escalate": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "telegram_s": {
                                                "type": "integer",
                                                "minimum": 30,
                                                "maximum": 3600,
                                                "title": "Telegram after (seconds)",
                                                "default": 60
                                              },
                                              "all_channels_s": {
                                                "type": "integer",
                                                "minimum": 60,
                                                "maximum": 7200,
                                                "title": "Every channel after (seconds)",
                                                "default": 180
                                              },
                                              "ops_s": {
                                                "type": "integer",
                                                "minimum": 120,
                                                "maximum": 14400,
                                                "title": "Page operators after (seconds)",
                                                "default": 600
                                              }
                                            },
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "title": "Tell me when an exit is not filling",
                                        "description": "Seconds since the exit started; each must be later than the one before.",
                                        "default": null
                                      }
                                    },
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Exit orders",
                                "description": "Overrides for exit orders; absent, exits are priced and chased like entries.",
                                "default": null
                              },
                              "retry_next_signal": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Try again on the next signal (times)",
                                "description": "Entries are never re-sent; a refused entry may be tried again on the next signal, at most this many times, then no more trades that day (0: none). Not set: a refused entry is tried again after a short wait.",
                                "default": null
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Protected limit",
                            "description": "Limit orders a little beyond the market, re-priced until filled or the slippage cap.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "per_leg@1",
                          "name": "per_leg",
                          "major": 1,
                          "slots": [
                            "per_leg"
                          ],
                          "label": "Per-leg protection",
                          "explain": "A stop, target or trailing stop on every leg.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "per_leg@1"
                              },
                              "stop_loss": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "required": [
                                          "pct"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "points": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000,
                                            "title": "Points"
                                          }
                                        },
                                        "required": [
                                          "points"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "price": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 10000000,
                                            "title": "Price"
                                          }
                                        },
                                        "required": [
                                          "price"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Stop loss",
                                "default": null
                              },
                              "target": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "required": [
                                          "pct"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "points": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000,
                                            "title": "Points"
                                          }
                                        },
                                        "required": [
                                          "points"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "price": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 10000000,
                                            "title": "Price"
                                          }
                                        },
                                        "required": [
                                          "price"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Target",
                                "default": null
                              },
                              "trail": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "step": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 100000,
                                        "title": "Every"
                                      },
                                      "move_by": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 100000,
                                        "title": "Move the stop by"
                                      }
                                    },
                                    "required": [
                                      "step",
                                      "move_by"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Trailing stop",
                                "default": null
                              },
                              "on_leg_stop": {
                                "enum": [
                                  "nothing",
                                  "move_others_to_cost",
                                  "exit_all"
                                ],
                                "x-labels": {
                                  "nothing": "Do nothing",
                                  "move_others_to_cost": "Move the other legs' stops to cost",
                                  "exit_all": "Exit every leg"
                                },
                                "title": "When a leg stops",
                                "description": "move_others_to_cost: the other legs' stops move to their entry price.",
                                "default": "nothing"
                              },
                              "at_broker": {
                                "type": "boolean",
                                "title": "Also place stops at the broker",
                                "description": "Live accounts only: a broker-held stop protects the leg if the server is unreachable.",
                                "default": false
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Per-leg protection",
                            "description": "A stop, target or trailing stop on every leg.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "combined@1",
                          "name": "combined",
                          "major": 1,
                          "slots": [
                            "combined"
                          ],
                          "label": "Combined protection",
                          "explain": "A stop and target on the whole trade; when hit, every leg closes, hedges last.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "combined@1"
                              },
                              "scope": {
                                "enum": [
                                  "account",
                                  "deployment"
                                ],
                                "x-labels": {
                                  "account": "Each account",
                                  "deployment": "The whole deployment"
                                },
                                "title": "Applies to",
                                "description": "account: each account's own P&L; deployment: the sum over every account.",
                                "default": "account"
                              },
                              "basis": {
                                "enum": [
                                  "rupees",
                                  "pct_premium",
                                  "pct_margin"
                                ],
                                "x-labels": {
                                  "rupees": "Rupees",
                                  "pct_premium": "% of premium",
                                  "pct_margin": "% of margin"
                                },
                                "title": "Measured in",
                                "default": "rupees"
                              },
                              "stop_loss": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "required": [
                                          "rupees"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "pct_premium": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent of entry premium"
                                          }
                                        },
                                        "required": [
                                          "pct_premium"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "pct_margin": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent of margin",
                                            "x-phase": "b"
                                          }
                                        },
                                        "required": [
                                          "pct_margin"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Combined stop",
                                "default": null
                              },
                              "target": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "required": [
                                          "rupees"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "pct_premium": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent of entry premium"
                                          }
                                        },
                                        "required": [
                                          "pct_premium"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "pct_margin": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent of margin",
                                            "x-phase": "b"
                                          }
                                        },
                                        "required": [
                                          "pct_margin"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Combined target",
                                "default": null
                              },
                              "breakeven": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "at_rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "At a profit of (rupees)"
                                          }
                                        },
                                        "required": [
                                          "at_rupees"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "at_pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "At a profit of (percent)"
                                          }
                                        },
                                        "required": [
                                          "at_pct"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Move the stop to cost",
                                "default": null
                              },
                              "trail": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "arm_at": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 100000000,
                                        "title": "Start trailing at"
                                      },
                                      "giveback": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 100000000,
                                        "title": "Give back at most"
                                      },
                                      "step": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 100000000,
                                        "title": "Raise every"
                                      }
                                    },
                                    "required": [
                                      "arm_at",
                                      "giveback",
                                      "step"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Trailing profit",
                                "default": null
                              },
                              "lock_ladder": {
                                "type": "array",
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "at": {
                                          "type": "number",
                                          "exclusiveMinimum": 0,
                                          "maximum": 100000000,
                                          "title": "At a profit of"
                                        },
                                        "lock": {
                                          "type": "number",
                                          "exclusiveMinimum": 0,
                                          "maximum": 100000000,
                                          "title": "Lock"
                                        }
                                      },
                                      "required": [
                                        "at",
                                        "lock"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "at_pct": {
                                          "type": "number",
                                          "exclusiveMinimum": 0,
                                          "maximum": 1000,
                                          "title": "At a profit of (percent)"
                                        },
                                        "lock_pct": {
                                          "type": "number",
                                          "exclusiveMinimum": 0,
                                          "maximum": 1000,
                                          "title": "Lock (percent)"
                                        }
                                      },
                                      "required": [
                                        "at_pct",
                                        "lock_pct"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "maxItems": 10,
                                "title": "Profit lock ladder",
                                "default": []
                              },
                              "deployment": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "stop_loss": {
                                        "anyOf": [
                                          {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "rupees": {
                                                    "type": "number",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 100000000,
                                                    "title": "Rupees"
                                                  }
                                                },
                                                "required": [
                                                  "rupees"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "pct_premium": {
                                                    "type": "number",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 1000,
                                                    "title": "Percent of entry premium"
                                                  }
                                                },
                                                "required": [
                                                  "pct_premium"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "pct_margin": {
                                                    "type": "number",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 1000,
                                                    "title": "Percent of margin",
                                                    "x-phase": "b"
                                                  }
                                                },
                                                "required": [
                                                  "pct_margin"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "title": "Combined stop",
                                        "default": null
                                      },
                                      "target": {
                                        "anyOf": [
                                          {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "rupees": {
                                                    "type": "number",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 100000000,
                                                    "title": "Rupees"
                                                  }
                                                },
                                                "required": [
                                                  "rupees"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "pct_premium": {
                                                    "type": "number",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 1000,
                                                    "title": "Percent of entry premium"
                                                  }
                                                },
                                                "required": [
                                                  "pct_premium"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "pct_margin": {
                                                    "type": "number",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 1000,
                                                    "title": "Percent of margin",
                                                    "x-phase": "b"
                                                  }
                                                },
                                                "required": [
                                                  "pct_margin"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "title": "Combined target",
                                        "default": null
                                      }
                                    },
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Across all accounts",
                                "description": "A second stop or target on the sum over every account of the deployment.",
                                "default": null
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Combined protection",
                            "description": "A stop and target on the whole trade; when hit, every leg closes, hedges last.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "limits@1",
                          "name": "limits",
                          "major": 1,
                          "slots": [
                            "limits"
                          ],
                          "label": "Daily limits",
                          "explain": "Your own limits per day: losses, profits, trades and orders.",
                          "group": "Built in",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "limits@1"
                              },
                              "max_loss_per_day": {
                                "anyOf": [
                                  {
                                    "type": "number",
                                    "exclusiveMinimum": 0,
                                    "maximum": 100000000
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Most loss a day",
                                "default": null
                              },
                              "max_profit_per_day": {
                                "anyOf": [
                                  {
                                    "type": "number",
                                    "exclusiveMinimum": 0,
                                    "maximum": 100000000
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Stop for the day at a profit of",
                                "default": null
                              },
                              "max_loss_per_week": {
                                "anyOf": [
                                  {
                                    "type": "number",
                                    "exclusiveMinimum": 0,
                                    "maximum": 100000000
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Most loss a week",
                                "default": null,
                                "x-phase": "b"
                              },
                              "max_cycles_per_day": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 20,
                                "title": "Most trades a day",
                                "default": 3
                              },
                              "max_open_trades": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10,
                                "title": "Most trades open at once",
                                "description": "Each entry (a time cycle, the conditions, an alert) opens its own trade with its own stops; the day's limits count them all. 1: one trade at a time.",
                                "default": 1
                              },
                              "max_orders_per_day": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 200,
                                "title": "Most orders a day",
                                "default": 50
                              },
                              "exit_on_limit": {
                                "type": "boolean",
                                "title": "Exit when a daily limit is hit",
                                "default": true
                              },
                              "on_breaker": {
                                "enum": [
                                  "nothing",
                                  "close_open_trade"
                                ],
                                "x-labels": {
                                  "nothing": "Do nothing",
                                  "close_open_trade": "Close the open trade"
                                },
                                "title": "If the circuit breaker trips",
                                "description": "close_open_trade: also close the open trade, mains first, hedges last.",
                                "default": "nothing"
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Daily limits",
                            "description": "Your own limits per day: losses, profits, trades and orders.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "close_leg@1",
                          "name": "close_leg",
                          "major": 1,
                          "slots": [
                            "adjustment"
                          ],
                          "label": "Close a leg",
                          "explain": "close one leg, for example the tested side",
                          "group": "Adjustments",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "close_leg@1"
                              },
                              "when": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2048,
                                    "x-expression": true
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Condition",
                                "description": "A condition in the trigger expression grammar, e.g. rsi(14, '5m') > 70. Give this or `trigger`.",
                                "default": null
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Loss reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Loss reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Profit reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Profit reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "elapsed"
                                          },
                                          "minutes": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 43200,
                                            "title": "Minutes"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "minutes"
                                        ],
                                        "title": "Time since entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "premium_ratio"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "ratio": {
                                            "type": "number",
                                            "minimum": 0.1,
                                            "maximum": 100,
                                            "title": "Times the entry price",
                                            "description": "2 is a sold leg whose premium doubled."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "ratio"
                                        ],
                                        "title": "A leg's price reaches a multiple of its entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "condition"
                                          },
                                          "when": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 2048,
                                            "x-expression": true,
                                            "title": "Condition"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "when"
                                        ],
                                        "title": "Indicator or condition"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "expiry"
                                          },
                                          "dte_at_most": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 30,
                                            "title": "At most days to expiry",
                                            "default": 0
                                          },
                                          "at": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ],
                                            "title": "From (time)",
                                            "default": null
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on"
                                        ],
                                        "title": "Days to expiry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "delta_band"
                                          },
                                          "band": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 10,
                                            "title": "Band (lots of delta)"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "band"
                                        ],
                                        "title": "Net delta outside a band"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "leg_delta"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "delta": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 1,
                                            "title": "Delta (absolute)",
                                            "description": "0.30: the leg's delta reached ±0.30."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "delta"
                                        ],
                                        "title": "A leg's delta reaches",
                                        "x-phase": "c"
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Trigger",
                                "description": "When the adjustment fires: the moment this turns true, not again while it stays true.",
                                "default": null
                              },
                              "leg": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,15}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Leg",
                                "description": "The leg to act on; or pick `target` instead.",
                                "default": null
                              },
                              "target": {
                                "anyOf": [
                                  {
                                    "enum": [
                                      "tested",
                                      "sold"
                                    ],
                                    "x-labels": {
                                      "tested": "The leg being tested",
                                      "sold": "All sold legs"
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Which legs",
                                "description": "tested: the sold leg whose price rose most against its entry; sold: every sold leg. Give this or `leg`.",
                                "default": null
                              },
                              "max_per_cycle": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10,
                                "title": "At most per cycle",
                                "default": 2
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Close a leg",
                            "description": "close one leg, for example the tested side",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "reduce@1",
                          "name": "reduce",
                          "major": 1,
                          "slots": [
                            "adjustment"
                          ],
                          "label": "Reduce",
                          "explain": "close a share of every leg, in whole lots",
                          "group": "Adjustments",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": false,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "reduce@1"
                              },
                              "when": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2048,
                                    "x-expression": true
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Condition",
                                "description": "A condition in the trigger expression grammar, e.g. rsi(14, '5m') > 70. Give this or `trigger`.",
                                "default": null
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Loss reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Loss reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Profit reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Profit reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "elapsed"
                                          },
                                          "minutes": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 43200,
                                            "title": "Minutes"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "minutes"
                                        ],
                                        "title": "Time since entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "premium_ratio"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "ratio": {
                                            "type": "number",
                                            "minimum": 0.1,
                                            "maximum": 100,
                                            "title": "Times the entry price",
                                            "description": "2 is a sold leg whose premium doubled."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "ratio"
                                        ],
                                        "title": "A leg's price reaches a multiple of its entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "condition"
                                          },
                                          "when": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 2048,
                                            "x-expression": true,
                                            "title": "Condition"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "when"
                                        ],
                                        "title": "Indicator or condition"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "expiry"
                                          },
                                          "dte_at_most": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 30,
                                            "title": "At most days to expiry",
                                            "default": 0
                                          },
                                          "at": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ],
                                            "title": "From (time)",
                                            "default": null
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on"
                                        ],
                                        "title": "Days to expiry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "delta_band"
                                          },
                                          "band": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 10,
                                            "title": "Band (lots of delta)"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "band"
                                        ],
                                        "title": "Net delta outside a band"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "leg_delta"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "delta": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 1,
                                            "title": "Delta (absolute)",
                                            "description": "0.30: the leg's delta reached ±0.30."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "delta"
                                        ],
                                        "title": "A leg's delta reaches",
                                        "x-phase": "c"
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Trigger",
                                "description": "When the adjustment fires: the moment this turns true, not again while it stays true.",
                                "default": null
                              },
                              "pct": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100,
                                "title": "Percent to close"
                              },
                              "target": {
                                "anyOf": [
                                  {
                                    "enum": [
                                      "tested",
                                      "sold"
                                    ],
                                    "x-labels": {
                                      "tested": "The leg being tested",
                                      "sold": "All sold legs"
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Which legs",
                                "description": "Only these legs: tested (the sold leg whose price rose most) or sold (every sold leg). Absent: every leg.",
                                "default": null
                              },
                              "max_per_cycle": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10,
                                "title": "At most per cycle",
                                "default": 2
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "pct"
                            ],
                            "title": "Reduce",
                            "description": "close a share of every leg, in whole lots",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "roll_strike@1",
                          "name": "roll_strike",
                          "major": 1,
                          "slots": [
                            "adjustment"
                          ],
                          "label": "Roll a strike",
                          "explain": "close a leg and open the same option at a new strike",
                          "group": "Adjustments",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": false,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "roll_strike@1"
                              },
                              "when": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2048,
                                    "x-expression": true
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Condition",
                                "description": "A condition in the trigger expression grammar, e.g. rsi(14, '5m') > 70. Give this or `trigger`.",
                                "default": null
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Loss reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Loss reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Profit reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Profit reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "elapsed"
                                          },
                                          "minutes": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 43200,
                                            "title": "Minutes"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "minutes"
                                        ],
                                        "title": "Time since entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "premium_ratio"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "ratio": {
                                            "type": "number",
                                            "minimum": 0.1,
                                            "maximum": 100,
                                            "title": "Times the entry price",
                                            "description": "2 is a sold leg whose premium doubled."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "ratio"
                                        ],
                                        "title": "A leg's price reaches a multiple of its entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "condition"
                                          },
                                          "when": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 2048,
                                            "x-expression": true,
                                            "title": "Condition"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "when"
                                        ],
                                        "title": "Indicator or condition"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "expiry"
                                          },
                                          "dte_at_most": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 30,
                                            "title": "At most days to expiry",
                                            "default": 0
                                          },
                                          "at": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ],
                                            "title": "From (time)",
                                            "default": null
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on"
                                        ],
                                        "title": "Days to expiry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "delta_band"
                                          },
                                          "band": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 10,
                                            "title": "Band (lots of delta)"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "band"
                                        ],
                                        "title": "Net delta outside a band"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "leg_delta"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "delta": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 1,
                                            "title": "Delta (absolute)",
                                            "description": "0.30: the leg's delta reached ±0.30."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "delta"
                                        ],
                                        "title": "A leg's delta reaches",
                                        "x-phase": "c"
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Trigger",
                                "description": "When the adjustment fires: the moment this turns true, not again while it stays true.",
                                "default": null
                              },
                              "leg": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,15}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Leg",
                                "description": "The leg to act on; or pick `target` instead.",
                                "default": null
                              },
                              "target": {
                                "anyOf": [
                                  {
                                    "enum": [
                                      "tested",
                                      "sold"
                                    ],
                                    "x-labels": {
                                      "tested": "The leg being tested",
                                      "sold": "All sold legs"
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Which legs",
                                "description": "tested: the sold leg whose price rose most against its entry; sold: every sold leg (each to the new strike). Give this or `leg`.",
                                "default": null
                              },
                              "strike": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "by": {
                                        "const": "atm"
                                      },
                                      "offset": {
                                        "type": "integer",
                                        "minimum": -20,
                                        "maximum": 20,
                                        "title": "Strikes from ATM",
                                        "description": "Positive is out of the money for calls and puts alike.",
                                        "default": 0
                                      }
                                    },
                                    "additionalProperties": false,
                                    "required": [
                                      "by"
                                    ],
                                    "title": "At the money"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "by": {
                                        "const": "pct_otm"
                                      },
                                      "pct": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 20,
                                        "title": "Percent OTM"
                                      }
                                    },
                                    "additionalProperties": false,
                                    "required": [
                                      "by",
                                      "pct"
                                    ],
                                    "title": "Percent out of the money"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "by": {
                                        "const": "delta"
                                      },
                                      "delta": {
                                        "type": "number",
                                        "minimum": 0.05,
                                        "maximum": 0.5,
                                        "title": "Delta",
                                        "description": "Absolute delta; the sign follows the option type."
                                      }
                                    },
                                    "additionalProperties": false,
                                    "required": [
                                      "by",
                                      "delta"
                                    ],
                                    "title": "Delta"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "by": {
                                        "const": "premium"
                                      },
                                      "premium": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 100000,
                                        "title": "Premium"
                                      },
                                      "mode": {
                                        "enum": [
                                          "nearest",
                                          "at_least",
                                          "at_most"
                                        ],
                                        "x-labels": {
                                          "nearest": "Nearest to",
                                          "at_least": "At least",
                                          "at_most": "At most"
                                        },
                                        "title": "Match",
                                        "default": "nearest"
                                      }
                                    },
                                    "additionalProperties": false,
                                    "required": [
                                      "by",
                                      "premium"
                                    ],
                                    "title": "Premium"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "by": {
                                        "const": "expected_move"
                                      },
                                      "k": {
                                        "type": "number",
                                        "minimum": 0.5,
                                        "maximum": 3,
                                        "title": "Times the expected move"
                                      }
                                    },
                                    "additionalProperties": false,
                                    "required": [
                                      "by",
                                      "k"
                                    ],
                                    "title": "Expected move",
                                    "x-phase": "b"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "by": {
                                        "const": "relative"
                                      },
                                      "to": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                        "title": "Relative to leg"
                                      },
                                      "width_strikes": {
                                        "anyOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 50
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "title": "Width in strikes",
                                        "default": null
                                      },
                                      "width_points": {
                                        "anyOf": [
                                          {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "title": "Width in points",
                                        "default": null
                                      }
                                    },
                                    "additionalProperties": false,
                                    "required": [
                                      "by",
                                      "to"
                                    ],
                                    "title": "Relative to another leg"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "by": {
                                        "const": "strike"
                                      },
                                      "strike": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "maximum": 10000000,
                                        "title": "Strike"
                                      }
                                    },
                                    "additionalProperties": false,
                                    "required": [
                                      "by",
                                      "strike"
                                    ],
                                    "title": "Exact strike"
                                  }
                                ],
                                "title": "New strike",
                                "description": "A relative strike counts from the rolled leg itself (`to`: its id)."
                              },
                              "move_hedge": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,15}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Also move hedge",
                                "default": null
                              },
                              "max_per_cycle": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10,
                                "title": "At most per cycle",
                                "default": 2
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "strike"
                            ],
                            "title": "Roll a strike",
                            "description": "close a leg and open the same option at a new strike",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "add_hedge@1",
                          "name": "add_hedge",
                          "major": 1,
                          "slots": [
                            "adjustment"
                          ],
                          "label": "Add a hedge",
                          "explain": "buy a wing beyond a sold leg",
                          "group": "Adjustments",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": false,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "add_hedge@1"
                              },
                              "when": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2048,
                                    "x-expression": true
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Condition",
                                "description": "A condition in the trigger expression grammar, e.g. rsi(14, '5m') > 70. Give this or `trigger`.",
                                "default": null
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Loss reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Loss reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Profit reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Profit reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "elapsed"
                                          },
                                          "minutes": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 43200,
                                            "title": "Minutes"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "minutes"
                                        ],
                                        "title": "Time since entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "premium_ratio"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "ratio": {
                                            "type": "number",
                                            "minimum": 0.1,
                                            "maximum": 100,
                                            "title": "Times the entry price",
                                            "description": "2 is a sold leg whose premium doubled."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "ratio"
                                        ],
                                        "title": "A leg's price reaches a multiple of its entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "condition"
                                          },
                                          "when": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 2048,
                                            "x-expression": true,
                                            "title": "Condition"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "when"
                                        ],
                                        "title": "Indicator or condition"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "expiry"
                                          },
                                          "dte_at_most": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 30,
                                            "title": "At most days to expiry",
                                            "default": 0
                                          },
                                          "at": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ],
                                            "title": "From (time)",
                                            "default": null
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on"
                                        ],
                                        "title": "Days to expiry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "delta_band"
                                          },
                                          "band": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 10,
                                            "title": "Band (lots of delta)"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "band"
                                        ],
                                        "title": "Net delta outside a band"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "leg_delta"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "delta": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 1,
                                            "title": "Delta (absolute)",
                                            "description": "0.30: the leg's delta reached ±0.30."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "delta"
                                        ],
                                        "title": "A leg's delta reaches",
                                        "x-phase": "c"
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Trigger",
                                "description": "When the adjustment fires: the moment this turns true, not again while it stays true.",
                                "default": null
                              },
                              "leg": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                "title": "Sold leg"
                              },
                              "width_strikes": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 50
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Width in strikes",
                                "default": null
                              },
                              "delta": {
                                "anyOf": [
                                  {
                                    "type": "number",
                                    "minimum": 0.05,
                                    "maximum": 0.5
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Delta",
                                "default": null
                              },
                              "max_per_cycle": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10,
                                "title": "At most per cycle",
                                "default": 1
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type",
                              "leg"
                            ],
                            "title": "Add a hedge",
                            "description": "buy a wing beyond a sold leg",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "widen@1",
                          "name": "widen",
                          "major": 1,
                          "slots": [
                            "adjustment"
                          ],
                          "label": "Widen the strikes",
                          "explain": "move every sold option and its hedge further out of the money",
                          "group": "Adjustments",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "widen@1"
                              },
                              "when": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2048,
                                    "x-expression": true
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Condition",
                                "description": "A condition in the trigger expression grammar, e.g. rsi(14, '5m') > 70. Give this or `trigger`.",
                                "default": null
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Loss reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Loss reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Profit reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Profit reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "elapsed"
                                          },
                                          "minutes": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 43200,
                                            "title": "Minutes"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "minutes"
                                        ],
                                        "title": "Time since entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "premium_ratio"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "ratio": {
                                            "type": "number",
                                            "minimum": 0.1,
                                            "maximum": 100,
                                            "title": "Times the entry price",
                                            "description": "2 is a sold leg whose premium doubled."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "ratio"
                                        ],
                                        "title": "A leg's price reaches a multiple of its entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "condition"
                                          },
                                          "when": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 2048,
                                            "x-expression": true,
                                            "title": "Condition"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "when"
                                        ],
                                        "title": "Indicator or condition"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "expiry"
                                          },
                                          "dte_at_most": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 30,
                                            "title": "At most days to expiry",
                                            "default": 0
                                          },
                                          "at": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ],
                                            "title": "From (time)",
                                            "default": null
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on"
                                        ],
                                        "title": "Days to expiry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "delta_band"
                                          },
                                          "band": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 10,
                                            "title": "Band (lots of delta)"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "band"
                                        ],
                                        "title": "Net delta outside a band"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "leg_delta"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "delta": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 1,
                                            "title": "Delta (absolute)",
                                            "description": "0.30: the leg's delta reached ±0.30."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "delta"
                                        ],
                                        "title": "A leg's delta reaches",
                                        "x-phase": "c"
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Trigger",
                                "description": "When the adjustment fires: the moment this turns true, not again while it stays true.",
                                "default": null
                              },
                              "strikes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 20,
                                "title": "Strikes further out",
                                "description": "Each sold leg and its hedge move this many strikes away from the money.",
                                "default": 2
                              },
                              "max_per_cycle": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10,
                                "title": "At most per cycle",
                                "default": 1
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Widen the strikes",
                            "description": "move every sold option and its hedge further out of the money",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "delta_hedge@1",
                          "name": "delta_hedge",
                          "major": 1,
                          "slots": [
                            "adjustment"
                          ],
                          "label": "Delta hedge",
                          "explain": "trade futures to keep the net delta inside a band",
                          "group": "Adjustments",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "delta_hedge@1"
                              },
                              "when": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2048,
                                    "x-expression": true
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Condition",
                                "description": "A condition in the trigger expression grammar, e.g. rsi(14, '5m') > 70. Give this or `trigger`.",
                                "default": null
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Loss reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Loss reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Profit reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Profit reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "elapsed"
                                          },
                                          "minutes": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 43200,
                                            "title": "Minutes"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "minutes"
                                        ],
                                        "title": "Time since entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "premium_ratio"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "ratio": {
                                            "type": "number",
                                            "minimum": 0.1,
                                            "maximum": 100,
                                            "title": "Times the entry price",
                                            "description": "2 is a sold leg whose premium doubled."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "ratio"
                                        ],
                                        "title": "A leg's price reaches a multiple of its entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "condition"
                                          },
                                          "when": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 2048,
                                            "x-expression": true,
                                            "title": "Condition"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "when"
                                        ],
                                        "title": "Indicator or condition"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "expiry"
                                          },
                                          "dte_at_most": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 30,
                                            "title": "At most days to expiry",
                                            "default": 0
                                          },
                                          "at": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ],
                                            "title": "From (time)",
                                            "default": null
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on"
                                        ],
                                        "title": "Days to expiry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "delta_band"
                                          },
                                          "band": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 10,
                                            "title": "Band (lots of delta)"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "band"
                                        ],
                                        "title": "Net delta outside a band"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "leg_delta"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "delta": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 1,
                                            "title": "Delta (absolute)",
                                            "description": "0.30: the leg's delta reached ±0.30."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "delta"
                                        ],
                                        "title": "A leg's delta reaches",
                                        "x-phase": "c"
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Trigger",
                                "description": "When the adjustment fires: the moment this turns true, not again while it stays true.",
                                "default": null
                              },
                              "with": {
                                "enum": [
                                  "future",
                                  "roll_short"
                                ],
                                "x-labels": {
                                  "future": "With futures",
                                  "roll_short": "By rolling the sold leg"
                                },
                                "title": "Hedge with",
                                "default": "future"
                              },
                              "target": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 5,
                                "title": "Bring net delta to",
                                "default": 0.1
                              },
                              "min_interval_s": {
                                "type": "integer",
                                "minimum": 300,
                                "maximum": 86400,
                                "title": "At least seconds between hedges",
                                "default": 300
                              },
                              "max_per_cycle": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10,
                                "title": "At most per cycle",
                                "default": 3
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Delta hedge",
                            "description": "trade futures to keep the net delta inside a band",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "roll_expiry@1",
                          "name": "roll_expiry",
                          "major": 1,
                          "slots": [
                            "adjustment"
                          ],
                          "label": "Roll to the next expiry",
                          "explain": "close every leg and re-open the same structure in the next expiry",
                          "group": "Adjustments",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "roll_expiry@1"
                              },
                              "when": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 2048,
                                    "x-expression": true
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Condition",
                                "default": null
                              },
                              "trigger": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Loss reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "loss_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Loss reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit"
                                          },
                                          "rupees": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 100000000,
                                            "title": "Rupees"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "rupees"
                                        ],
                                        "title": "Profit reaches (rupees)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "profit_pct"
                                          },
                                          "pct": {
                                            "type": "number",
                                            "exclusiveMinimum": 0,
                                            "maximum": 1000,
                                            "title": "Percent"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "pct"
                                        ],
                                        "title": "Profit reaches (percent of premium)"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "elapsed"
                                          },
                                          "minutes": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 43200,
                                            "title": "Minutes"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "minutes"
                                        ],
                                        "title": "Time since entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "premium_ratio"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "ratio": {
                                            "type": "number",
                                            "minimum": 0.1,
                                            "maximum": 100,
                                            "title": "Times the entry price",
                                            "description": "2 is a sold leg whose premium doubled."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "ratio"
                                        ],
                                        "title": "A leg's price reaches a multiple of its entry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "condition"
                                          },
                                          "when": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 2048,
                                            "x-expression": true,
                                            "title": "Condition"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "when"
                                        ],
                                        "title": "Indicator or condition"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "expiry"
                                          },
                                          "dte_at_most": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 30,
                                            "title": "At most days to expiry",
                                            "default": 0
                                          },
                                          "at": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ],
                                            "title": "From (time)",
                                            "default": null
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on"
                                        ],
                                        "title": "Days to expiry"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "delta_band"
                                          },
                                          "band": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 10,
                                            "title": "Band (lots of delta)"
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "band"
                                        ],
                                        "title": "Net delta outside a band"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "on": {
                                            "const": "leg_delta"
                                          },
                                          "leg": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,15}$",
                                            "title": "Leg"
                                          },
                                          "delta": {
                                            "type": "number",
                                            "minimum": 0.01,
                                            "maximum": 1,
                                            "title": "Delta (absolute)",
                                            "description": "0.30: the leg's delta reached ±0.30."
                                          }
                                        },
                                        "additionalProperties": false,
                                        "required": [
                                          "on",
                                          "leg",
                                          "delta"
                                        ],
                                        "title": "A leg's delta reaches",
                                        "x-phase": "c"
                                      }
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "Trigger",
                                "description": "When the adjustment fires: the moment this turns true, not again while it stays true.",
                                "default": null
                              },
                              "at": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "At",
                                "default": null
                              },
                              "dte_at_most": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 30
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "title": "When days to expiry is at most",
                                "default": null
                              },
                              "max_per_cycle": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10,
                                "title": "At most per cycle",
                                "default": 1
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Roll to the next expiry",
                            "description": "close every leg and re-open the same structure in the next expiry",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "app@1",
                          "name": "app",
                          "major": 1,
                          "slots": [
                            "notifier"
                          ],
                          "label": "App",
                          "explain": "Push notifications and the inbox in the app.",
                          "group": "Channels",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "app@1"
                              },
                              "events": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "entered",
                                    "exited",
                                    "stops",
                                    "adjusted",
                                    "skipped",
                                    "needs_attention",
                                    "daily_summary"
                                  ],
                                  "x-labels": {
                                    "entered": "Entered a trade",
                                    "exited": "Exited a trade",
                                    "stops": "Stops moved or hit",
                                    "adjusted": "Adjusted a trade",
                                    "skipped": "Skipped an entry",
                                    "needs_attention": "Needs your attention",
                                    "daily_summary": "Daily summary"
                                  }
                                },
                                "maxItems": 7,
                                "uniqueItems": true,
                                "title": "Events",
                                "description": "Urgent events (failures, circuit breaker, kill switch) are always delivered.",
                                "default": [
                                  "entered",
                                  "exited",
                                  "stops",
                                  "needs_attention",
                                  "daily_summary"
                                ]
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "App",
                            "description": "Push notifications and the inbox in the app.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "telegram@1",
                          "name": "telegram",
                          "major": 1,
                          "slots": [
                            "notifier"
                          ],
                          "label": "Telegram",
                          "explain": "Messages to your own Telegram, once it is linked in Settings.",
                          "group": "Channels",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "telegram@1"
                              },
                              "events": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "entered",
                                    "exited",
                                    "stops",
                                    "adjusted",
                                    "skipped",
                                    "needs_attention",
                                    "daily_summary"
                                  ],
                                  "x-labels": {
                                    "entered": "Entered a trade",
                                    "exited": "Exited a trade",
                                    "stops": "Stops moved or hit",
                                    "adjusted": "Adjusted a trade",
                                    "skipped": "Skipped an entry",
                                    "needs_attention": "Needs your attention",
                                    "daily_summary": "Daily summary"
                                  }
                                },
                                "maxItems": 7,
                                "uniqueItems": true,
                                "title": "Events",
                                "description": "Urgent events (failures, circuit breaker, kill switch) are always delivered.",
                                "default": [
                                  "entered",
                                  "exited",
                                  "stops",
                                  "needs_attention",
                                  "daily_summary"
                                ]
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Telegram",
                            "description": "Messages to your own Telegram, once it is linked in Settings.",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        },
                        {
                          "id": "webhook@1",
                          "name": "webhook",
                          "major": 1,
                          "slots": [
                            "notifier"
                          ],
                          "label": "Webhook",
                          "explain": "Signed HTTPS deliveries to a webhook chosen at deploy (no URL in the document).",
                          "group": "Channels",
                          "status": "preview",
                          "phase": "a",
                          "deployable": true,
                          "deprecated": false,
                          "sunset_after": null,
                          "needs": [],
                          "bare": true,
                          "params_schema": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "const": "webhook@1"
                              },
                              "events": {
                                "type": "array",
                                "items": {
                                  "enum": [
                                    "entered",
                                    "exited",
                                    "stops",
                                    "adjusted",
                                    "skipped",
                                    "needs_attention",
                                    "daily_summary"
                                  ],
                                  "x-labels": {
                                    "entered": "Entered a trade",
                                    "exited": "Exited a trade",
                                    "stops": "Stops moved or hit",
                                    "adjusted": "Adjusted a trade",
                                    "skipped": "Skipped an entry",
                                    "needs_attention": "Needs your attention",
                                    "daily_summary": "Daily summary"
                                  }
                                },
                                "maxItems": 7,
                                "uniqueItems": true,
                                "title": "Events",
                                "description": "Urgent events (failures, circuit breaker, kill switch) are always delivered.",
                                "default": [
                                  "entered",
                                  "exited",
                                  "stops",
                                  "needs_attention",
                                  "daily_summary"
                                ]
                              }
                            },
                            "additionalProperties": false,
                            "required": [
                              "type"
                            ],
                            "title": "Webhook",
                            "description": "Signed HTTPS deliveries to a webhook chosen at deploy (no URL in the document).",
                            "x-status": "preview",
                            "x-phase": "a"
                          }
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/strategies/capabilities": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Strategy capabilities",
        "description": "What the wizard may offer: slots and their components, enums and strike methods (with their phase), limits, timeframes, the indicator and variable catalogue (and whether each is available on this server), live brokers, underlyings (and `underlying_details`: per underlying its derivatives segment, lot size, strike step, expiry kinds listed, next expiries and current spot, from today's instrument list; `mcx_underlyings`, only while MCX strategies are on: every MCX commodity with a live future, priced off its nearest future), plain-English `labels` for every enum value, and the caller's usage (active deployments left). With indicator conditions on, `indicator_functions`: the engine's indicator registry as `/v2/triggers/capabilities` lists it (labels, parameters with defaults and ranges, outputs, presets, timeframes, limits). `switches`: this server's switches, each `true` / `false` only (`gallery`, `portfolio_risk`, `mcx`, `stock_fno`, `equity`, `stock_universe`: a stock universe is configured). `mcx_sessions`: the MCX hours strategies are held to: `late` (bullion, energy, base metals: open, entry window close, square-off cap and default, the close in each US season, the commodities in it), `early` (every other commodity: the agri close and its square-off cap and default) and `commodities`: per commodity in `mcx_underlyings` its `session` and hours (empty while MCX is off).",
        "operationId": "get_auto_strategy_capabilities",
        "responses": {
          "200": {
            "description": "Capabilities.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "examples": {
                  "success": {
                    "summary": "Enums, limits, catalogue and usage",
                    "value": {
                      "status": "success",
                      "data": {
                        "schema_version": 1,
                        "schema_versions": [
                          1
                        ],
                        "phase": "a",
                        "slots": [
                          {
                            "slot": "entry_source",
                            "label": "Entry",
                            "tag_key": "type",
                            "components": [
                              "conditions@1",
                              "manual@1",
                              "api@1",
                              "webhook@1"
                            ]
                          },
                          {
                            "slot": "exit_source",
                            "label": "Exit",
                            "tag_key": "type",
                            "components": [
                              "conditions@1",
                              "manual@1",
                              "api@1",
                              "webhook@1"
                            ]
                          },
                          {
                            "slot": "legs",
                            "label": "Legs",
                            "tag_key": "selector",
                            "components": [
                              "chain@1",
                              "fixed@1",
                              "from_signal@1"
                            ]
                          },
                          {
                            "slot": "sizing",
                            "label": "Sizing",
                            "tag_key": "type",
                            "components": [
                              "fixed_lots@1",
                              "max_premium@1",
                              "risk@1",
                              "capital_pct@1",
                              "from_signal@1"
                            ]
                          },
                          {
                            "slot": "execution",
                            "label": "Execution",
                            "tag_key": "type",
                            "components": [
                              "protected_limit@1"
                            ]
                          },
                          {
                            "slot": "per_leg",
                            "label": "Per-leg protection",
                            "tag_key": "type",
                            "components": [
                              "per_leg@1"
                            ]
                          },
                          {
                            "slot": "combined",
                            "label": "Combined protection",
                            "tag_key": "type",
                            "components": [
                              "combined@1"
                            ]
                          },
                          {
                            "slot": "limits",
                            "label": "Daily limits",
                            "tag_key": "type",
                            "components": [
                              "limits@1"
                            ]
                          },
                          {
                            "slot": "adjustment",
                            "label": "Adjustment",
                            "tag_key": "type",
                            "components": [
                              "close_leg@1",
                              "reduce@1",
                              "roll_strike@1",
                              "add_hedge@1",
                              "widen@1",
                              "delta_hedge@1",
                              "roll_expiry@1"
                            ]
                          },
                          {
                            "slot": "notifier",
                            "label": "Notifications",
                            "tag_key": "type",
                            "components": [
                              "app@1",
                              "telegram@1",
                              "webhook@1"
                            ]
                          }
                        ],
                        "enums": {
                          "instruments": [
                            "option",
                            "future",
                            "stock"
                          ],
                          "sides": [
                            "buy",
                            "sell"
                          ],
                          "option_types": [
                            "call",
                            "put"
                          ],
                          "expiry_kinds": [
                            "weekly",
                            "monthly"
                          ],
                          "premium_modes": [
                            "nearest",
                            "at_least",
                            "at_most"
                          ],
                          "strike_methods": [
                            {
                              "by": "atm",
                              "label": "At the money",
                              "phase": "a",
                              "deployable": true
                            },
                            {
                              "by": "pct_otm",
                              "label": "Percent out of the money",
                              "phase": "a",
                              "deployable": true
                            },
                            {
                              "by": "delta",
                              "label": "Delta",
                              "phase": "a",
                              "deployable": true
                            },
                            {
                              "by": "premium",
                              "label": "Premium",
                              "phase": "a",
                              "deployable": true
                            },
                            {
                              "by": "expected_move",
                              "label": "Expected move",
                              "phase": "b",
                              "deployable": false
                            },
                            {
                              "by": "relative",
                              "label": "Relative to another leg",
                              "phase": "a",
                              "deployable": true
                            },
                            {
                              "by": "strike",
                              "label": "Exact strike",
                              "phase": "a",
                              "deployable": true
                            }
                          ],
                          "exchanges": [
                            "NFO",
                            "BFO",
                            "NSE",
                            "BSE",
                            "MCX"
                          ],
                          "deployable_exchanges": [
                            "NFO",
                            "BFO",
                            "NSE",
                            "BSE"
                          ],
                          "hedge_with": [
                            "future",
                            "roll_short"
                          ],
                          "references": [
                            "future",
                            "spot",
                            "synthetic"
                          ],
                          "days": [
                            "mon",
                            "tue",
                            "wed",
                            "thu",
                            "fri"
                          ],
                          "expiry_day": [
                            "normal",
                            "skip",
                            "only"
                          ],
                          "evaluate_on": [
                            "close",
                            "tick"
                          ],
                          "reentry_on": [
                            "stop_loss",
                            "target",
                            "exit_signal",
                            "square_off"
                          ],
                          "cost_models": [
                            "auto",
                            "options_india",
                            "futures_india",
                            "equity_intraday_india"
                          ],
                          "orders": [
                            "auto",
                            "hedge_first",
                            "simultaneous",
                            "stagger"
                          ],
                          "on_incomplete": [
                            "safest",
                            "keep_and_manage",
                            "close_opened"
                          ],
                          "on_leg_stop": [
                            "nothing",
                            "move_others_to_cost",
                            "exit_all"
                          ],
                          "combined_scopes": [
                            "account",
                            "deployment"
                          ],
                          "bases": [
                            "rupees",
                            "pct_premium",
                            "pct_margin"
                          ],
                          "on_breaker": [
                            "nothing",
                            "close_open_trade"
                          ],
                          "notify_events": [
                            "entered",
                            "exited",
                            "stops",
                            "adjusted",
                            "skipped",
                            "needs_attention",
                            "daily_summary"
                          ]
                        },
                        "limits": {
                          "max_document_bytes": 65536,
                          "max_depth": 20,
                          "max_entry_legs": 6,
                          "max_legs": 8,
                          "max_expr_bytes": 2048,
                          "max_indicator_calls": 20,
                          "max_timeframes": 3,
                          "max_adjustments": 10,
                          "max_watch_symbols": 4,
                          "max_notifiers": 3,
                          "max_name_chars": 60,
                          "max_description_chars": 500,
                          "max_tags": 10,
                          "max_accounts_per_deployment": 4,
                          "max_active_deployments": 3,
                          "max_cycles_per_day": 20,
                          "max_orders_per_day": 200,
                          "min_reentry_delay_s": 60,
                          "latest_mis_square_off": "15:20",
                          "session_open": "09:15",
                          "session_close": "15:30",
                          "min_multiplier": 0.1,
                          "max_multiplier": 10
                        },
                        "segments": [
                          {
                            "segment": "NSE",
                            "exchanges": [
                              "NSE",
                              "NFO",
                              "NSE_INDEX"
                            ],
                            "open": "09:15",
                            "close": "15:30",
                            "phase": "a",
                            "available": true,
                            "latest_square_off": "15:20",
                            "default_square_off": "15:15"
                          },
                          {
                            "segment": "BSE",
                            "exchanges": [
                              "BSE",
                              "BFO",
                              "BSE_INDEX"
                            ],
                            "open": "09:15",
                            "close": "15:30",
                            "phase": "a",
                            "available": true,
                            "latest_square_off": "15:20",
                            "default_square_off": "15:15"
                          },
                          {
                            "segment": "MCX",
                            "exchanges": [
                              "MCX",
                              "MCX_INDEX"
                            ],
                            "open": "09:00",
                            "close": "23:30",
                            "phase": "d",
                            "available": false,
                            "latest_square_off": "23:00",
                            "default_square_off": "22:45"
                          },
                          {
                            "segment": "CDS",
                            "exchanges": [
                              "CDS",
                              "BCD"
                            ],
                            "open": "09:00",
                            "close": "17:00",
                            "phase": "d",
                            "available": false,
                            "latest_square_off": null,
                            "default_square_off": null
                          }
                        ],
                        "timeframes": [
                          "1m",
                          "3m",
                          "5m",
                          "10m",
                          "15m",
                          "30m",
                          "60m"
                        ],
                        "indicators": [
                          {
                            "name": "sma",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Simple moving average",
                            "available": false
                          },
                          {
                            "name": "ema",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Exponential moving average",
                            "available": false
                          },
                          {
                            "name": "rsi",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "RSI",
                            "available": false
                          },
                          {
                            "name": "atr",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Average true range",
                            "available": false
                          },
                          {
                            "name": "bb_upper",
                            "args": "p, k, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bollinger upper band",
                            "available": false
                          },
                          {
                            "name": "bb_middle",
                            "args": "p, k, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bollinger middle band",
                            "available": false
                          },
                          {
                            "name": "bb_mid",
                            "args": "p, k, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bollinger middle band",
                            "available": false
                          },
                          {
                            "name": "bb_lower",
                            "args": "p, k, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bollinger lower band",
                            "available": false
                          },
                          {
                            "name": "bb_percent",
                            "args": "p, k, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bollinger %B",
                            "available": false
                          },
                          {
                            "name": "bb_width",
                            "args": "p, k, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bollinger width",
                            "available": false
                          },
                          {
                            "name": "macd",
                            "args": "f, s, sig, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "MACD",
                            "available": false
                          },
                          {
                            "name": "macd_signal",
                            "args": "f, s, sig, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "MACD signal",
                            "available": false
                          },
                          {
                            "name": "macd_hist",
                            "args": "f, s, sig, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "MACD histogram",
                            "available": false
                          },
                          {
                            "name": "stoch_k",
                            "args": "k, sk, sd, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Stochastic %K",
                            "available": false
                          },
                          {
                            "name": "stoch_d",
                            "args": "k, sk, sd, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Stochastic %D",
                            "available": false
                          },
                          {
                            "name": "vwap",
                            "args": "iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "VWAP",
                            "available": false
                          },
                          {
                            "name": "supertrend",
                            "args": "p, m, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Supertrend",
                            "available": false
                          },
                          {
                            "name": "supertrend_dir",
                            "args": "p, m, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Supertrend direction",
                            "available": false
                          },
                          {
                            "name": "bar_open",
                            "args": "iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bar open",
                            "available": false
                          },
                          {
                            "name": "bar_high",
                            "args": "iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bar high",
                            "available": false
                          },
                          {
                            "name": "bar_low",
                            "args": "iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bar low",
                            "available": false
                          },
                          {
                            "name": "bar_close",
                            "args": "iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bar close",
                            "available": false
                          },
                          {
                            "name": "bar_volume",
                            "args": "iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bar volume",
                            "available": false
                          },
                          {
                            "name": "aroon_up",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Aroon up",
                            "available": false
                          },
                          {
                            "name": "aroon_down",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Aroon down",
                            "available": false
                          },
                          {
                            "name": "aroon_osc",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Aroon oscillator",
                            "available": false
                          },
                          {
                            "name": "cci",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Commodity channel index",
                            "available": false
                          },
                          {
                            "name": "willr",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Williams %R",
                            "available": false
                          },
                          {
                            "name": "roc",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Rate of change",
                            "available": false
                          },
                          {
                            "name": "mom",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Momentum",
                            "available": false
                          },
                          {
                            "name": "mfi",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Money flow index",
                            "available": false
                          },
                          {
                            "name": "keltner_middle",
                            "args": "p, k, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Keltner middle",
                            "available": false
                          },
                          {
                            "name": "donchian_middle",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Donchian middle",
                            "available": false
                          },
                          {
                            "name": "wma",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Weighted moving average",
                            "available": false
                          },
                          {
                            "name": "dema",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Double exponential moving average",
                            "available": false
                          },
                          {
                            "name": "tema",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Triple exponential moving average",
                            "available": false
                          },
                          {
                            "name": "kama",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Kaufman adaptive moving average",
                            "available": false
                          },
                          {
                            "name": "psar",
                            "args": "step, max, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Parabolic SAR",
                            "available": false
                          },
                          {
                            "name": "stochrsi_k",
                            "args": "r, k, d, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Stochastic RSI %K",
                            "available": false
                          },
                          {
                            "name": "stochrsi_d",
                            "args": "r, k, d, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Stochastic RSI %D",
                            "available": false
                          },
                          {
                            "name": "stddev",
                            "args": "p, iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Standard deviation",
                            "available": false
                          },
                          {
                            "name": "bullish_pattern",
                            "args": "'name', iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bullish candle pattern",
                            "available": false
                          },
                          {
                            "name": "bearish_pattern",
                            "args": "'name', iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Bearish candle pattern",
                            "available": false
                          },
                          {
                            "name": "pattern",
                            "args": "'name', iv[, sym]",
                            "kind": "streaming",
                            "phase": "a",
                            "label": "Candle pattern (either direction)",
                            "available": false
                          },
                          {
                            "name": "adx",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "ADX",
                            "available": false
                          },
                          {
                            "name": "plus_di",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "+DI",
                            "available": false
                          },
                          {
                            "name": "minus_di",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "-DI",
                            "available": false
                          },
                          {
                            "name": "hull",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Hull moving average",
                            "available": false
                          },
                          {
                            "name": "chop",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Choppiness index",
                            "available": false
                          },
                          {
                            "name": "donchian_upper",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Donchian upper",
                            "available": false
                          },
                          {
                            "name": "donchian_lower",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Donchian lower",
                            "available": false
                          },
                          {
                            "name": "keltner_upper",
                            "args": "p, k, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Keltner upper",
                            "available": false
                          },
                          {
                            "name": "keltner_lower",
                            "args": "p, k, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Keltner lower",
                            "available": false
                          },
                          {
                            "name": "ichimoku_tenkan",
                            "args": "iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Ichimoku tenkan",
                            "available": false
                          },
                          {
                            "name": "ichimoku_kijun",
                            "args": "iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Ichimoku kijun",
                            "available": false
                          },
                          {
                            "name": "ichimoku_span_a",
                            "args": "iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Ichimoku span A",
                            "available": false
                          },
                          {
                            "name": "ichimoku_span_b",
                            "args": "iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Ichimoku span B",
                            "available": false
                          },
                          {
                            "name": "cmf",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Chaikin money flow",
                            "available": false
                          },
                          {
                            "name": "obv",
                            "args": "iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "On-balance volume",
                            "available": false
                          },
                          {
                            "name": "vortex_plus",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Vortex +",
                            "available": false
                          },
                          {
                            "name": "vortex_minus",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Vortex -",
                            "available": false
                          },
                          {
                            "name": "fisher",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Fisher transform",
                            "available": false
                          },
                          {
                            "name": "tsi",
                            "args": "r, s, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "True strength index",
                            "available": false
                          },
                          {
                            "name": "rvol",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Relative volume",
                            "available": false
                          },
                          {
                            "name": "hv",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Historical volatility",
                            "available": false
                          },
                          {
                            "name": "yz_vol",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Yang-Zhang volatility",
                            "available": false
                          },
                          {
                            "name": "regime",
                            "args": "p, iv[, sym]",
                            "kind": "windowed",
                            "phase": "b",
                            "label": "Trend regime (1 trend, 0 range)",
                            "available": false
                          },
                          {
                            "name": "pivot",
                            "args": "method[, sym]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Pivot",
                            "available": false
                          },
                          {
                            "name": "r1",
                            "args": "method[, sym]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Resistance 1",
                            "available": false
                          },
                          {
                            "name": "r2",
                            "args": "method[, sym]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Resistance 2",
                            "available": false
                          },
                          {
                            "name": "s1",
                            "args": "method[, sym]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Support 1",
                            "available": false
                          },
                          {
                            "name": "s2",
                            "args": "method[, sym]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Support 2",
                            "available": false
                          },
                          {
                            "name": "prev_high",
                            "args": "[sym]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Previous day's high",
                            "available": false
                          },
                          {
                            "name": "prev_low",
                            "args": "[sym]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Previous day's low",
                            "available": false
                          },
                          {
                            "name": "prev_close",
                            "args": "[sym]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Previous day's close",
                            "available": false
                          },
                          {
                            "name": "day_open",
                            "args": "[sym]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Today's open",
                            "available": false
                          },
                          {
                            "name": "day_high",
                            "args": "[x]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Today's high",
                            "available": false
                          },
                          {
                            "name": "day_low",
                            "args": "[x]",
                            "kind": "session",
                            "phase": "b",
                            "label": "Today's low",
                            "available": false
                          },
                          {
                            "name": "orb_high",
                            "args": "min[, sym]",
                            "kind": "opening_range",
                            "phase": "b",
                            "label": "Opening range high",
                            "available": false
                          },
                          {
                            "name": "orb_low",
                            "args": "min[, sym]",
                            "kind": "opening_range",
                            "phase": "b",
                            "label": "Opening range low",
                            "available": false
                          },
                          {
                            "name": "orb_ready",
                            "args": "min[, sym]",
                            "kind": "opening_range",
                            "phase": "b",
                            "label": "Opening range complete",
                            "available": false
                          },
                          {
                            "name": "ltp",
                            "args": "sym",
                            "kind": "strategy",
                            "phase": "a",
                            "label": "Last price of a watched symbol",
                            "available": false
                          },
                          {
                            "name": "atm_iv",
                            "args": "sym, expiry",
                            "kind": "strategy",
                            "phase": "b",
                            "label": "ATM implied volatility",
                            "available": false
                          },
                          {
                            "name": "iv_rank",
                            "args": "sym, days",
                            "kind": "strategy",
                            "phase": "b",
                            "label": "IV rank",
                            "available": false
                          },
                          {
                            "name": "iv_pct",
                            "args": "sym, days",
                            "kind": "strategy",
                            "phase": "b",
                            "label": "IV percentile",
                            "available": false
                          },
                          {
                            "name": "expected_move",
                            "args": "sym, expiry",
                            "kind": "strategy",
                            "phase": "b",
                            "label": "Expected move",
                            "available": false
                          },
                          {
                            "name": "dte",
                            "args": "leg",
                            "kind": "strategy",
                            "phase": "a",
                            "label": "Days to expiry",
                            "available": false
                          },
                          {
                            "name": "leg",
                            "args": "id",
                            "kind": "strategy",
                            "phase": "b",
                            "label": "An open leg (ltp, pnl, delta, iv, premium_ratio)",
                            "available": false
                          },
                          {
                            "name": "minutes",
                            "args": "'HH:MM'",
                            "kind": "strategy",
                            "phase": "a",
                            "label": "Minutes since midnight of a time",
                            "available": false
                          }
                        ],
                        "variables": [
                          {
                            "name": "cycle.pnl",
                            "phase": "a",
                            "available": false
                          },
                          {
                            "name": "cycle.minutes",
                            "phase": "a",
                            "available": true
                          },
                          {
                            "name": "cycle.pnl_pct",
                            "phase": "a",
                            "available": false
                          },
                          {
                            "name": "day.pnl",
                            "phase": "a",
                            "available": false
                          },
                          {
                            "name": "day.cycles",
                            "phase": "a",
                            "available": false
                          },
                          {
                            "name": "week.pnl",
                            "phase": "b",
                            "available": false
                          },
                          {
                            "name": "net.delta",
                            "phase": "b",
                            "available": false
                          },
                          {
                            "name": "net.theta",
                            "phase": "b",
                            "available": false
                          },
                          {
                            "name": "net.vega",
                            "phase": "b",
                            "available": false
                          },
                          {
                            "name": "is_expiry_day",
                            "phase": "a",
                            "available": false
                          },
                          {
                            "name": "minutes_to_close",
                            "phase": "a",
                            "available": false
                          }
                        ],
                        "adjustment_triggers": [
                          {
                            "on": "loss",
                            "label": "Loss reaches (rupees)",
                            "fields": [
                              {
                                "key": "rupees",
                                "label": "Rupees",
                                "help": "",
                                "required": true,
                                "default": null
                              }
                            ],
                            "phase": "a",
                            "deployable": true
                          },
                          {
                            "on": "loss_pct",
                            "label": "Loss reaches (percent of premium)",
                            "fields": [
                              {
                                "key": "pct",
                                "label": "Percent",
                                "help": "",
                                "required": true,
                                "default": null
                              }
                            ],
                            "phase": "a",
                            "deployable": true
                          },
                          {
                            "on": "profit",
                            "label": "Profit reaches (rupees)",
                            "fields": [
                              {
                                "key": "rupees",
                                "label": "Rupees",
                                "help": "",
                                "required": true,
                                "default": null
                              }
                            ],
                            "phase": "a",
                            "deployable": true
                          },
                          {
                            "on": "profit_pct",
                            "label": "Profit reaches (percent of premium)",
                            "fields": [
                              {
                                "key": "pct",
                                "label": "Percent",
                                "help": "",
                                "required": true,
                                "default": null
                              }
                            ],
                            "phase": "a",
                            "deployable": true
                          },
                          {
                            "on": "elapsed",
                            "label": "Time since entry",
                            "fields": [
                              {
                                "key": "minutes",
                                "label": "Minutes",
                                "help": "",
                                "required": true,
                                "default": null
                              }
                            ],
                            "phase": "a",
                            "deployable": true
                          },
                          {
                            "on": "premium_ratio",
                            "label": "A leg's price reaches a multiple of its entry",
                            "fields": [
                              {
                                "key": "leg",
                                "label": "Leg",
                                "help": "",
                                "required": true,
                                "default": null
                              },
                              {
                                "key": "ratio",
                                "label": "Times the entry price",
                                "help": "2 is a sold leg whose premium doubled.",
                                "required": true,
                                "default": null
                              }
                            ],
                            "phase": "a",
                            "deployable": true
                          },
                          {
                            "on": "condition",
                            "label": "Indicator or condition",
                            "fields": [
                              {
                                "key": "when",
                                "label": "Condition",
                                "help": "",
                                "required": true,
                                "default": null
                              }
                            ],
                            "phase": "a",
                            "deployable": true
                          },
                          {
                            "on": "expiry",
                            "label": "Days to expiry",
                            "fields": [
                              {
                                "key": "dte_at_most",
                                "label": "At most days to expiry",
                                "help": "",
                                "required": false,
                                "default": 0
                              },
                              {
                                "key": "at",
                                "label": "From (time)",
                                "help": "",
                                "required": false,
                                "default": null
                              }
                            ],
                            "phase": "a",
                            "deployable": true
                          },
                          {
                            "on": "delta_band",
                            "label": "Net delta outside a band",
                            "fields": [
                              {
                                "key": "band",
                                "label": "Band (lots of delta)",
                                "help": "",
                                "required": true,
                                "default": null
                              }
                            ],
                            "phase": "a",
                            "deployable": true
                          },
                          {
                            "on": "leg_delta",
                            "label": "A leg's delta reaches",
                            "fields": [
                              {
                                "key": "leg",
                                "label": "Leg",
                                "help": "",
                                "required": true,
                                "default": null
                              },
                              {
                                "key": "delta",
                                "label": "Delta (absolute)",
                                "help": "0.30: the leg's delta reached ±0.30.",
                                "required": true,
                                "default": null
                              }
                            ],
                            "phase": "c",
                            "deployable": false
                          }
                        ],
                        "adjustment_targets": [
                          {
                            "target": "tested",
                            "label": "The leg being tested",
                            "explain": "the sold option whose price rose most against its entry, from fresh prices",
                            "adjusters": [
                              "close_leg@1",
                              "reduce@1",
                              "roll_strike@1"
                            ]
                          },
                          {
                            "target": "sold",
                            "label": "All sold legs",
                            "explain": "every open sold option (hedges stay)",
                            "adjusters": [
                              "close_leg@1",
                              "reduce@1",
                              "roll_strike@1"
                            ]
                          }
                        ],
                        "labels": {
                          "instruments": [
                            {
                              "value": "option",
                              "label": "Option"
                            },
                            {
                              "value": "future",
                              "label": "Future"
                            },
                            {
                              "value": "stock",
                              "label": "Stock"
                            }
                          ],
                          "sides": [
                            {
                              "value": "buy",
                              "label": "Buy"
                            },
                            {
                              "value": "sell",
                              "label": "Sell"
                            }
                          ],
                          "signal_instruments": [
                            {
                              "value": "signal",
                              "label": "As the alert says"
                            },
                            {
                              "value": "stock",
                              "label": "The stock"
                            },
                            {
                              "value": "future",
                              "label": "Its nearest future"
                            },
                            {
                              "value": "option",
                              "label": "Its nearest option"
                            }
                          ],
                          "signal_sides": [
                            {
                              "value": "signal",
                              "label": "As the alert says"
                            },
                            {
                              "value": "buy",
                              "label": "Buy"
                            },
                            {
                              "value": "sell",
                              "label": "Sell"
                            }
                          ],
                          "option_types": [
                            {
                              "value": "call",
                              "label": "Call"
                            },
                            {
                              "value": "put",
                              "label": "Put"
                            }
                          ],
                          "stock_cover": [
                            {
                              "value": "strategy",
                              "label": "Shares this strategy bought"
                            },
                            {
                              "value": "any",
                              "label": "Any shares held"
                            }
                          ],
                          "expiry_kinds": [
                            {
                              "value": "weekly",
                              "label": "Weekly"
                            },
                            {
                              "value": "monthly",
                              "label": "Monthly"
                            }
                          ],
                          "premium_modes": [
                            {
                              "value": "nearest",
                              "label": "Nearest to"
                            },
                            {
                              "value": "at_least",
                              "label": "At least"
                            },
                            {
                              "value": "at_most",
                              "label": "At most"
                            }
                          ],
                          "exchanges": [
                            {
                              "value": "NFO",
                              "label": "NSE futures & options"
                            },
                            {
                              "value": "BFO",
                              "label": "BSE futures & options"
                            },
                            {
                              "value": "NSE",
                              "label": "NSE stocks"
                            },
                            {
                              "value": "BSE",
                              "label": "BSE stocks"
                            },
                            {
                              "value": "MCX",
                              "label": "MCX commodities"
                            }
                          ],
                          "references": [
                            {
                              "value": "future",
                              "label": "Futures price"
                            },
                            {
                              "value": "spot",
                              "label": "Spot (index or stock) price"
                            },
                            {
                              "value": "synthetic",
                              "label": "Synthetic price from options"
                            }
                          ],
                          "days": [
                            {
                              "value": "mon",
                              "label": "Monday"
                            },
                            {
                              "value": "tue",
                              "label": "Tuesday"
                            },
                            {
                              "value": "wed",
                              "label": "Wednesday"
                            },
                            {
                              "value": "thu",
                              "label": "Thursday"
                            },
                            {
                              "value": "fri",
                              "label": "Friday"
                            }
                          ],
                          "expiry_day": [
                            {
                              "value": "normal",
                              "label": "Trade as usual"
                            },
                            {
                              "value": "skip",
                              "label": "Skip expiry day"
                            },
                            {
                              "value": "only",
                              "label": "Only on expiry day"
                            }
                          ],
                          "evaluate_on": [
                            {
                              "value": "close",
                              "label": "At each candle close"
                            },
                            {
                              "value": "tick",
                              "label": "On every price change"
                            }
                          ],
                          "reentry_on": [
                            {
                              "value": "stop_loss",
                              "label": "After a stop-loss"
                            },
                            {
                              "value": "target",
                              "label": "After a target"
                            },
                            {
                              "value": "exit_signal",
                              "label": "After an exit signal"
                            },
                            {
                              "value": "square_off",
                              "label": "After the square-off"
                            }
                          ],
                          "cost_models": [
                            {
                              "value": "auto",
                              "label": "Automatic"
                            },
                            {
                              "value": "options_india",
                              "label": "Indian options charges"
                            },
                            {
                              "value": "futures_india",
                              "label": "Indian futures charges"
                            },
                            {
                              "value": "equity_intraday_india",
                              "label": "Indian intraday equity charges"
                            }
                          ],
                          "orders": [
                            {
                              "value": "auto",
                              "label": "Automatic"
                            },
                            {
                              "value": "hedge_first",
                              "label": "Hedges first"
                            },
                            {
                              "value": "simultaneous",
                              "label": "All legs together"
                            },
                            {
                              "value": "stagger",
                              "label": "One after another"
                            }
                          ],
                          "on_incomplete": [
                            {
                              "value": "safest",
                              "label": "Do the safest thing"
                            },
                            {
                              "value": "keep_and_manage",
                              "label": "Keep and manage what filled"
                            },
                            {
                              "value": "close_opened",
                              "label": "Close what filled"
                            }
                          ],
                          "on_leg_stop": [
                            {
                              "value": "nothing",
                              "label": "Do nothing"
                            },
                            {
                              "value": "move_others_to_cost",
                              "label": "Move the other legs' stops to cost"
                            },
                            {
                              "value": "exit_all",
                              "label": "Exit every leg"
                            }
                          ],
                          "combined_scopes": [
                            {
                              "value": "account",
                              "label": "Each account"
                            },
                            {
                              "value": "deployment",
                              "label": "The whole deployment"
                            }
                          ],
                          "bases": [
                            {
                              "value": "rupees",
                              "label": "Rupees"
                            },
                            {
                              "value": "pct_premium",
                              "label": "% of premium"
                            },
                            {
                              "value": "pct_margin",
                              "label": "% of margin"
                            }
                          ],
                          "on_breaker": [
                            {
                              "value": "nothing",
                              "label": "Do nothing"
                            },
                            {
                              "value": "close_open_trade",
                              "label": "Close the open trade"
                            }
                          ],
                          "leg_targets": [
                            {
                              "value": "tested",
                              "label": "The leg being tested"
                            },
                            {
                              "value": "sold",
                              "label": "All sold legs"
                            }
                          ],
                          "notify_events": [
                            {
                              "value": "entered",
                              "label": "Entered a trade"
                            },
                            {
                              "value": "exited",
                              "label": "Exited a trade"
                            },
                            {
                              "value": "stops",
                              "label": "Stops moved or hit"
                            },
                            {
                              "value": "adjusted",
                              "label": "Adjusted a trade"
                            },
                            {
                              "value": "skipped",
                              "label": "Skipped an entry"
                            },
                            {
                              "value": "needs_attention",
                              "label": "Needs your attention"
                            },
                            {
                              "value": "daily_summary",
                              "label": "Daily summary"
                            }
                          ],
                          "hedge_with": [
                            {
                              "value": "future",
                              "label": "With futures"
                            },
                            {
                              "value": "roll_short",
                              "label": "By rolling the sold leg"
                            }
                          ],
                          "timeframes": [
                            {
                              "value": "1m",
                              "label": "1 minute"
                            },
                            {
                              "value": "3m",
                              "label": "3 minutes"
                            },
                            {
                              "value": "5m",
                              "label": "5 minutes"
                            },
                            {
                              "value": "10m",
                              "label": "10 minutes"
                            },
                            {
                              "value": "15m",
                              "label": "15 minutes"
                            },
                            {
                              "value": "30m",
                              "label": "30 minutes"
                            },
                            {
                              "value": "60m",
                              "label": "1 hour"
                            }
                          ],
                          "deployable_exchanges": [
                            {
                              "value": "NFO",
                              "label": "NSE futures & options"
                            },
                            {
                              "value": "BFO",
                              "label": "BSE futures & options"
                            },
                            {
                              "value": "NSE",
                              "label": "NSE stocks"
                            },
                            {
                              "value": "BSE",
                              "label": "BSE stocks"
                            }
                          ],
                          "strike_methods": [
                            {
                              "value": "atm",
                              "label": "At the money"
                            },
                            {
                              "value": "pct_otm",
                              "label": "Percent out of the money"
                            },
                            {
                              "value": "delta",
                              "label": "Delta"
                            },
                            {
                              "value": "premium",
                              "label": "Premium"
                            },
                            {
                              "value": "expected_move",
                              "label": "Expected move"
                            },
                            {
                              "value": "relative",
                              "label": "Relative to another leg"
                            },
                            {
                              "value": "strike",
                              "label": "Exact strike"
                            }
                          ],
                          "slots": [
                            {
                              "value": "entry_source",
                              "label": "Entry"
                            },
                            {
                              "value": "exit_source",
                              "label": "Exit"
                            },
                            {
                              "value": "legs",
                              "label": "Legs"
                            },
                            {
                              "value": "sizing",
                              "label": "Sizing"
                            },
                            {
                              "value": "execution",
                              "label": "Execution"
                            },
                            {
                              "value": "per_leg",
                              "label": "Per-leg protection"
                            },
                            {
                              "value": "combined",
                              "label": "Combined protection"
                            },
                            {
                              "value": "limits",
                              "label": "Daily limits"
                            },
                            {
                              "value": "adjustment",
                              "label": "Adjustment"
                            },
                            {
                              "value": "notifier",
                              "label": "Notifications"
                            }
                          ],
                          "components": [
                            {
                              "value": "conditions@1",
                              "label": "Conditions"
                            },
                            {
                              "value": "manual@1",
                              "label": "Manual"
                            },
                            {
                              "value": "api@1",
                              "label": "Your code (API)"
                            },
                            {
                              "value": "webhook@1",
                              "label": "Alerts (signal URL)"
                            },
                            {
                              "value": "chain@1",
                              "label": "From the option chain"
                            },
                            {
                              "value": "fixed@1",
                              "label": "Exact contracts"
                            },
                            {
                              "value": "from_signal@1",
                              "label": "From the signal"
                            },
                            {
                              "value": "fixed_lots@1",
                              "label": "Fixed lots"
                            },
                            {
                              "value": "max_premium@1",
                              "label": "Premium cap"
                            },
                            {
                              "value": "risk@1",
                              "label": "Risk per trade"
                            },
                            {
                              "value": "capital_pct@1",
                              "label": "Percent of capital"
                            },
                            {
                              "value": "from_signal@1",
                              "label": "From the signal"
                            },
                            {
                              "value": "protected_limit@1",
                              "label": "Protected limit"
                            },
                            {
                              "value": "per_leg@1",
                              "label": "Per-leg protection"
                            },
                            {
                              "value": "combined@1",
                              "label": "Combined protection"
                            },
                            {
                              "value": "limits@1",
                              "label": "Daily limits"
                            },
                            {
                              "value": "close_leg@1",
                              "label": "Close a leg"
                            },
                            {
                              "value": "reduce@1",
                              "label": "Reduce"
                            },
                            {
                              "value": "roll_strike@1",
                              "label": "Roll a strike"
                            },
                            {
                              "value": "add_hedge@1",
                              "label": "Add a hedge"
                            },
                            {
                              "value": "widen@1",
                              "label": "Widen the strikes"
                            },
                            {
                              "value": "delta_hedge@1",
                              "label": "Delta hedge"
                            },
                            {
                              "value": "roll_expiry@1",
                              "label": "Roll to the next expiry"
                            },
                            {
                              "value": "app@1",
                              "label": "App"
                            },
                            {
                              "value": "telegram@1",
                              "label": "Telegram"
                            },
                            {
                              "value": "webhook@1",
                              "label": "Webhook"
                            }
                          ],
                          "segments": [
                            {
                              "value": "NSE",
                              "label": "NSE: stocks, index futures and options"
                            },
                            {
                              "value": "BSE",
                              "label": "BSE: stocks, index futures and options"
                            },
                            {
                              "value": "MCX",
                              "label": "MCX: commodities"
                            },
                            {
                              "value": "CDS",
                              "label": "Currency derivatives"
                            }
                          ],
                          "indicators": [
                            {
                              "value": "sma",
                              "label": "Simple moving average"
                            },
                            {
                              "value": "ema",
                              "label": "Exponential moving average"
                            },
                            {
                              "value": "rsi",
                              "label": "RSI"
                            },
                            {
                              "value": "atr",
                              "label": "Average true range"
                            },
                            {
                              "value": "bb_upper",
                              "label": "Bollinger upper band"
                            },
                            {
                              "value": "bb_middle",
                              "label": "Bollinger middle band"
                            },
                            {
                              "value": "bb_mid",
                              "label": "Bollinger middle band"
                            },
                            {
                              "value": "bb_lower",
                              "label": "Bollinger lower band"
                            },
                            {
                              "value": "bb_percent",
                              "label": "Bollinger %B"
                            },
                            {
                              "value": "bb_width",
                              "label": "Bollinger width"
                            },
                            {
                              "value": "macd",
                              "label": "MACD"
                            },
                            {
                              "value": "macd_signal",
                              "label": "MACD signal"
                            },
                            {
                              "value": "macd_hist",
                              "label": "MACD histogram"
                            },
                            {
                              "value": "stoch_k",
                              "label": "Stochastic %K"
                            },
                            {
                              "value": "stoch_d",
                              "label": "Stochastic %D"
                            },
                            {
                              "value": "vwap",
                              "label": "VWAP"
                            },
                            {
                              "value": "supertrend",
                              "label": "Supertrend"
                            },
                            {
                              "value": "supertrend_dir",
                              "label": "Supertrend direction"
                            },
                            {
                              "value": "bar_open",
                              "label": "Bar open"
                            },
                            {
                              "value": "bar_high",
                              "label": "Bar high"
                            },
                            {
                              "value": "bar_low",
                              "label": "Bar low"
                            },
                            {
                              "value": "bar_close",
                              "label": "Bar close"
                            },
                            {
                              "value": "bar_volume",
                              "label": "Bar volume"
                            },
                            {
                              "value": "aroon_up",
                              "label": "Aroon up"
                            },
                            {
                              "value": "aroon_down",
                              "label": "Aroon down"
                            },
                            {
                              "value": "aroon_osc",
                              "label": "Aroon oscillator"
                            },
                            {
                              "value": "cci",
                              "label": "Commodity channel index"
                            },
                            {
                              "value": "willr",
                              "label": "Williams %R"
                            },
                            {
                              "value": "roc",
                              "label": "Rate of change"
                            },
                            {
                              "value": "mom",
                              "label": "Momentum"
                            },
                            {
                              "value": "mfi",
                              "label": "Money flow index"
                            },
                            {
                              "value": "keltner_middle",
                              "label": "Keltner middle"
                            },
                            {
                              "value": "donchian_middle",
                              "label": "Donchian middle"
                            },
                            {
                              "value": "wma",
                              "label": "Weighted moving average"
                            },
                            {
                              "value": "dema",
                              "label": "Double exponential moving average"
                            },
                            {
                              "value": "tema",
                              "label": "Triple exponential moving average"
                            },
                            {
                              "value": "kama",
                              "label": "Kaufman adaptive moving average"
                            },
                            {
                              "value": "psar",
                              "label": "Parabolic SAR"
                            },
                            {
                              "value": "stochrsi_k",
                              "label": "Stochastic RSI %K"
                            },
                            {
                              "value": "stochrsi_d",
                              "label": "Stochastic RSI %D"
                            },
                            {
                              "value": "stddev",
                              "label": "Standard deviation"
                            },
                            {
                              "value": "bullish_pattern",
                              "label": "Bullish candle pattern"
                            },
                            {
                              "value": "bearish_pattern",
                              "label": "Bearish candle pattern"
                            },
                            {
                              "value": "pattern",
                              "label": "Candle pattern (either direction)"
                            },
                            {
                              "value": "adx",
                              "label": "ADX"
                            },
                            {
                              "value": "plus_di",
                              "label": "+DI"
                            },
                            {
                              "value": "minus_di",
                              "label": "-DI"
                            },
                            {
                              "value": "hull",
                              "label": "Hull moving average"
                            },
                            {
                              "value": "chop",
                              "label": "Choppiness index"
                            },
                            {
                              "value": "donchian_upper",
                              "label": "Donchian upper"
                            },
                            {
                              "value": "donchian_lower",
                              "label": "Donchian lower"
                            },
                            {
                              "value": "keltner_upper",
                              "label": "Keltner upper"
                            },
                            {
                              "value": "keltner_lower",
                              "label": "Keltner lower"
                            },
                            {
                              "value": "ichimoku_tenkan",
                              "label": "Ichimoku tenkan"
                            },
                            {
                              "value": "ichimoku_kijun",
                              "label": "Ichimoku kijun"
                            },
                            {
                              "value": "ichimoku_span_a",
                              "label": "Ichimoku span A"
                            },
                            {
                              "value": "ichimoku_span_b",
                              "label": "Ichimoku span B"
                            },
                            {
                              "value": "cmf",
                              "label": "Chaikin money flow"
                            },
                            {
                              "value": "obv",
                              "label": "On-balance volume"
                            },
                            {
                              "value": "vortex_plus",
                              "label": "Vortex +"
                            },
                            {
                              "value": "vortex_minus",
                              "label": "Vortex -"
                            },
                            {
                              "value": "fisher",
                              "label": "Fisher transform"
                            },
                            {
                              "value": "tsi",
                              "label": "True strength index"
                            },
                            {
                              "value": "rvol",
                              "label": "Relative volume"
                            },
                            {
                              "value": "hv",
                              "label": "Historical volatility"
                            },
                            {
                              "value": "yz_vol",
                              "label": "Yang-Zhang volatility"
                            },
                            {
                              "value": "regime",
                              "label": "Trend regime (1 trend, 0 range)"
                            },
                            {
                              "value": "pivot",
                              "label": "Pivot"
                            },
                            {
                              "value": "r1",
                              "label": "Resistance 1"
                            },
                            {
                              "value": "r2",
                              "label": "Resistance 2"
                            },
                            {
                              "value": "s1",
                              "label": "Support 1"
                            },
                            {
                              "value": "s2",
                              "label": "Support 2"
                            },
                            {
                              "value": "prev_high",
                              "label": "Previous day's high"
                            },
                            {
                              "value": "prev_low",
                              "label": "Previous day's low"
                            },
                            {
                              "value": "prev_close",
                              "label": "Previous day's close"
                            },
                            {
                              "value": "day_open",
                              "label": "Today's open"
                            },
                            {
                              "value": "day_high",
                              "label": "Today's high"
                            },
                            {
                              "value": "day_low",
                              "label": "Today's low"
                            },
                            {
                              "value": "orb_high",
                              "label": "Opening range high"
                            },
                            {
                              "value": "orb_low",
                              "label": "Opening range low"
                            },
                            {
                              "value": "orb_ready",
                              "label": "Opening range complete"
                            },
                            {
                              "value": "ltp",
                              "label": "Last price of a watched symbol"
                            },
                            {
                              "value": "atm_iv",
                              "label": "ATM implied volatility"
                            },
                            {
                              "value": "iv_rank",
                              "label": "IV rank"
                            },
                            {
                              "value": "iv_pct",
                              "label": "IV percentile"
                            },
                            {
                              "value": "expected_move",
                              "label": "Expected move"
                            },
                            {
                              "value": "dte",
                              "label": "Days to expiry"
                            },
                            {
                              "value": "leg",
                              "label": "An open leg (ltp, pnl, delta, iv, premium_ratio)"
                            },
                            {
                              "value": "minutes",
                              "label": "Minutes since midnight of a time"
                            }
                          ],
                          "template_categories": [
                            {
                              "value": "income",
                              "label": "Earn from a quiet market"
                            },
                            {
                              "value": "hedged_income",
                              "label": "Earn with protection"
                            },
                            {
                              "value": "breakout",
                              "label": "Catch a breakout"
                            },
                            {
                              "value": "trend",
                              "label": "Ride a trend"
                            },
                            {
                              "value": "big_move",
                              "label": "Bet on a big move"
                            },
                            {
                              "value": "bullish",
                              "label": "Bullish"
                            },
                            {
                              "value": "bearish",
                              "label": "Bearish"
                            }
                          ],
                          "risk": [
                            {
                              "value": "limited",
                              "label": "Limited loss"
                            },
                            {
                              "value": "unlimited",
                              "label": "Unlimited loss"
                            }
                          ]
                        },
                        "live_brokers": [
                          "zerodha"
                        ],
                        "underlyings": [
                          "NIFTY",
                          "BANKNIFTY",
                          "FINNIFTY",
                          "SENSEX",
                          "MIDCPNIFTY"
                        ],
                        "underlying_details": [
                          {
                            "name": "NIFTY",
                            "exchange": "NFO",
                            "lot_size": 75,
                            "strike_step": 50,
                            "expiry_kinds": [
                              "weekly",
                              "monthly"
                            ],
                            "next_expiry": "2030-12-19",
                            "next_monthly_expiry": "2030-12-26",
                            "spot": 25000,
                            "spot_stale": false,
                            "note": null
                          },
                          {
                            "name": "BANKNIFTY",
                            "exchange": null,
                            "lot_size": null,
                            "strike_step": null,
                            "expiry_kinds": [],
                            "next_expiry": null,
                            "next_monthly_expiry": null,
                            "spot": null,
                            "spot_stale": false,
                            "note": "No live options or futures in today's instrument list."
                          },
                          {
                            "name": "FINNIFTY",
                            "exchange": null,
                            "lot_size": null,
                            "strike_step": null,
                            "expiry_kinds": [],
                            "next_expiry": null,
                            "next_monthly_expiry": null,
                            "spot": null,
                            "spot_stale": false,
                            "note": "No live options or futures in today's instrument list."
                          },
                          {
                            "name": "SENSEX",
                            "exchange": null,
                            "lot_size": null,
                            "strike_step": null,
                            "expiry_kinds": [],
                            "next_expiry": null,
                            "next_monthly_expiry": null,
                            "spot": null,
                            "spot_stale": false,
                            "note": "No live options or futures in today's instrument list."
                          },
                          {
                            "name": "MIDCPNIFTY",
                            "exchange": null,
                            "lot_size": null,
                            "strike_step": null,
                            "expiry_kinds": [],
                            "next_expiry": null,
                            "next_monthly_expiry": null,
                            "spot": null,
                            "spot_stale": false,
                            "note": "No live options or futures in today's instrument list."
                          }
                        ],
                        "mcx_sessions": {
                          "late": {
                            "open": "09:00",
                            "window_close": "23:30",
                            "latest_square_off": "23:00",
                            "default_square_off": "22:45",
                            "close_us_dst": "23:30",
                            "close_us_standard": "23:55",
                            "commodities": [
                              "GOLD",
                              "GOLDM",
                              "GOLDGUINEA",
                              "GOLDPETAL",
                              "SILVER",
                              "SILVERM",
                              "SILVERMIC",
                              "CRUDEOIL",
                              "CRUDEOILM",
                              "NATURALGAS",
                              "NATGASMINI",
                              "COPPER",
                              "ZINC",
                              "ZINCMINI",
                              "ALUMINIUM",
                              "ALUMINI",
                              "LEAD",
                              "LEADMINI",
                              "NICKEL"
                            ]
                          },
                          "early": {
                            "open": "09:00",
                            "window_close": "17:00",
                            "latest_square_off": "16:30",
                            "default_square_off": "16:15",
                            "close": "17:00"
                          },
                          "commodities": []
                        },
                        "switches": {
                          "gallery": true,
                          "portfolio_risk": true,
                          "mcx": false,
                          "stock_fno": false,
                          "equity": false,
                          "stock_universe": false
                        },
                        "engine_connected": false,
                        "usage": {
                          "active_deployments": 0,
                          "active_deployments_left": 3
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/strategies/schema/{schema_file}": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Strategy document JSON Schema",
        "description": "The JSON Schema (draft 2020-12) of the strategy document format, as `{schema_version}.json` (e.g. `1.json`), so editors can validate and autocomplete documents. The raw schema, not the usual envelope; no credential needed.",
        "operationId": "get_auto_strategy_schema",
        "parameters": [
          {
            "name": "schema_file",
            "in": "path",
            "description": "`{schema_version}.json`, e.g. `1.json`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The JSON Schema.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "`schema_not_found`: no such format (or automated strategies are off on this server).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such format",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "schema_not_found",
                        "message": "No such document format; this server has format 1",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v2/strategies/templates": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List strategy templates",
        "description": "Ready strategies to start from (the wizard's goal step): each with a plain-English name, the goal it serves, a one-line description, a category, a risk badge (`limited` or `unlimited` loss), the components and indicators it needs, its summary, whether this server can deploy it now (with the blockers when not), and the document to create from. Templates are data in the component registry: a new one appears here without an app release.",
        "operationId": "list_auto_strategy_templates",
        "responses": {
          "200": {
            "description": "The templates, in display order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoStrategyTemplate"
                },
                "examples": {
                  "success": {
                    "summary": "Ready strategies to start from",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "id": "short_strangle",
                          "name": "Short strangle",
                          "goal": "Earn from a quiet market",
                          "description": "Sell an out-of-the-money call and put each morning; keep the premium while the market stays in a range.",
                          "category": "income",
                          "category_label": "Earn from a quiet market",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [],
                          "needs": [],
                          "summary": "Sell 1 lot of a 0.2 delta call (weekly expiry) and sell 1 lot of a 0.2 delta put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY short strangle",
                              "description": "Sell a 0.2 delta call and put at 09:30 with a combined stop.",
                              "tags": [
                                "nifty",
                                "weekly",
                                "income"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "sc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "delta",
                                      "delta": 0.2
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "delta",
                                      "delta": 0.2
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": null,
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "13:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 3000
                                  },
                                  "target": {
                                    "rupees": 2000
                                  },
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "rsi_strangle",
                          "name": "RSI-gated strangle",
                          "goal": "Earn from a quiet market",
                          "description": "Sell a 0.2 delta strangle only when the 5-minute RSI says the market is calm (between 45 and 60).",
                          "category": "income",
                          "category_label": "Earn from a quiet market",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "app@1",
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [
                            "rsi"
                          ],
                          "needs": [],
                          "summary": "Sell 1 lot of a 0.2 delta call (weekly expiry) and sell 1 lot of a 0.2 delta put (weekly expiry) on NIFTY. Enter when rsi(14, '5m') > 45 && rsi(14, '5m') < 60 (checked at each bar close), between 09:30 and 13:30, Monday to Friday, not on expiry day. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 4 lots per leg. Orders: all legs together, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: keep and manage whatever filled. Protection: stop at ₹3,000 loss, take ₹2,000 profit, move the stop to cost at ₹1,000 profit; each leg: stop at 50% against it; when a leg stops, move the others' stops to cost; stops are also placed at the broker; at most 3 trades and ₹6,000 loss a day. Try again up to 2 times after a stop, 10 minutes later, until 13:30, only on a fresh signal. Updates to app: entered, exited, stops, adjusted, needs attention and daily summary.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.entry.source.when",
                              "label": "When · Entry",
                              "message": "`rsi(14, '5m') > 45 && rsi(14, '5m') < 60` uses rsi, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY RSI strangle",
                              "description": "Sell a 0.2 delta strangle when NIFTY's 5-minute RSI is between 45 and 60.",
                              "tags": [
                                "weekly",
                                "nifty"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {
                                "u": "NSE_INDEX:NIFTY 50"
                              },
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "sc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "delta",
                                      "delta": 0.2
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "delta",
                                      "delta": 0.2
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": "rsi(14, '5m') > 45 && rsi(14, '5m') < 60",
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "13:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "skip",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 4
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "simultaneous",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "keep_and_manage",
                                "retry_next_signal": 0
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": {
                                    "pct": 50
                                  },
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "move_others_to_cost",
                                  "at_broker": true
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 3000
                                  },
                                  "target": {
                                    "rupees": 2000
                                  },
                                  "breakeven": {
                                    "at_rupees": 1000
                                  },
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": 6000,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [
                                  "stop_loss"
                                ],
                                "max": 2,
                                "delay_s": 600,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": "13:30"
                              },
                              "adjustments": [],
                              "notify": [
                                {
                                  "type": "app@1",
                                  "events": [
                                    "entered",
                                    "exited",
                                    "stops",
                                    "adjusted",
                                    "needs_attention",
                                    "daily_summary"
                                  ]
                                }
                              ],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "iron_condor",
                          "name": "Iron condor",
                          "goal": "Earn from a quiet market, safer",
                          "description": "Sell a strangle and buy wings further out, so the most you can lose is known before you enter.",
                          "category": "hedged_income",
                          "category_label": "Earn with protection",
                          "risk": "limited",
                          "risk_label": "Limited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1",
                            "roll_strike@1"
                          ],
                          "indicators": [],
                          "needs": [],
                          "summary": "Sell 1 lot of a 0.16 delta call (weekly expiry), buy 1 lot of a 4-strikes-beyond-sc call (weekly expiry), sell 1 lot of a 0.16 delta put (weekly expiry) and buy 1 lot of a 4-strikes-beyond-sp put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:45 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹4,000 loss, take ₹2,500 profit; no per-leg stops; at most 3 trades a day. No re-entries. Adjust: roll sc to a new strike when sc trades at 2 times its entry price; roll sp to a new strike when sp trades at 2 times its entry price.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY iron condor",
                              "description": "Sell 0.16 delta strikes with wings 4 strikes out, wings bought first; roll the tested side back to 0.16 delta when its premium doubles.",
                              "tags": [
                                "nifty",
                                "weekly",
                                "hedged"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "sc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "delta",
                                      "delta": 0.16
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "lc",
                                    "instrument": "option",
                                    "side": "buy",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "relative",
                                      "to": "sc",
                                      "width_strikes": 4,
                                      "width_points": null
                                    },
                                    "lots": 1,
                                    "hedge_for": "sc",
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "delta",
                                      "delta": 0.16
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "lp",
                                    "instrument": "option",
                                    "side": "buy",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "relative",
                                      "to": "sp",
                                      "width_strikes": 4,
                                      "width_points": null
                                    },
                                    "lots": 1,
                                    "hedge_for": "sp",
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": null,
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:45",
                                  "end": "13:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "hedge_first",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 4000
                                  },
                                  "target": {
                                    "rupees": 2500
                                  },
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [
                                {
                                  "type": "roll_strike@1",
                                  "when": null,
                                  "trigger": {
                                    "on": "premium_ratio",
                                    "leg": "sc",
                                    "ratio": 2
                                  },
                                  "leg": "sc",
                                  "strike": {
                                    "by": "delta",
                                    "delta": 0.16
                                  },
                                  "move_hedge": "lc",
                                  "max_per_cycle": 1
                                },
                                {
                                  "type": "roll_strike@1",
                                  "when": null,
                                  "trigger": {
                                    "on": "premium_ratio",
                                    "leg": "sp",
                                    "ratio": 2
                                  },
                                  "leg": "sp",
                                  "strike": {
                                    "by": "delta",
                                    "delta": 0.16
                                  },
                                  "move_hedge": "lp",
                                  "max_per_cycle": 1
                                }
                              ],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "high_iv_iron_condor",
                          "name": "High-IV iron condor",
                          "goal": "Earn from high volatility, hedged",
                          "description": "When India VIX is above 16 and NIFTY is range-bound, sell 0.16 delta strikes with wings 4 out; roll a side whose premium doubles.",
                          "category": "hedged_income",
                          "category_label": "Earn with protection",
                          "risk": "limited",
                          "risk_label": "Limited loss",
                          "components": [
                            "app@1",
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "delta_hedge@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1",
                            "risk@1",
                            "roll_strike@1",
                            "webhook@1"
                          ],
                          "indicators": [
                            "adx"
                          ],
                          "needs": [],
                          "summary": "Sell 1 lot of a 0.16 delta call (nearest expiry at least 7 days away), buy 1 lot of a 4-strikes-beyond-sc call (nearest expiry at least 7 days away), sell 1 lot of a 0.16 delta put (nearest expiry at least 7 days away) and buy 1 lot of a 4-strikes-beyond-sp put (nearest expiry at least 7 days away) on NIFTY. Enter when vix.ltp > 16 && adx(14, '15m') < 20 (checked at each bar close), between 10:00 and 14:00, on Monday, Tuesday and Wednesday. Positional: trades may stay open overnight. On expiry day, exit at 14:45. Size: as many lots as keep the most one trade can lose under ₹10,000 (from the hedges, else the combined stop), at most 5 lots per leg. Orders: hedges first, limit prices 0.5% beyond the market, chasing up to 1.5% slippage; if only some legs fill: close whatever filled. Protection: stop at 150% of the entry premium loss, take 50% of the entry premium profit, lock profits in 1 steps; no per-leg stops; at most 2 trades and ₹8,000 loss a day. Try again once after a target, 1 hour later, until 14:00. Adjust: roll sc to a new strike when sc trades at 2 times its entry price; roll sp to a new strike when sp trades at 2 times its entry price; hedge the net delta when the net delta leaves ±0.5. Updates to app: entered, exited, stops, adjusted, needs attention and daily summary; webhook: entered, exited and adjusted.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.entry.source.when",
                              "label": "When · Entry",
                              "message": "`vix.ltp > 16 && adx(14, '15m') < 20` uses adx, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY high-IV iron condor",
                              "description": "When India VIX is above 16 and NIFTY is range-bound, sell 0.16 delta strikes with wings 4 strikes out; roll a side whose premium doubles; when the net delta leaves ±0.5 lots, trade the future back to within 0.1.",
                              "tags": [
                                "nifty",
                                "positional"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "synthetic"
                              },
                              "watch": {
                                "u": "NSE_INDEX:NIFTY 50",
                                "vix": "NSE_INDEX:INDIA VIX"
                              },
                              "positional": true,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "sc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "min_dte": 7
                                    },
                                    "strike": {
                                      "by": "delta",
                                      "delta": 0.16
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "lc",
                                    "instrument": "option",
                                    "side": "buy",
                                    "option_type": "call",
                                    "expiry": {
                                      "min_dte": 7
                                    },
                                    "strike": {
                                      "by": "relative",
                                      "to": "sc",
                                      "width_strikes": 4,
                                      "width_points": null
                                    },
                                    "lots": 1,
                                    "hedge_for": "sc",
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "min_dte": 7
                                    },
                                    "strike": {
                                      "by": "delta",
                                      "delta": 0.16
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "lp",
                                    "instrument": "option",
                                    "side": "buy",
                                    "option_type": "put",
                                    "expiry": {
                                      "min_dte": 7
                                    },
                                    "strike": {
                                      "by": "relative",
                                      "to": "sp",
                                      "width_strikes": 4,
                                      "width_points": null
                                    },
                                    "lots": 1,
                                    "hedge_for": "sp",
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": "vix.ltp > 16 && adx(14, '15m') < 20",
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "10:00",
                                  "end": "14:00"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": null,
                                "expiry_day_exit": "14:45",
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "risk@1",
                                "risk_rupees": 10000,
                                "max_lots": 5
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "hedge_first",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1.5,
                                  "max_attempts": 15
                                },
                                "on_incomplete": "close_opened",
                                "retry_next_signal": 0
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "pct_premium",
                                  "stop_loss": {
                                    "pct_premium": 150
                                  },
                                  "target": {
                                    "pct_premium": 50
                                  },
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [
                                    {
                                      "at_pct": 30,
                                      "lock_pct": 10
                                    }
                                  ],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": 8000,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 2,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [
                                  "target"
                                ],
                                "max": 1,
                                "delay_s": 3600,
                                "require_fresh_signal": false,
                                "same_direction_only": true,
                                "until": "14:00"
                              },
                              "adjustments": [
                                {
                                  "type": "roll_strike@1",
                                  "when": null,
                                  "trigger": {
                                    "on": "premium_ratio",
                                    "leg": "sc",
                                    "ratio": 2
                                  },
                                  "leg": "sc",
                                  "strike": {
                                    "by": "delta",
                                    "delta": 0.16
                                  },
                                  "move_hedge": "lc",
                                  "max_per_cycle": 2
                                },
                                {
                                  "type": "roll_strike@1",
                                  "when": null,
                                  "trigger": {
                                    "on": "premium_ratio",
                                    "leg": "sp",
                                    "ratio": 2
                                  },
                                  "leg": "sp",
                                  "strike": {
                                    "by": "delta",
                                    "delta": 0.16
                                  },
                                  "move_hedge": "lp",
                                  "max_per_cycle": 2
                                },
                                {
                                  "type": "delta_hedge@1",
                                  "when": null,
                                  "trigger": {
                                    "on": "delta_band",
                                    "band": 0.5
                                  },
                                  "with": "future",
                                  "target": 0.1,
                                  "min_interval_s": 300,
                                  "max_per_cycle": 3
                                }
                              ],
                              "notify": [
                                {
                                  "type": "app@1",
                                  "events": [
                                    "entered",
                                    "exited",
                                    "stops",
                                    "adjusted",
                                    "needs_attention",
                                    "daily_summary"
                                  ]
                                },
                                {
                                  "type": "webhook@1",
                                  "events": [
                                    "entered",
                                    "exited",
                                    "adjusted"
                                  ]
                                }
                              ],
                              "costs": {
                                "model": "options_india",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "short_straddle",
                          "name": "Short straddle",
                          "goal": "Earn from a very quiet market",
                          "description": "Sell the at-the-money call and put; earns most when the market barely moves, loses fast when it does.",
                          "category": "income",
                          "category_label": "Earn from a quiet market",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [],
                          "needs": [],
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss, take ₹2,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY short straddle",
                              "description": "Sell the ATM call and put at 09:30 with a combined stop.",
                              "tags": [
                                "nifty",
                                "weekly",
                                "income"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "sc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": null,
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "13:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 3000
                                  },
                                  "target": {
                                    "rupees": 2000
                                  },
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "long_straddle",
                          "name": "Long straddle",
                          "goal": "Bet on a big move",
                          "description": "Buy the at-the-money call and put; profits from a big move either way, loses at most the premium paid.",
                          "category": "big_move",
                          "category_label": "Bet on a big move",
                          "risk": "limited",
                          "risk_label": "Limited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "fixed_lots@1",
                            "limits@1",
                            "manual@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [],
                          "needs": [],
                          "summary": "Buy 1 lot of an ATM call (weekly expiry) and buy 1 lot of an ATM put (weekly expiry) on NIFTY. Enter when you tap the button in the app, between 09:30 and 14:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹2,500 loss, take ₹5,000 profit; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY long straddle",
                              "description": "Buy the ATM call and put on your signal, for a big move either way.",
                              "tags": [
                                "nifty",
                                "weekly",
                                "events"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "lc",
                                    "instrument": "option",
                                    "side": "buy",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "lp",
                                    "instrument": "option",
                                    "side": "buy",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "manual@1"
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "14:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 2500
                                  },
                                  "target": {
                                    "rupees": 5000
                                  },
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "bull_call_spread",
                          "name": "Bull call spread",
                          "goal": "Bullish, limited risk",
                          "description": "Buy the at-the-money call and sell one 4 strikes higher; gains if the market rises, loses at most the net premium.",
                          "category": "bullish",
                          "category_label": "Bullish",
                          "risk": "limited",
                          "risk_label": "Limited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "fixed_lots@1",
                            "limits@1",
                            "manual@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [],
                          "needs": [],
                          "summary": "Buy 1 lot of an ATM call (weekly expiry) and sell 1 lot of a 4-strike OTM call (weekly expiry) on NIFTY. Enter when you tap the button in the app, between 09:30 and 14:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: no combined stop or target; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY bull call spread",
                              "description": "Buy the ATM call and sell the call 4 strikes higher, on your signal.",
                              "tags": [
                                "nifty",
                                "weekly",
                                "bullish"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "lc",
                                    "instrument": "option",
                                    "side": "buy",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": "sc",
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 4
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "manual@1"
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "14:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "hedge_first",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": null,
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "bear_put_spread",
                          "name": "Bear put spread",
                          "goal": "Bearish, limited risk",
                          "description": "Buy the at-the-money put and sell one 4 strikes lower; gains if the market falls, loses at most the net premium.",
                          "category": "bearish",
                          "category_label": "Bearish",
                          "risk": "limited",
                          "risk_label": "Limited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "fixed_lots@1",
                            "limits@1",
                            "manual@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [],
                          "needs": [],
                          "summary": "Buy 1 lot of an ATM put (weekly expiry) and sell 1 lot of a 4-strike OTM put (weekly expiry) on NIFTY. Enter when you tap the button in the app, between 09:30 and 14:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: no combined stop or target; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY bear put spread",
                              "description": "Buy the ATM put and sell the put 4 strikes lower, on your signal.",
                              "tags": [
                                "nifty",
                                "weekly",
                                "bearish"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "lp",
                                    "instrument": "option",
                                    "side": "buy",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": "sp",
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 4
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "manual@1"
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "14:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "hedge_first",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": null,
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "first_15_min_breakout",
                          "name": "First-15-minute breakout",
                          "goal": "Catch a breakout",
                          "description": "Buy BANKNIFTY futures when a 5-minute candle closes above the first 15 minutes' high on strong volume.",
                          "category": "breakout",
                          "category_label": "Catch a breakout",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "app@1",
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1",
                            "risk@1"
                          ],
                          "indicators": [
                            "supertrend_dir",
                            "bar_close",
                            "rvol",
                            "orb_high",
                            "orb_ready"
                          ],
                          "needs": [],
                          "summary": "Buy 1 lot of the future (monthly expiry) on BANKNIFTY. Enter when orb_ready(15) && crosses_above(bar_close('5m'), orb_high(15), 10) && rvol(20, '5m') > 1.5 (checked at each bar close), between 09:30 and 11:30, Monday to Friday. Exit everything when crosses_below(supertrend_dir(10, 3, '5m'), 0) (checked at each bar close). Everything closes at 15:10. Size: as many lots as keep the most one trade can lose under ₹4,000 (from the hedges, else the combined stop), at most 3 lots per leg. Orders: all legs together, limit prices 0.1% beyond the market, chasing up to 0.2% slippage; if only some legs fill: keep and manage whatever filled. Protection: take ₹9,000 profit, once 3000 up, give back at most 1500; each leg: stop at 120 points against it; trail the stop by 40 every 40; stops are also placed at the broker; at most 2 trades and ₹8,000 loss a day. Try again once after a stop, 15 minutes later, until 11:30, only on a fresh signal. Updates to app: entered, exited, stops, needs attention and daily summary.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.entry.source.when",
                              "label": "When · Entry",
                              "message": "`orb_ready(15) && crosses_above(bar_close('5m'), orb_high(15), 10) && rvol(20, '5m') > 1.5` uses bar_close, orb_high, orb_ready, rvol, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.exit.sources[0].when",
                              "label": "When · Exit",
                              "message": "`crosses_below(supertrend_dir(10, 3, '5m'), 0)` uses supertrend_dir, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "BANKNIFTY 15-minute breakout",
                              "description": "Buy BANKNIFTY futures when a 5-minute candle closes above the first 15 minutes' high.",
                              "tags": [
                                "banknifty",
                                "intraday"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "BANKNIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {
                                "u": "@future(BANKNIFTY, 0)"
                              },
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "fut",
                                    "instrument": "future",
                                    "side": "buy",
                                    "option_type": null,
                                    "expiry": {
                                      "kind": "monthly",
                                      "n": 0
                                    },
                                    "strike": null,
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": "orb_ready(15) && crosses_above(bar_close('5m'), orb_high(15), 10) && rvol(20, '5m') > 1.5",
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "11:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [
                                  {
                                    "type": "conditions@1",
                                    "when": "crosses_below(supertrend_dir(10, 3, '5m'), 0)",
                                    "on": "close",
                                    "hold_s": 0
                                  }
                                ],
                                "square_off": "15:10",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "risk@1",
                                "risk_rupees": 4000,
                                "max_lots": 3
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "simultaneous",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.1,
                                "chase": {
                                  "every_ms": 500,
                                  "max_slippage_pct": 0.2,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "keep_and_manage",
                                "retry_next_signal": 0
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": {
                                    "points": 120
                                  },
                                  "target": null,
                                  "trail": {
                                    "step": 40,
                                    "move_by": 40
                                  },
                                  "on_leg_stop": "nothing",
                                  "at_broker": true
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": null,
                                  "target": {
                                    "rupees": 9000
                                  },
                                  "breakeven": null,
                                  "trail": {
                                    "arm_at": 3000,
                                    "giveback": 1500,
                                    "step": 500
                                  },
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": 8000,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 2,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [
                                  "stop_loss"
                                ],
                                "max": 1,
                                "delay_s": 900,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": "11:30"
                              },
                              "adjustments": [],
                              "notify": [
                                {
                                  "type": "app@1",
                                  "events": [
                                    "entered",
                                    "exited",
                                    "stops",
                                    "needs_attention",
                                    "daily_summary"
                                  ]
                                }
                              ],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "supertrend_futures",
                          "name": "Supertrend futures",
                          "goal": "Ride a trend",
                          "description": "Buy NIFTY futures when the 15-minute Supertrend turns up and exit when it turns down.",
                          "category": "trend",
                          "category_label": "Ride a trend",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [
                            "supertrend_dir"
                          ],
                          "needs": [],
                          "summary": "Buy 1 lot of the future (monthly expiry) on NIFTY. Enter when crosses_above(supertrend_dir(10, 3, '15m'), 0) (checked at each bar close), between 09:30 and 14:30, Monday to Friday. Exit everything when crosses_below(supertrend_dir(10, 3, '15m'), 0) (checked at each bar close). Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: no combined stop or target; each leg: stop at 100 points against it; at most 3 trades a day. No re-entries.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.entry.source.when",
                              "label": "When · Entry",
                              "message": "`crosses_above(supertrend_dir(10, 3, '15m'), 0)` uses supertrend_dir, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.exit.sources[0].when",
                              "label": "When · Exit",
                              "message": "`crosses_below(supertrend_dir(10, 3, '15m'), 0)` uses supertrend_dir, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY Supertrend futures",
                              "description": "Buy the near-month future when the 15-minute Supertrend turns up; exit when it turns down.",
                              "tags": [
                                "nifty",
                                "futures",
                                "trend"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {
                                "u": "@future(NIFTY, 0)"
                              },
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "fut",
                                    "instrument": "future",
                                    "side": "buy",
                                    "option_type": null,
                                    "expiry": {
                                      "kind": "monthly",
                                      "n": 0
                                    },
                                    "strike": null,
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": "crosses_above(supertrend_dir(10, 3, '15m'), 0)",
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "14:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [
                                  {
                                    "type": "conditions@1",
                                    "when": "crosses_below(supertrend_dir(10, 3, '15m'), 0)",
                                    "on": "close",
                                    "hold_s": 0
                                  }
                                ],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": {
                                    "points": 100
                                  },
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": null,
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "adx_trend_futures",
                          "name": "ADX trend futures",
                          "goal": "Ride a trend",
                          "description": "Buy NIFTY futures when +DI crosses above -DI on the 15-minute chart while ADX says the trend is strong (above 25).",
                          "category": "trend",
                          "category_label": "Ride a trend",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [
                            "adx",
                            "plus_di",
                            "minus_di"
                          ],
                          "needs": [],
                          "summary": "Buy 1 lot of the future (monthly expiry) on NIFTY. Enter when crosses_above(plus_di(14, '15m'), minus_di(14, '15m')) && adx(14, '15m') > 25 (checked at each bar close), between 09:30 and 14:30, Monday to Friday. Exit everything when crosses_below(plus_di(14, '15m'), minus_di(14, '15m')) (checked at each bar close). Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: no combined stop or target; each leg: stop at 100 points against it; at most 3 trades a day. No re-entries.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.entry.source.when",
                              "label": "When · Entry",
                              "message": "`crosses_above(plus_di(14, '15m'), minus_di(14, '15m')) && adx(14, '15m') > 25` uses adx, minus_di, plus_di, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.exit.sources[0].when",
                              "label": "When · Exit",
                              "message": "`crosses_below(plus_di(14, '15m'), minus_di(14, '15m'))` uses minus_di, plus_di, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY ADX trend futures",
                              "description": "Buy the near-month future when 15-minute +DI crosses above -DI with ADX above 25; exit when +DI crosses back below -DI.",
                              "tags": [
                                "nifty",
                                "futures",
                                "trend"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {
                                "u": "@future(NIFTY, 0)"
                              },
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "fut",
                                    "instrument": "future",
                                    "side": "buy",
                                    "option_type": null,
                                    "expiry": {
                                      "kind": "monthly",
                                      "n": 0
                                    },
                                    "strike": null,
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": "crosses_above(plus_di(14, '15m'), minus_di(14, '15m')) && adx(14, '15m') > 25",
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "14:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [
                                  {
                                    "type": "conditions@1",
                                    "when": "crosses_below(plus_di(14, '15m'), minus_di(14, '15m'))",
                                    "on": "close",
                                    "hold_s": 0
                                  }
                                ],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": {
                                    "points": 100
                                  },
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": null,
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "engulfing_call",
                          "name": "Bullish engulfing call",
                          "goal": "Bullish, limited risk",
                          "description": "Buy the at-the-money call when a bullish engulfing candle closes on the 15-minute chart after a dip (RSI below 45).",
                          "category": "bullish",
                          "category_label": "Bullish",
                          "risk": "limited",
                          "risk_label": "Limited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [
                            "rsi",
                            "bullish_pattern"
                          ],
                          "needs": [],
                          "summary": "Buy 1 lot of an ATM call (weekly expiry) on NIFTY. Enter when bullish_pattern('engulfing', '15m') && rsi(14, '15m') < 45 (checked at each bar close), between 09:45 and 14:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: no combined stop or target; each leg: stop at 30% against it; at most 3 trades a day. No re-entries.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.entry.source.when",
                              "label": "When · Entry",
                              "message": "`bullish_pattern('engulfing', '15m') && rsi(14, '15m') < 45` uses bullish_pattern, rsi, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "NIFTY bullish engulfing call",
                              "description": "Buy the ATM weekly call when a bullish engulfing candle closes on NIFTY's 15-minute chart with RSI below 45.",
                              "tags": [
                                "nifty",
                                "weekly",
                                "bullish",
                                "pattern"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {
                                "u": "NSE_INDEX:NIFTY 50"
                              },
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "lc",
                                    "instrument": "option",
                                    "side": "buy",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": "bullish_pattern('engulfing', '15m') && rsi(14, '15m') < 45",
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:45",
                                  "end": "14:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": {
                                    "pct": 30
                                  },
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": null,
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          }
                        },
                        {
                          "id": "stock_ema_crossover",
                          "name": "Stock EMA crossover",
                          "goal": "Ride a trend",
                          "description": "Buy RELIANCE shares intraday when the 9 EMA crosses above the 21 EMA on 5-minute candles; sell on the cross back.",
                          "category": "trend",
                          "category_label": "Ride a trend",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [
                            "ema"
                          ],
                          "needs": [],
                          "summary": "Buy 1 lot of the stock on RELIANCE. Enter when crosses_above(ema(9, '5m'), ema(21, '5m')) (checked at each bar close), between 09:30 and 14:30, Monday to Friday. Exit everything when crosses_below(ema(9, '5m'), ema(21, '5m')) (checked at each bar close). Everything closes at 15:10. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: no combined stop or target; each leg: stop at 1.5% against it; at most 3 trades and ₹2,000 loss a day. No re-entries.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.entry.source.when",
                              "label": "When · Entry",
                              "message": "`crosses_above(ema(9, '5m'), ema(21, '5m'))` uses ema, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.exit.sources[0].when",
                              "label": "When · Exit",
                              "message": "`crosses_below(ema(9, '5m'), ema(21, '5m'))` uses ema, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.stock",
                              "label": "",
                              "message": "The cash equity settings (delivery, capital sizing, circuit gap) aren't available yet",
                              "code": "equity_not_available",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "RELIANCE EMA crossover",
                              "description": "Buy RELIANCE shares (intraday) when the 5-minute 9 EMA crosses above the 21 EMA; sell when it crosses back.",
                              "tags": [
                                "stock",
                                "equity",
                                "trend"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "RELIANCE",
                                "exchange": "NSE",
                                "reference": "spot"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "eq",
                                    "instrument": "stock",
                                    "side": "buy",
                                    "option_type": null,
                                    "expiry": null,
                                    "strike": null,
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": "crosses_above(ema(9, '5m'), ema(21, '5m'))",
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "14:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [
                                  {
                                    "type": "conditions@1",
                                    "when": "crosses_below(ema(9, '5m'), ema(21, '5m'))",
                                    "on": "close",
                                    "hold_s": 0
                                  }
                                ],
                                "square_off": "15:10",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": {
                                    "pct": 1.5
                                  },
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": null,
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": 2000,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              },
                              "stock": {
                                "exit_days_before_expiry": 2,
                                "cover": "strategy",
                                "circuit_gap_pct": 2,
                                "capital_per_trade": 50000,
                                "max_shares": 500
                              }
                            }
                          }
                        },
                        {
                          "id": "stock_opening_breakout",
                          "name": "Stock opening-range breakout",
                          "goal": "Catch a breakout",
                          "description": "Buy RELIANCE shares intraday when a 5-minute candle closes above the first 15 minutes' high.",
                          "category": "breakout",
                          "category_label": "Catch a breakout",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [
                            "bar_close",
                            "orb_high",
                            "orb_low",
                            "orb_ready"
                          ],
                          "needs": [],
                          "summary": "Buy 1 lot of the stock on RELIANCE. Enter when orb_ready(15) && crosses_above(bar_close('5m'), orb_high(15)) (checked at each bar close), between 09:30 and 11:30, Monday to Friday. Exit everything when crosses_below(bar_close('5m'), orb_low(15)) (checked at each bar close). Everything closes at 15:10. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: no combined stop or target; each leg: stop at 1% against it; take profit at 2%; at most 1 trade and ₹2,000 loss a day. No re-entries.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.entry.source.when",
                              "label": "When · Entry",
                              "message": "`orb_ready(15) && crosses_above(bar_close('5m'), orb_high(15))` uses bar_close, orb_high, orb_ready, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.exit.sources[0].when",
                              "label": "When · Exit",
                              "message": "`crosses_below(bar_close('5m'), orb_low(15))` uses bar_close, orb_low, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.stock",
                              "label": "",
                              "message": "The cash equity settings (delivery, capital sizing, circuit gap) aren't available yet",
                              "code": "equity_not_available",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "RELIANCE opening breakout",
                              "description": "Buy RELIANCE shares (intraday) when a 5-minute candle closes above the opening 15-minute range.",
                              "tags": [
                                "stock",
                                "equity",
                                "breakout"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "RELIANCE",
                                "exchange": "NSE",
                                "reference": "spot"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "eq",
                                    "instrument": "stock",
                                    "side": "buy",
                                    "option_type": null,
                                    "expiry": null,
                                    "strike": null,
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": "orb_ready(15) && crosses_above(bar_close('5m'), orb_high(15))",
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "11:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [
                                  {
                                    "type": "conditions@1",
                                    "when": "crosses_below(bar_close('5m'), orb_low(15))",
                                    "on": "close",
                                    "hold_s": 0
                                  }
                                ],
                                "square_off": "15:10",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": {
                                    "pct": 1
                                  },
                                  "target": {
                                    "pct": 2
                                  },
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": null,
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": 2000,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 1,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              },
                              "stock": {
                                "exit_days_before_expiry": 2,
                                "cover": "strategy",
                                "circuit_gap_pct": 2,
                                "capital_per_trade": 50000,
                                "max_shares": 500
                              }
                            }
                          }
                        },
                        {
                          "id": "stock_mean_reversion",
                          "name": "Stock mean reversion",
                          "goal": "Bullish",
                          "description": "Buy RELIANCE shares intraday after a 15-minute close below the lower Bollinger band with RSI under 30; sell at the middle band.",
                          "category": "bullish",
                          "category_label": "Bullish",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [
                            "rsi",
                            "bb_mid",
                            "bb_lower",
                            "bar_close"
                          ],
                          "needs": [],
                          "summary": "Buy 1 lot of the stock on RELIANCE. Enter when bar_close('15m') < bb_lower(20, 2, '15m') && rsi(14, '15m') < 30 (checked at each bar close), between 09:45 and 14:00, Monday to Friday. Exit everything when bar_close('15m') >= bb_mid(20, 2, '15m') (checked at each bar close). Everything closes at 15:10. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: no combined stop or target; each leg: stop at 2% against it; at most 2 trades and ₹2,000 loss a day. No re-entries.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.entry.source.when",
                              "label": "When · Entry",
                              "message": "`bar_close('15m') < bb_lower(20, 2, '15m') && rsi(14, '15m') < 30` uses bar_close, bb_lower, rsi, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.exit.sources[0].when",
                              "label": "When · Exit",
                              "message": "`bar_close('15m') >= bb_mid(20, 2, '15m')` uses bar_close, bb_mid, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                              "code": "not_available_yet",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.stock",
                              "label": "",
                              "message": "The cash equity settings (delivery, capital sizing, circuit gap) aren't available yet",
                              "code": "equity_not_available",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "RELIANCE mean reversion",
                              "description": "Buy RELIANCE shares (intraday) when price closes below the 15-minute lower Bollinger band with RSI under 30; sell back at the middle band.",
                              "tags": [
                                "stock",
                                "equity",
                                "mean-reversion"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "RELIANCE",
                                "exchange": "NSE",
                                "reference": "spot"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "eq",
                                    "instrument": "stock",
                                    "side": "buy",
                                    "option_type": null,
                                    "expiry": null,
                                    "strike": null,
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": "bar_close('15m') < bb_lower(20, 2, '15m') && rsi(14, '15m') < 30",
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:45",
                                  "end": "14:00"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [
                                  {
                                    "type": "conditions@1",
                                    "when": "bar_close('15m') >= bb_mid(20, 2, '15m')",
                                    "on": "close",
                                    "hold_s": 0
                                  }
                                ],
                                "square_off": "15:10",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": {
                                    "pct": 2
                                  },
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": null,
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": 2000,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 2,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              },
                              "stock": {
                                "exit_days_before_expiry": 2,
                                "cover": "strategy",
                                "circuit_gap_pct": 2,
                                "capital_per_trade": 50000,
                                "max_shares": 500
                              }
                            }
                          }
                        },
                        {
                          "id": "covered_call",
                          "name": "Covered call",
                          "goal": "Earn with protection",
                          "description": "Buy RELIANCE shares and sell a 5% out-of-the-money monthly call against them; close two trading days before expiry.",
                          "category": "hedged_income",
                          "category_label": "Earn with protection",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [],
                          "needs": [],
                          "summary": "Buy 1 lot of the stock and sell 1 lot of a 5% OTM call (monthly expiry) on RELIANCE. Enter as soon as the window opens, between 09:30 and 14:30, Monday to Friday. Positional: trades may stay open overnight. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹15,000 loss; no per-leg stops; at most 1 trade a day. No re-entries.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.underlying.name",
                              "label": "Trade · Underlying",
                              "message": "Stock options and futures aren't available for automated strategies yet",
                              "code": "stock_fno_not_available",
                              "needs_ack": false
                            },
                            {
                              "field": "spec.stock",
                              "label": "",
                              "message": "The cash equity settings (delivery, capital sizing, circuit gap) aren't available yet",
                              "code": "equity_not_available",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "RELIANCE covered call",
                              "description": "A buy-write on RELIANCE - buy exactly the shares one monthly call covers and sell that call 5% out of the money; everything closes two trading days before expiry (stock options settle by delivery).",
                              "tags": [
                                "stock",
                                "options",
                                "income",
                                "positional"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "RELIANCE",
                                "exchange": "NFO",
                                "reference": "spot"
                              },
                              "watch": {},
                              "positional": true,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "eq",
                                    "instrument": "stock",
                                    "side": "buy",
                                    "option_type": null,
                                    "expiry": null,
                                    "strike": null,
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "cc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "monthly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "pct_otm",
                                      "pct": 5
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": null,
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "14:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": null,
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 15000
                                  },
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 1,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              },
                              "stock": {
                                "exit_days_before_expiry": 2,
                                "cover": "strategy",
                                "circuit_gap_pct": 2,
                                "capital_per_trade": null,
                                "max_shares": null
                              }
                            }
                          }
                        },
                        {
                          "id": "cash_secured_put",
                          "name": "Cash-secured put",
                          "goal": "Earn from a quiet market",
                          "description": "Sell a 5% out-of-the-money monthly RELIANCE put only with the cash to buy the shares; close two trading days before expiry.",
                          "category": "income",
                          "category_label": "Earn from a quiet market",
                          "risk": "unlimited",
                          "risk_label": "Unlimited loss",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "indicators": [],
                          "needs": [],
                          "summary": "Sell 1 lot of a 5% OTM put (monthly expiry) on RELIANCE. Enter as soon as the window opens, between 09:30 and 14:30, Monday to Friday. Positional: trades may stay open overnight. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹10,000 loss; each leg: stop at 100% against it; at most 1 trade a day. No re-entries.",
                          "deployable": false,
                          "blockers": [
                            {
                              "field": "spec.underlying.name",
                              "label": "Trade · Underlying",
                              "message": "Stock options and futures aren't available for automated strategies yet",
                              "code": "stock_fno_not_available",
                              "needs_ack": false
                            }
                          ],
                          "warnings": [],
                          "document": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "RELIANCE cash-secured put",
                              "description": "Sell a monthly RELIANCE put 5% out of the money when the account holds the cash to buy the shares at the strike; everything closes two trading days before expiry (stock options settle by delivery).",
                              "tags": [
                                "stock",
                                "options",
                                "income",
                                "positional"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "RELIANCE",
                                "exchange": "NFO",
                                "reference": "spot"
                              },
                              "watch": {},
                              "positional": true,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "monthly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "pct_otm",
                                      "pct": 5
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": null,
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "14:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": null,
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": {
                                    "pct": 100
                                  },
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 10000
                                  },
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 1,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              },
                              "stock": {
                                "exit_days_before_expiry": 2,
                                "cover": "strategy",
                                "circuit_gap_pct": 2,
                                "capital_per_trade": null,
                                "max_shares": null
                              }
                            }
                          }
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/strategies/{strategy_id}/deployments": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List a strategy's deployments",
        "description": "The strategy's deployments, newest first.",
        "operationId": "list_auto_strategy_deployments",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deployments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoDeployment"
                },
                "examples": {
                  "success": {
                    "summary": "The strategy's deployments",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "id": "01M59F60KTGB8Z8KZN7YD3NPGJ",
                          "strategy_id": "01M59F60KBWPK7TJJEQJXB3CME",
                          "strategy_name": "NIFTY manual straddle",
                          "version": 1,
                          "mode": "paper",
                          "status": "active",
                          "status_reason": null,
                          "strategy_tag": "auto.01M59F60KTGB",
                          "accounts": [
                            {
                              "account": "P1",
                              "multiplier": 1
                            },
                            {
                              "account": "P2",
                              "multiplier": 2
                            }
                          ],
                          "units": [
                            {
                              "account": "P1",
                              "unit_id": "01M59F60KT01MG5H5YK26WE5MN",
                              "status": "active",
                              "status_reason": null
                            },
                            {
                              "account": "P2",
                              "unit_id": "01M59F60KTKBMX8KK1GDA493S3",
                              "status": "active",
                              "status_reason": null
                            }
                          ],
                          "start_on": null,
                          "end_on": null,
                          "acknowledged": [],
                          "compiled_hash": "sha256:93332f0feac143d79d9430ca8c247082ad8af7ca2820ba1492bc4af7a3c61937",
                          "last_intent": {
                            "action": "deploy",
                            "exit_now": false,
                            "at": "2026-10-19T06:57:00.028Z",
                            "delivered": false
                          },
                          "engine_connected": false,
                          "created_at": "2026-10-19T06:57:00.026Z",
                          "updated_at": "2026-10-19T06:57:00.028Z",
                          "stopped_at": null,
                          "pnl": {
                            "trading_day": "2026-10-19",
                            "realized": 0,
                            "unrealized": 0,
                            "total": 0,
                            "ltp_stale": false
                          }
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such strategy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Deploy a strategy",
        "description": "Runs a version (default: the latest, saving the draft as a new version first when it changed) on 1 to 4 accounts: `paper` (forward test on Paper accounts: live prices, simulated money) or `live` (live accounts; needs the `strategies_live` scope and the account's broker to be open for live deployments). Refused when the version has blockers (422 `not_deployable`), when a warning that needs acknowledging (`unlimited_loss`) is not in `acknowledge` (422 `acknowledgement_required`), or at 3 running deployments. The intent is saved, then handed to the strategy engine: `last_intent.delivered` says whether it took it. Takes an optional `Idempotency-Key`.",
        "operationId": "deploy_auto_strategy",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoDeployInput"
              },
              "examples": {
                "success": {
                  "summary": "A forward test on two paper accounts",
                  "value": {
                    "mode": "paper",
                    "accounts": [
                      {
                        "account": "P1"
                      },
                      {
                        "account": "P2",
                        "multiplier": 2
                      }
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Deployed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoDeployment"
                },
                "examples": {
                  "success": {
                    "summary": "A forward test on two paper accounts",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VKAX6MG5BY1HWXCDNNDJ",
                        "strategy_id": "01M574VKA1TTA2BFREM70ZEB9D",
                        "strategy_name": "NIFTY manual straddle",
                        "version": 1,
                        "mode": "paper",
                        "status": "active",
                        "status_reason": null,
                        "strategy_tag": "auto.01M574VKAX6M",
                        "accounts": [
                          {
                            "account": "P1",
                            "multiplier": 1
                          },
                          {
                            "account": "P2",
                            "multiplier": 2
                          }
                        ],
                        "units": [
                          {
                            "account": "P1",
                            "unit_id": "01M574VKAXNYV06E6HEBZ5VV48",
                            "status": "active",
                            "status_reason": null
                          },
                          {
                            "account": "P2",
                            "unit_id": "01M574VKAXHVS1Y56YFHHSRT9D",
                            "status": "active",
                            "status_reason": null
                          }
                        ],
                        "start_on": null,
                        "end_on": null,
                        "acknowledged": [],
                        "compiled_hash": "sha256:93332f0feac143d79d9430ca8c247082ad8af7ca2820ba1492bc4af7a3c61937",
                        "last_intent": {
                          "action": "deploy",
                          "exit_now": false,
                          "at": "2026-10-18T09:18:04.130Z",
                          "delivered": false
                        },
                        "engine_connected": false,
                        "created_at": "2026-10-18T09:18:04.125Z",
                        "updated_at": "2026-10-18T09:18:04.125Z",
                        "stopped_at": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "malformed_json": {
                    "summary": "An unknown mode",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown variant `demo`, expected `paper` or `live`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user, or an MCP connection's limits (trading, accounts, paper only, live strategies, deployments at once) refuse it; or `live_not_enabled`: live needs the `strategies_live` scope and a broker open for live deployments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "live_not_enabled": {
                    "summary": "The broker is not open for live strategies",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "live_not_enabled",
                        "message": "Live deployments aren't available for pocketful accounts yet",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`, `version_not_found` or `account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "Not one of the user's accounts",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "Account not found for this user",
                        "field": "accounts[0].account"
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`deployment_limit_reached`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "limit_reached": {
                    "summary": "Three deployments already run",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_limit_reached",
                        "message": "At most 3 deployments may run at once; stop one first",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`not_deployable`, `acknowledgement_required` or `invalid_request` (accounts, multipliers, dates).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "acknowledgement_required": {
                    "summary": "Unlimited loss must be acknowledged",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "acknowledgement_required",
                        "message": "Acknowledge to deploy: Protect · Combined protection: Combined stop is missing for a short option: your loss would be unlimited. (unlimited_loss)",
                        "field": "acknowledge"
                      }
                    }
                  },
                  "not_deployable": {
                    "summary": "Indicator conditions are not on this server yet",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "not_deployable",
                        "message": "This version can't be deployed yet:\nWhen · Entry: `rsi(14, '5m') > 60` uses rsi, which isn't available on this server yet (indicator conditions are coming). This strategy can be saved but not deployed until then.",
                        "field": "version"
                      }
                    }
                  },
                  "paper_accounts_only": {
                    "summary": "Forward tests use paper accounts only",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "Forward tests (paper deployments) use paper accounts only",
                        "field": "accounts[0].account"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/deployments/{deployment_id}": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Get a deployment",
        "description": "One deployment with its units (one per account).",
        "operationId": "get_auto_deployment",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoDeployment"
                },
                "examples": {
                  "success": {
                    "summary": "One deployment with its units",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M59F60KTGB8Z8KZN7YD3NPGJ",
                        "strategy_id": "01M59F60KBWPK7TJJEQJXB3CME",
                        "strategy_name": "NIFTY manual straddle",
                        "version": 1,
                        "mode": "paper",
                        "status": "active",
                        "status_reason": null,
                        "strategy_tag": "auto.01M59F60KTGB",
                        "accounts": [
                          {
                            "account": "P1",
                            "multiplier": 1
                          },
                          {
                            "account": "P2",
                            "multiplier": 2
                          }
                        ],
                        "units": [
                          {
                            "account": "P1",
                            "unit_id": "01M59F60KT01MG5H5YK26WE5MN",
                            "status": "active",
                            "status_reason": null
                          },
                          {
                            "account": "P2",
                            "unit_id": "01M59F60KTKBMX8KK1GDA493S3",
                            "status": "active",
                            "status_reason": null
                          }
                        ],
                        "start_on": null,
                        "end_on": null,
                        "acknowledged": [],
                        "compiled_hash": "sha256:93332f0feac143d79d9430ca8c247082ad8af7ca2820ba1492bc4af7a3c61937",
                        "last_intent": {
                          "action": "deploy",
                          "exit_now": false,
                          "at": "2026-10-19T06:57:00.028Z",
                          "delivered": false
                        },
                        "engine_connected": false,
                        "created_at": "2026-10-19T06:57:00.026Z",
                        "updated_at": "2026-10-19T06:57:00.028Z",
                        "stopped_at": null,
                        "pnl": {
                          "trading_day": "2026-10-19",
                          "realized": 0,
                          "unrealized": 0,
                          "total": 0,
                          "ltp_stale": false
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/deployments/{deployment_id}/pause": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Pause a deployment",
        "description": "No new cycles on any account. An open trade keeps being managed by its own rules (stops, target, trailing, square-off): pausing never abandons a position.",
        "operationId": "pause_auto_deployment",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Saved (and handed to the engine when connected).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoDeployment"
                },
                "examples": {
                  "success": {
                    "summary": "No new cycles; open trades stay managed",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VKAX6MG5BY1HWXCDNNDJ",
                        "strategy_id": "01M574VKA1TTA2BFREM70ZEB9D",
                        "strategy_name": "NIFTY manual straddle",
                        "version": 1,
                        "mode": "paper",
                        "status": "paused",
                        "status_reason": "paused_by_user",
                        "strategy_tag": "auto.01M574VKAX6M",
                        "accounts": [
                          {
                            "account": "P1",
                            "multiplier": 1
                          },
                          {
                            "account": "P2",
                            "multiplier": 2
                          }
                        ],
                        "units": [
                          {
                            "account": "P1",
                            "unit_id": "01M574VKAXNYV06E6HEBZ5VV48",
                            "status": "paused",
                            "status_reason": null
                          },
                          {
                            "account": "P2",
                            "unit_id": "01M574VKAXHVS1Y56YFHHSRT9D",
                            "status": "paused",
                            "status_reason": null
                          }
                        ],
                        "start_on": null,
                        "end_on": null,
                        "acknowledged": [],
                        "compiled_hash": "sha256:93332f0feac143d79d9430ca8c247082ad8af7ca2820ba1492bc4af7a3c61937",
                        "last_intent": {
                          "action": "pause",
                          "exit_now": false,
                          "at": "2026-10-18T09:18:07.185Z",
                          "delivered": false
                        },
                        "engine_connected": false,
                        "created_at": "2026-10-18T09:18:04.125Z",
                        "updated_at": "2026-10-18T09:18:07.185Z",
                        "stopped_at": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user, or an MCP connection's limits refuse it (trading off, or an account of the deployment it may not act on: unlisted, or real when paper only; never valued); or `live_not_enabled` (closing live trades needs `strategies_live`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`deployment_finished`: the deployment is stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "finished": {
                    "summary": "The deployment is stopped",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_finished",
                        "message": "This deployment is stopped; deploy the strategy again to run it",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/deployments/{deployment_id}/resume": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Resume a deployment",
        "description": "New cycles again (a paused or errored deployment, once nothing blocks it: the engine checks). After a safety pause (the circuit breaker tripped on an account) the body must acknowledge it: `{\"acknowledged\": true}`, else 422 `acknowledgement_required` with what the breaker saw. The body is optional otherwise.",
        "operationId": "resume_auto_deployment",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "description": "Optional acknowledgement.",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoResumeInput"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved (and handed to the engine when connected).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoDeployment"
                },
                "examples": {
                  "success": {
                    "summary": "New cycles again",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VKAX6MG5BY1HWXCDNNDJ",
                        "strategy_id": "01M574VKA1TTA2BFREM70ZEB9D",
                        "strategy_name": "NIFTY manual straddle",
                        "version": 1,
                        "mode": "paper",
                        "status": "active",
                        "status_reason": null,
                        "strategy_tag": "auto.01M574VKAX6M",
                        "accounts": [
                          {
                            "account": "P1",
                            "multiplier": 1
                          },
                          {
                            "account": "P2",
                            "multiplier": 2
                          }
                        ],
                        "units": [
                          {
                            "account": "P1",
                            "unit_id": "01M574VKAXNYV06E6HEBZ5VV48",
                            "status": "active",
                            "status_reason": null
                          },
                          {
                            "account": "P2",
                            "unit_id": "01M574VKAXHVS1Y56YFHHSRT9D",
                            "status": "active",
                            "status_reason": null
                          }
                        ],
                        "start_on": null,
                        "end_on": null,
                        "acknowledged": [],
                        "compiled_hash": "sha256:93332f0feac143d79d9430ca8c247082ad8af7ca2820ba1492bc4af7a3c61937",
                        "last_intent": {
                          "action": "resume",
                          "exit_now": false,
                          "at": "2026-10-18T09:18:07.257Z",
                          "delivered": false
                        },
                        "engine_connected": false,
                        "created_at": "2026-10-18T09:18:04.125Z",
                        "updated_at": "2026-10-18T09:18:07.257Z",
                        "stopped_at": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "malformed": {
                    "summary": "acknowledged must be true or false",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: invalid type: string \"yes\", expected a boolean",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user, or an MCP connection's limits (trading, accounts, paper only, live strategies) refuse it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`deployment_finished`: the deployment is stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "finished": {
                    "summary": "The deployment is stopped",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_finished",
                        "message": "This deployment is stopped; deploy the strategy again to run it",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`acknowledgement_required`: paused for safety; resume with `{\"acknowledged\": true}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/deployments/{deployment_id}/journey": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "A deployment's journey",
        "description": "Every step on every account, newest first: when, which account and cycle, what happened, what we did, what you should do (empty when nothing), and the broker's own words when a broker answered. Paginated with `cursor`.",
        "operationId": "get_auto_deployment_journey",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` of the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "1 to 200 (default 50).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the journey.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoJourneyPage"
                },
                "examples": {
                  "success": {
                    "summary": "Nothing happened yet: an empty page",
                    "value": {
                      "status": "success",
                      "data": {
                        "entries": [],
                        "next_cursor": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: a bad cursor or limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "bad_limit": {
                    "summary": "limit out of range",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "limit must be 1 to 200",
                        "field": "limit"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: the journey is not kept here.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/deployments/{deployment_id}/stop": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Stop a deployment",
        "description": "No new cycles ever (terminal). The open trade continues to its own exit, or with `exit_now` closes now, mains first and hedges last (live deployments then need `strategies_live`).",
        "operationId": "stop_auto_deployment",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "description": "Optional.",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoStopInput"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "examples": {
                "success": {
                  "summary": "Stopped; open trades run to their own exits",
                  "value": {
                    "exit_now": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoDeployment"
                },
                "examples": {
                  "success": {
                    "summary": "Stopped; open trades run to their own exits",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VNTJ98VMM7TRKT5JCC0T",
                        "strategy_id": "01M574VNQJB3KC6HMDBG6QDEHV",
                        "strategy_name": "Timed",
                        "version": 1,
                        "mode": "paper",
                        "status": "stopped",
                        "status_reason": "stopped_by_user",
                        "strategy_tag": "auto.01M574VNTJ98",
                        "accounts": [
                          {
                            "account": "P1",
                            "multiplier": 1
                          }
                        ],
                        "units": [
                          {
                            "account": "P1",
                            "unit_id": "01M574VNTJF2Z0CBAWNB2BBX14",
                            "status": "stopped",
                            "status_reason": null
                          }
                        ],
                        "start_on": null,
                        "end_on": null,
                        "acknowledged": [],
                        "compiled_hash": "sha256:c030cdecce518bdf50067237a17de0b5508d3e962e743a87dd41e7df3ef01ff9",
                        "last_intent": {
                          "action": "stop",
                          "exit_now": false,
                          "at": "2026-10-18T09:18:08.708Z",
                          "delivered": false
                        },
                        "engine_connected": false,
                        "created_at": "2026-10-18T09:18:06.674Z",
                        "updated_at": "2026-10-18T09:18:08.708Z",
                        "stopped_at": "2026-10-18T09:18:08.708Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user, or an MCP connection's limits refuse it (trading off, or an account of the deployment it may not act on: unlisted, or real when paper only; never valued); or `live_not_enabled`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`deployment_finished`: already stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "finished": {
                    "summary": "The deployment is stopped",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_finished",
                        "message": "This deployment is stopped; deploy the strategy again to run it",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/deployments/{deployment_id}/exit-now": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Exit open trades now",
        "description": "Closes the open cycle on every account now, mains first and hedges last (the user's own instruction). The deployment keeps running. Live deployments need `strategies_live`.",
        "operationId": "exit_auto_deployment_now",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Saved (and handed to the engine when connected).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoDeployment"
                },
                "examples": {
                  "success": {
                    "summary": "Close open trades now, keep running",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VKAX6MG5BY1HWXCDNNDJ",
                        "strategy_id": "01M574VKA1TTA2BFREM70ZEB9D",
                        "strategy_name": "NIFTY manual straddle",
                        "version": 1,
                        "mode": "paper",
                        "status": "active",
                        "status_reason": null,
                        "strategy_tag": "auto.01M574VKAX6M",
                        "accounts": [
                          {
                            "account": "P1",
                            "multiplier": 1
                          },
                          {
                            "account": "P2",
                            "multiplier": 2
                          }
                        ],
                        "units": [
                          {
                            "account": "P1",
                            "unit_id": "01M574VKAXNYV06E6HEBZ5VV48",
                            "status": "active",
                            "status_reason": null
                          },
                          {
                            "account": "P2",
                            "unit_id": "01M574VKAXHVS1Y56YFHHSRT9D",
                            "status": "active",
                            "status_reason": null
                          }
                        ],
                        "start_on": null,
                        "end_on": null,
                        "acknowledged": [],
                        "compiled_hash": "sha256:93332f0feac143d79d9430ca8c247082ad8af7ca2820ba1492bc4af7a3c61937",
                        "last_intent": {
                          "action": "exit_now",
                          "exit_now": true,
                          "at": "2026-10-18T09:18:07.334Z",
                          "delivered": false
                        },
                        "engine_connected": false,
                        "created_at": "2026-10-18T09:18:04.125Z",
                        "updated_at": "2026-10-18T09:18:07.257Z",
                        "stopped_at": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user, or an MCP connection's limits refuse it (trading off, or an account of the deployment it may not act on: unlisted, or real when paper only; never valued); or `live_not_enabled` (closing live trades needs `strategies_live`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`deployment_finished`: the deployment is stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "finished": {
                    "summary": "The deployment is stopped",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_finished",
                        "message": "This deployment is stopped; deploy the strategy again to run it",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/deployments/{deployment_id}/go-live": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Take a forward test live",
        "description": "Creates a live deployment of the same version on the chosen live accounts (`strategies_live` scope; brokers open for live deployments). The forward test keeps running alongside unless `keep_paper` is false. There is no go-live gate: the user decides.",
        "operationId": "go_live_auto_deployment",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "The paper deployment.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoGoLiveInput"
              },
              "examples": {
                "success": {
                  "summary": "The same version live; the forward test stopped",
                  "value": {
                    "accounts": [
                      {
                        "account": "Z1"
                      }
                    ],
                    "keep_paper": false
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The live deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoDeployment"
                },
                "examples": {
                  "success": {
                    "summary": "The same version live; the forward test stopped",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M574VPR4P8457ZBFGSHJ4CRP",
                        "strategy_id": "01M574VKA1TTA2BFREM70ZEB9D",
                        "strategy_name": "NIFTY manual straddle",
                        "version": 1,
                        "mode": "live",
                        "status": "active",
                        "status_reason": null,
                        "strategy_tag": "auto.01M574VPR4P8",
                        "accounts": [
                          {
                            "account": "Z1",
                            "multiplier": 1
                          }
                        ],
                        "units": [
                          {
                            "account": "Z1",
                            "unit_id": "01M574VPR4YP5XCWSC2X6YPR5R",
                            "status": "active",
                            "status_reason": null
                          }
                        ],
                        "start_on": null,
                        "end_on": null,
                        "acknowledged": [],
                        "compiled_hash": "sha256:93332f0feac143d79d9430ca8c247082ad8af7ca2820ba1492bc4af7a3c61937",
                        "last_intent": {
                          "action": "deploy",
                          "exit_now": false,
                          "at": "2026-10-18T09:18:07.623Z",
                          "delivered": false
                        },
                        "engine_connected": false,
                        "created_at": "2026-10-18T09:18:07.620Z",
                        "updated_at": "2026-10-18T09:18:07.620Z",
                        "stopped_at": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` (also: an MCP connection's limits refuse it) or `live_not_enabled`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found` or `account_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`deployment_finished` or `deployment_limit_reached`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "finished": {
                    "summary": "The forward test is stopped",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_finished",
                        "message": "This deployment is stopped; deploy the strategy again to run it",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: not a paper deployment, or the accounts; `not_deployable` or `acknowledgement_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "live_accounts_only": {
                    "summary": "Live deployments use live accounts only",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "Live deployments use live accounts only",
                        "field": "accounts[0].account"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/deployments/{deployment_id}/live": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Live values of a deployment",
        "description": "Per account: the cycle phase, what it is doing now in plain words, and the values the engine reports (indicators, legs, greeks, P&L).",
        "operationId": "get_auto_deployment_live",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Live values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoLiveView"
                },
                "examples": {
                  "success": {
                    "summary": "Live values (engine not connected yet)",
                    "value": {
                      "status": "success",
                      "data": {
                        "deployment_id": "01M574VKAX6MG5BY1HWXCDNNDJ",
                        "engine_connected": false,
                        "units": [
                          {
                            "account": "P1",
                            "phase": "unknown",
                            "now": "The strategy engine isn't connected yet: this was saved and will run once it is.",
                            "values": {}
                          },
                          {
                            "account": "P2",
                            "phase": "unknown",
                            "now": "The strategy engine isn't connected yet: this was saved and will run once it is.",
                            "values": {}
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/deployments/{deployment_id}/cycles": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List a deployment's cycles",
        "description": "Every cycle (entry → manage → exit) on every account, newest first (at most 200), with its legs and P&L.",
        "operationId": "list_auto_deployment_cycles",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cycles.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoCycleView"
                },
                "examples": {
                  "success": {
                    "summary": "No cycles yet",
                    "value": {
                      "status": "success",
                      "data": [],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/deployments/{deployment_id}/cycles/{day}/{n}": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Get a cycle with its journey",
        "description": "Cycle `n` of trading day `day` (`YYYY-MM-DD`) on every account, each with its journey: what happened, why, and what it did.",
        "operationId": "get_auto_deployment_cycle",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "day",
            "in": "path",
            "description": "Trading day, `YYYY-MM-DD`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "n",
            "in": "path",
            "description": "Cycle number on that day, from 1.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The cycle per account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoCycleDetail"
                },
                "examples": {
                  "success": {
                    "summary": "No such cycle yet: an empty list",
                    "value": {
                      "status": "success",
                      "data": [],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/deployments/{deployment_id}/signals": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Send a signal to a deployment",
        "description": "Asks a deployment to enter or exit (manual and API sources; the `Idempotency-Key` header is required). A signal can only ask: every safety check still applies, and the engine answers per account (entries only when the strategy is waiting for one; exits whenever a trade is open). `enter` needs a strategy whose entry source is `manual@1` or `api@1`; an `api@1` signal older than its `max_signal_age_s` is refused. API keys need the `strategies_signal` scope. 202 when the engine has not answered (queued).",
        "operationId": "signal_auto_deployment",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "path",
            "description": "Deployment id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoSignalInput"
              },
              "examples": {
                "queued": {
                  "summary": "Enter now, queued until the engine is connected",
                  "value": {
                    "action": "enter"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "What each account did.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoSignalResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoSignalResult"
                },
                "examples": {
                  "queued": {
                    "summary": "Enter now, queued until the engine is connected",
                    "value": {
                      "status": "success",
                      "data": {
                        "signal_id": "01M574VNDXZP199NRGS1X65WK4",
                        "delivered": false,
                        "units": [
                          {
                            "account": "P1",
                            "accepted": null,
                            "reason": "The strategy engine isn't connected yet: this was saved and will run once it is."
                          },
                          {
                            "account": "P2",
                            "accepted": null,
                            "reason": "The strategy engine isn't connected yet: this was saved and will run once it is."
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`idempotency_key_required`, `invalid_idempotency_key` or `malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "idempotency_key_required": {
                    "summary": "Signals need an Idempotency-Key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "idempotency_key_required",
                        "message": "Idempotency-Key header is required (use a new UUID per request)",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user, the key lacks `strategies_signal`, or the MCP connection's limits refuse it: trading, accounts and paper only for every action, and live strategies for `enter`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies_signal` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`deployment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`deployment_finished`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "finished": {
                    "summary": "The deployment is stopped",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_finished",
                        "message": "This deployment is stopped; deploy the strategy again to run it",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: entries are not taken from signals by this strategy, or the signal is too old; `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "no_signal_entries": {
                    "summary": "This strategy enters on its own conditions",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "This strategy doesn't take entry signals: its entry source is not manual or API",
                        "field": "action"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited` (10 a second per deployment, bursts of 20).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies_signal"
      }
    },
    "/v2/strategies/stop-all": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Stop every strategy",
        "description": "The kill switch: stops every deployment of the caller (no new cycles). With `exit_now`, also closes every strategy trade now (positions of automated strategies only, never manual or signal positions), mains first and hedges last; closing live trades needs `strategies_live`. Takes an optional `Idempotency-Key`.",
        "operationId": "stop_all_auto_strategies",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "description": "Optional.",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoStopAllInput"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "examples": {
                "success": {
                  "summary": "Kill switch: every deployment stopped, trades closing",
                  "value": {
                    "exit_now": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStopAllResult"
                },
                "examples": {
                  "success": {
                    "summary": "Kill switch: every deployment stopped, trades closing",
                    "value": {
                      "status": "success",
                      "data": {
                        "stopped": [
                          "01M574VPR4P8457ZBFGSHJ4CRP",
                          "01M574VP34646M936XME8K18QZ"
                        ],
                        "exit_now": true,
                        "delivered": false
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` (also: an MCP connection with trading off) or `live_not_enabled`. A limited MCP connection stops only the deployments on accounts it may act on; the others keep running (`left_running`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/signal-modes": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List signal modes",
        "description": "Each of the caller's signal URLs with its strategy's mode: `direct` (alerts place orders from the Signals strategy's settings, as before) or `algo` (alerts become signals to a bound automated-strategy deployment, which decides with its own rules and safety checks). App sessions, or API keys / partner tokens with `read`; works whatever the flags (a URL left in algo mode while algo mode is off shows `algo`: its alerts are ignored until it is switched back).",
        "operationId": "list_signal_modes",
        "responses": {
          "200": {
            "description": "Signal URLs and their modes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_SignalModeView"
                },
                "examples": {
                  "success": {
                    "summary": "One URL in algo mode, one direct",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "endpoint_id": "we_5aD4VrIDQtbAm8xA",
                          "kind": "kuberhunt",
                          "strategy_id": "kh-01M59MFHD1WNSQAQCAHHX3DEXZ",
                          "mode": "direct",
                          "deployment_id": null,
                          "switched_at": null,
                          "can_use_algo": false
                        },
                        {
                          "endpoint_id": "we_q02Q5Ag9f6C6q0o5",
                          "kind": "tradingview",
                          "strategy_id": "nifty-alerts-01M59MFHCN0NJ023A39J4CQN2X",
                          "mode": "algo",
                          "deployment_id": "01M59MFHD6BJ6PM60WFMFAV16X",
                          "switched_at": "2026-10-19T08:29:35.023+00:00",
                          "can_use_algo": true
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/signal-modes/{endpoint_id}": {
      "put": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Switch a signal URL's mode",
        "description": "Switches the URL's Signals strategy to `algo` (bound to `deployment_id`) or back to `direct`. The URL, its secrets and what the provider sends do not change. In algo mode an alert is not placed: it becomes a signal to the deployment (TradingView `entry` asks to enter, `exit` to exit; a Chartink alert asks to enter), and the deployment decides with every safety check (entry window, risk, combined stop, daily limits, kill switch, at most one entry per cycle); an exit closes only what the deployment opened.\n\nAllowed only when flat: no position held by the Signals strategy and no open trade on the deployments involved (409 `not_flat`). Kuberhunt URLs stay direct. The deployment must be the caller's, not stopped, and its strategy must take alerts on a signal URL (`webhook@1`). Switching to `algo` needs automated strategies and algo mode for signals enabled for the user; switching back to `direct` always works. While algo mode is off, alerts on a URL left in `algo` are ignored (never placed directly) and the user is told. Takes an optional `Idempotency-Key`. App sessions, or the account holder's API keys with the `strategies` scope (never a partner app); binding or leaving a live deployment, or switching back to `direct` (its alerts place real orders), also needs `strategies_live` on a key.",
        "operationId": "set_signal_mode",
        "parameters": [
          {
            "name": "endpoint_id",
            "in": "path",
            "description": "The signal URL's `endpoint_id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignalModeInput"
              },
              "examples": {
                "to_algo": {
                  "summary": "Alerts now go to an automated strategy",
                  "value": {
                    "mode": "algo",
                    "deployment_id": "01M59MFHD6BJ6PM60WFMFAV16X"
                  }
                },
                "to_direct": {
                  "summary": "Back to placing orders directly",
                  "value": {
                    "mode": "direct"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The URL with its new mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SignalModeView"
                },
                "examples": {
                  "to_algo": {
                    "summary": "Alerts now go to an automated strategy",
                    "value": {
                      "status": "success",
                      "data": {
                        "endpoint_id": "we_q02Q5Ag9f6C6q0o5",
                        "kind": "tradingview",
                        "strategy_id": "nifty-alerts-01M59MFHCN0NJ023A39J4CQN2X",
                        "mode": "algo",
                        "deployment_id": "01M59MFHD6BJ6PM60WFMFAV16X",
                        "switched_at": "2026-10-19T08:29:35.023+00:00",
                        "can_use_algo": true
                      },
                      "error": null
                    }
                  },
                  "to_direct": {
                    "summary": "Back to placing orders directly",
                    "value": {
                      "status": "success",
                      "data": {
                        "endpoint_id": "we_q02Q5Ag9f6C6q0o5",
                        "kind": "tradingview",
                        "strategy_id": "nifty-alerts-01M59MFHCN0NJ023A39J4CQN2X",
                        "mode": "direct",
                        "deployment_id": null,
                        "switched_at": "2026-10-19T08:29:35.032+00:00",
                        "can_use_algo": true
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_api_key": {
                    "summary": "An unknown or revoked API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Invalid API key",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: switching to `algo` while automated strategies or algo mode for signals are not enabled for this user; `live_not_enabled`: an API key without `strategies_live` binding or leaving a live deployment, or switching back to `direct`; or `own_session_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the `strategies` scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`endpoint_not_found` or `deployment_not_found` (also for another user's ids).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "deployment_not_found": {
                    "summary": "Another user's deployment",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "deployment_not_found",
                        "message": "Deployment not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`not_flat`: a position or trade is open; `deployment_finished`: the deployment is stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_flat": {
                    "summary": "A trade is open: switch later",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "not_flat",
                        "message": "Close or wait for the open trade to finish before switching.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: unknown `mode`, `deployment_id` missing for `algo` or given for `direct`, a Kuberhunt URL, a strategy without `webhook@1`, or a strategy the URL's alerts would not trade as sent: its legs must come from the signal (`from_signal@1`), or every alert source must be `trigger_only` (the alert only starts its own legs); a Chartink URL also needs an alert entry source.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "kuberhunt": {
                    "summary": "Kuberhunt URLs stay direct",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "Kuberhunt signal URLs can't use algo mode yet",
                        "field": "endpoint_id"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/risk-limits": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Your overall risk limits",
        "description": "Your limits across every automated strategy and account: the daily loss at which no new trades start (realised plus open, across strategies), the open exposure at which no new trades start, and whether a breached daily loss also closes open trades. `today` is today's P&L of every automated strategy (no charges). Off unless `OMS_AUTO_PORTFOLIO_RISK` is on.",
        "operationId": "get_auto_risk_limits",
        "responses": {
          "200": {
            "description": "Your limits (all `null` when none are set).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoRiskLimits"
                },
                "examples": {
                  "none_set": {
                    "summary": "No limits set yet",
                    "value": {
                      "status": "success",
                      "data": {
                        "max_daily_loss": null,
                        "max_open_exposure": null,
                        "close_on_breach": false,
                        "updated_at": null,
                        "today": {
                          "trading_day": "2026-10-22",
                          "pnl": 0,
                          "ltp_stale": false,
                          "daily_loss_reached": false
                        }
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "Your limits",
                    "value": {
                      "status": "success",
                      "data": {
                        "max_daily_loss": 15000,
                        "max_open_exposure": null,
                        "close_on_breach": true,
                        "updated_at": "2026-10-22T15:22:21.171Z",
                        "today": {
                          "trading_day": "2026-10-22",
                          "pnl": 0,
                          "ltp_stale": false,
                          "daily_loss_reached": false
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: the limits can't be read now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "put": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Set your overall risk limits",
        "description": "Sets your limits across every automated strategy. Fields left out keep their value; `null` removes a limit. Amounts are rupees, positive, at most ₹100 crore. `close_on_breach` (off by default) also closes every open trade when the daily loss limit is reached, and needs `max_daily_loss`. The engine applies a change within about 30 seconds; while it can't read your limits, or today's P&L isn't known, new trades wait (open trades keep every exit). Needs the `strategies_live` scope. Takes an optional `Idempotency-Key`.",
        "operationId": "set_auto_risk_limits",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoRiskLimitsInput"
              },
              "examples": {
                "remove_one": {
                  "summary": "Removing the exposure cap keeps the daily loss limit",
                  "value": {
                    "max_open_exposure": null
                  }
                },
                "success": {
                  "summary": "A daily loss limit that also closes open trades, and an exposure cap",
                  "value": {
                    "max_daily_loss": 15000,
                    "max_open_exposure": 300000,
                    "close_on_breach": true
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The limits now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoRiskLimits"
                },
                "examples": {
                  "remove_one": {
                    "summary": "Removing the exposure cap keeps the daily loss limit",
                    "value": {
                      "status": "success",
                      "data": {
                        "max_daily_loss": 15000,
                        "max_open_exposure": null,
                        "close_on_breach": true,
                        "updated_at": "2026-10-22T15:22:21.171Z"
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A daily loss limit that also closes open trades, and an exposure cap",
                    "value": {
                      "status": "success",
                      "data": {
                        "max_daily_loss": 15000,
                        "max_open_exposure": 300000,
                        "close_on_breach": true,
                        "updated_at": "2026-10-22T15:22:21.147Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled; `live_not_enabled`: the credential lacks `strategies_live`; also a connection without live strategies or limited to paper accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` with `field`: not a positive amount, above ₹100 crore, or `close_on_breach` without a daily loss limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "close_without_daily_limit": {
                    "summary": "Closing on a breach needs a daily loss limit",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "closing open trades on a breach needs a daily loss limit",
                        "field": "close_on_breach"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: nothing was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/strategies/{strategy_id}/gallery": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List a strategy in the gallery",
        "description": "Sends a saved version (default: the newest) to the public gallery for staff review. It needs at least 20 finished trades of that version in your own `paper` or `live` runs (the badge), a deployable version with no unlimited loss left without a combined stop, and no promise of results in its name or description. Published performance is in percent of the `capital` you ran it with (return, max drawdown, win rate, trades): never rupees or quantities; the capital itself is seen by you and the reviewers only. You appear under `display_name`, never your username or email. `price_credits` above 0 makes it a paid template: only while paid templates are on (`GET /v2/gallery/pricing`), within the tenant's limits, else 422. One listing per strategy may wait for review at a time. Off unless `OMS_AUTO_GALLERY` is on. Takes an optional `Idempotency-Key`.",
        "operationId": "publish_auto_strategy_to_gallery",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AutoGalleryPublishInput"
              },
              "examples": {
                "success": {
                  "summary": "Version 1 sent for review as a paid template",
                  "value": {
                    "display_name": "Theta Lab",
                    "badge": "paper",
                    "capital": 200000,
                    "price_credits": 25
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Waiting for review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoGalleryMyListing"
                },
                "examples": {
                  "success": {
                    "summary": "Version 1 sent for review as a paid template",
                    "value": {
                      "status": "success",
                      "data": {
                        "listing": {
                          "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                          "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                          "description": "Weekly ATM straddle with a combined stop",
                          "tags": [
                            "weekly"
                          ],
                          "underlying": "NIFTY",
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "author": "Theta Lab",
                          "badge": "paper",
                          "label": "Past results on paper (simulated); not advice.",
                          "performance": {
                            "return_pct": 1.75,
                            "max_drawdown_pct": 0.74,
                            "win_rate_pct": 66.67,
                            "trades": 21,
                            "since": "2026-09-01",
                            "until": "2026-09-21"
                          },
                          "price_credits": 25,
                          "effective_price": 25,
                          "is_free": false,
                          "price_reason": "priced",
                          "non_refundable": true,
                          "copies": 0,
                          "listed_at": "2026-10-26T14:14:50.318Z",
                          "can_copy": true,
                          "mine": true
                        },
                        "strategy_id": "01M5W90R03C4SMJZRNMFG0AM8Q",
                        "version": 1,
                        "status": "pending",
                        "review_notes": "",
                        "capital": 200000,
                        "purchases": 0,
                        "asking_price_credits": 25,
                        "admin_free": false
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `strategies` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found` / `version_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "strategy_not_found": {
                    "summary": "Someone else's strategy",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`no_saved_version`, `not_enough_cycles` or `listing_pending`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "listing_pending": {
                    "summary": "One listing per strategy waits for review",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "listing_pending",
                        "message": "A listing of this strategy is already waiting for review; withdraw it first.",
                        "field": null
                      }
                    }
                  },
                  "not_enough_cycles": {
                    "summary": "Fewer than 20 finished trades",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "not_enough_cycles",
                        "message": "A listing needs at least 20 finished trades of this version with the chosen badge; it has 0.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` with `field`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "display_name_is_username": {
                    "summary": "A display name that gives away the username",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "choose a name that isn't your username or email",
                        "field": "display_name"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/gallery": {
      "get": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Browse the gallery",
        "description": "Approved listings, newest first (or by `return` / `popular`), searchable. Each shows the author's display name, a Paper or Live badge, and past performance in percent of capital only, with \"not advice\". Never the author's username, accounts, rupee amounts or quantities. Without documents.",
        "operationId": "list_gallery",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Words to find in the name, description, tags, underlying or author\n(at most 64 characters).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "badge",
            "in": "query",
            "description": "`paper` or `live`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "price",
            "in": "query",
            "description": "`free` or `paid`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "`newest` (default), `return` or `popular`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "1–50 (default 20).",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Listings to skip (at most 1,000).",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Listings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoGalleryListing"
                },
                "examples": {
                  "success": {
                    "summary": "Approved listings matching a search",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                          "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                          "description": "Weekly ATM straddle with a combined stop",
                          "tags": [
                            "weekly"
                          ],
                          "underlying": "NIFTY",
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "author": "Theta Lab",
                          "badge": "paper",
                          "label": "Past results on paper (simulated); not advice.",
                          "performance": {
                            "return_pct": 1.75,
                            "max_drawdown_pct": 0.74,
                            "win_rate_pct": 66.67,
                            "trades": 21,
                            "since": "2026-09-01",
                            "until": "2026-09-21"
                          },
                          "price_credits": 25,
                          "effective_price": 25,
                          "is_free": false,
                          "price_reason": "priced",
                          "non_refundable": true,
                          "copies": 0,
                          "listed_at": "2026-10-26T14:14:50.411Z",
                          "can_copy": false,
                          "mine": false
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` with `field`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_request": {
                    "summary": "A page size above 50",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "1 to 50",
                        "field": "limit"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v2/gallery/mine": {
      "get": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Your gallery listings",
        "description": "Your listings in every state (`pending`, `approved`, `rejected`, `taken_down`, `withdrawn`) with the reviewers' notes, newest first.",
        "operationId": "list_my_gallery_listings",
        "responses": {
          "200": {
            "description": "Your listings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoGalleryMyListing"
                },
                "examples": {
                  "success": {
                    "summary": "Your listing waiting for review",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "listing": {
                            "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                            "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                            "description": "Weekly ATM straddle with a combined stop",
                            "tags": [
                              "weekly"
                            ],
                            "underlying": "NIFTY",
                            "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                            "author": "Theta Lab",
                            "badge": "paper",
                            "label": "Past results on paper (simulated); not advice.",
                            "performance": {
                              "return_pct": 1.75,
                              "max_drawdown_pct": 0.74,
                              "win_rate_pct": 66.67,
                              "trades": 21,
                              "since": "2026-09-01",
                              "until": "2026-09-21"
                            },
                            "price_credits": 25,
                            "effective_price": 25,
                            "is_free": false,
                            "price_reason": "priced",
                            "non_refundable": true,
                            "copies": 0,
                            "listed_at": "2026-10-26T14:14:50.318Z",
                            "can_copy": true,
                            "mine": true
                          },
                          "strategy_id": "01M5W90R03C4SMJZRNMFG0AM8Q",
                          "version": 1,
                          "status": "pending",
                          "review_notes": "",
                          "capital": 200000,
                          "purchases": 0,
                          "asking_price_credits": 25,
                          "admin_free": false
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v2/gallery/{listing_id}": {
      "get": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Get a gallery listing",
        "description": "One approved listing (or one of yours, in any state). `document` is included when you may copy it: free, bought, or yours.",
        "operationId": "get_gallery_listing",
        "parameters": [
          {
            "name": "listing_id",
            "in": "path",
            "description": "Listing id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The listing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoGalleryListing"
                },
                "examples": {
                  "success": {
                    "summary": "A paid listing before buying it",
                    "value": {
                      "status": "success",
                      "data": {
                        "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                        "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                        "description": "Weekly ATM straddle with a combined stop",
                        "tags": [
                          "weekly"
                        ],
                        "underlying": "NIFTY",
                        "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                        "author": "Theta Lab",
                        "badge": "paper",
                        "label": "Past results on paper (simulated); not advice.",
                        "performance": {
                          "return_pct": 1.75,
                          "max_drawdown_pct": 0.74,
                          "win_rate_pct": 66.67,
                          "trades": 21,
                          "since": "2026-09-01",
                          "until": "2026-09-21"
                        },
                        "price_credits": 25,
                        "effective_price": 25,
                        "is_free": false,
                        "price_reason": "priced",
                        "non_refundable": true,
                        "copies": 0,
                        "listed_at": "2026-10-26T14:14:50.411Z",
                        "can_copy": false,
                        "mine": false
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`listing_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "listing_not_found": {
                    "summary": "Not approved yet (or withdrawn)",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "listing_not_found",
                        "message": "No such listing: it was withdrawn, taken down, or never existed.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      },
      "delete": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Withdraw your listing",
        "description": "Takes your listing out of the gallery (or out of review). Copies already made and purchases stay. Takes an optional `Idempotency-Key`.",
        "operationId": "withdraw_gallery_listing",
        "parameters": [
          {
            "name": "listing_id",
            "in": "path",
            "description": "Listing id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Withdrawn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoGalleryMyListing"
                },
                "examples": {
                  "success": {
                    "summary": "Taken out of the gallery",
                    "value": {
                      "status": "success",
                      "data": {
                        "listing": {
                          "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                          "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                          "description": "Weekly ATM straddle with a combined stop",
                          "tags": [
                            "weekly"
                          ],
                          "underlying": "NIFTY",
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "author": "Theta Lab",
                          "badge": "paper",
                          "label": "Past results on paper (simulated); not advice.",
                          "performance": {
                            "return_pct": 1.75,
                            "max_drawdown_pct": 0.74,
                            "win_rate_pct": 66.67,
                            "trades": 21,
                            "since": "2026-09-01",
                            "until": "2026-09-21"
                          },
                          "price_credits": 25,
                          "effective_price": 25,
                          "is_free": false,
                          "price_reason": "priced",
                          "non_refundable": true,
                          "copies": 2,
                          "listed_at": "2026-10-26T14:14:50.411Z",
                          "can_copy": true,
                          "mine": true
                        },
                        "strategy_id": "01M5W90R03C4SMJZRNMFG0AM8Q",
                        "version": 1,
                        "status": "withdrawn",
                        "review_notes": "Checked: stop-loss present, honest name",
                        "capital": 200000,
                        "purchases": 1,
                        "asking_price_credits": 25,
                        "admin_free": false
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`listing_not_found`: not yours, or already withdrawn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "listing_not_found": {
                    "summary": "Someone else's listing",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "listing_not_found",
                        "message": "No such listing: it was withdrawn, taken down, or never existed.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v2/gallery/{listing_id}/copy": {
      "post": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Copy a listing into your strategies",
        "description": "A new draft of yours from the listed version, recording where it came from (the author's display name). It never deploys. A priced listing is bought (and copied) with `POST /v2/gallery/{id}/purchase`; free ones (paid templates off, staff made it free, no price) and ones you bought copy here. Takes an optional `Idempotency-Key`.",
        "operationId": "copy_gallery_listing",
        "parameters": [
          {
            "name": "listing_id",
            "in": "path",
            "description": "Listing id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Your new draft.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoImportResult"
                },
                "examples": {
                  "success": {
                    "summary": "A bought template copied into your drafts",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy": {
                          "id": "01M5W90RG5GJE0A04VDBQ3MKPN",
                          "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                          "description": "Weekly ATM straddle with a combined stop",
                          "tags": [
                            "weekly"
                          ],
                          "display_status": "draft",
                          "latest_version": 0,
                          "revision": 1,
                          "visibility": "private",
                          "forked_from": {
                            "strategy_id": "01M5W90R03C4SMJZRNMFG0AM8Q",
                            "version": 1
                          },
                          "archived": false,
                          "deployments": {
                            "active": 0,
                            "paused": 0,
                            "error": 0,
                            "stopped": 0
                          },
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "deployable": true,
                          "blockers": [],
                          "warnings": [],
                          "schema_version": 1,
                          "draft": {
                            "$schema": "/v2/strategies/schema/1.json",
                            "schema_version": 1,
                            "kind": "cirrus.strategy",
                            "metadata": {
                              "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                              "description": "Weekly ATM straddle with a combined stop",
                              "tags": [
                                "weekly"
                              ]
                            },
                            "spec": {
                              "underlying": {
                                "name": "NIFTY",
                                "exchange": "NFO",
                                "reference": "future"
                              },
                              "watch": {},
                              "positional": false,
                              "legs": {
                                "selector": "chain@1",
                                "items": [
                                  {
                                    "id": "sc",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "call",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  },
                                  {
                                    "id": "sp",
                                    "instrument": "option",
                                    "side": "sell",
                                    "option_type": "put",
                                    "expiry": {
                                      "kind": "weekly",
                                      "n": 0
                                    },
                                    "strike": {
                                      "by": "atm",
                                      "offset": 0
                                    },
                                    "lots": 1,
                                    "hedge_for": null,
                                    "risk": null,
                                    "liquidity": {
                                      "max_spread_pct": 3,
                                      "min_oi": 0,
                                      "min_premium": 1
                                    }
                                  }
                                ]
                              },
                              "entry": {
                                "source": {
                                  "type": "conditions@1",
                                  "when": null,
                                  "on": "close",
                                  "hold_s": 0
                                },
                                "window": {
                                  "start": "09:30",
                                  "end": "13:30"
                                },
                                "skip_first_min": 0,
                                "skip_last_min": 0,
                                "days": [
                                  "mon",
                                  "tue",
                                  "wed",
                                  "thu",
                                  "fri"
                                ],
                                "expiry_day": "normal",
                                "active_from": null,
                                "active_until": null
                              },
                              "exit": {
                                "sources": [],
                                "square_off": "15:15",
                                "expiry_day_exit": null,
                                "max_hold_min": null
                              },
                              "sizing": {
                                "type": "fixed_lots@1",
                                "max_lots": 10
                              },
                              "execution": {
                                "type": "protected_limit@1",
                                "order": "auto",
                                "hedge_wait_ms": 5000,
                                "stagger_ms": 0,
                                "buffer_pct": 0.5,
                                "chase": {
                                  "every_ms": 1000,
                                  "max_slippage_pct": 1,
                                  "max_attempts": 10
                                },
                                "on_incomplete": "safest",
                                "retry_next_signal": null
                              },
                              "risk": {
                                "per_leg": {
                                  "type": "per_leg@1",
                                  "stop_loss": null,
                                  "target": null,
                                  "trail": null,
                                  "on_leg_stop": "nothing",
                                  "at_broker": false
                                },
                                "combined": {
                                  "type": "combined@1",
                                  "scope": "account",
                                  "basis": "rupees",
                                  "stop_loss": {
                                    "rupees": 3000
                                  },
                                  "target": null,
                                  "breakeven": null,
                                  "trail": null,
                                  "lock_ladder": [],
                                  "deployment": null
                                },
                                "limits": {
                                  "type": "limits@1",
                                  "max_loss_per_day": null,
                                  "max_profit_per_day": null,
                                  "max_loss_per_week": null,
                                  "max_cycles_per_day": 3,
                                  "max_orders_per_day": 50,
                                  "exit_on_limit": true,
                                  "on_breaker": "nothing"
                                }
                              },
                              "reentry": {
                                "on": [],
                                "max": 0,
                                "delay_s": 300,
                                "require_fresh_signal": true,
                                "same_direction_only": true,
                                "until": null
                              },
                              "adjustments": [],
                              "notify": [],
                              "costs": {
                                "model": "auto",
                                "slippage_pct": null
                              }
                            }
                          },
                          "created_at": "2026-10-26T14:14:50.629Z",
                          "updated_at": "2026-10-26T14:14:50.629Z"
                        },
                        "validation": {
                          "ok": true,
                          "deployable": true,
                          "schema_version": 1,
                          "migrated_from": null,
                          "errors": [],
                          "blockers": [],
                          "warnings": [],
                          "needs_ack": [],
                          "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                          "compiled_hash": "sha256:44ffd35c2d50344cd553dba925e707521b55be5023eae9a4a165acdc1190a9cf",
                          "components": [
                            "chain@1",
                            "combined@1",
                            "conditions@1",
                            "fixed_lots@1",
                            "limits@1",
                            "per_leg@1",
                            "protected_limit@1"
                          ],
                          "warm_up": null
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`listing_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "listing_not_found": {
                    "summary": "Withdrawn listings can't be copied",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "listing_not_found",
                        "message": "No such listing: it was withdrawn, taken down, or never existed.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`purchase_required`: buy it first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "purchase_required": {
                    "summary": "Buy a paid template first",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "purchase_required",
                        "message": "This template costs 25 credits; buying it makes your copy. Purchases are non-refundable.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v2/gallery/{listing_id}/purchase": {
      "post": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Buy a paid listing",
        "description": "Buys a priced listing with your platform credits and makes your copy in the same step (`copy`, a new draft): **purchases are non-refundable**, and nothing is charged unless the copy is made. The price is the listing's `effective_price` (free while paid templates are off, during a promotion, or when staff made it free: copy those instead). The author receives their share of the credits (`GET /v2/gallery/pricing`). Buying again changes nothing (`charged: 0`, your receipt); retry a failed attempt with the same `Idempotency-Key` (it is never charged twice), or a new one after `purchase_failed`. Your own listings are copied, not bought. Needs an `Idempotency-Key`.",
        "operationId": "purchase_gallery_listing",
        "parameters": [
          {
            "name": "listing_id",
            "in": "path",
            "description": "Listing id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bought and copied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoGalleryPurchase"
                },
                "examples": {
                  "success": {
                    "summary": "Bought for 25 credits and copied (non-refundable)",
                    "value": {
                      "status": "success",
                      "data": {
                        "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                        "charged": 25,
                        "balance": 75,
                        "receipt": {
                          "receipt_id": "gal_f75aea3e834242cd8c671c041702e4a6",
                          "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                          "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                          "author": "Theta Lab",
                          "charged_credits": 25,
                          "strategy_id": "62M3WVQ8PSDFR8MSDHPBFG6E4D",
                          "bought_at": "2026-10-26T14:14:50.557Z",
                          "non_refundable": true
                        },
                        "copy": {
                          "strategy": {
                            "id": "62M3WVQ8PSDFR8MSDHPBFG6E4D",
                            "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                            "description": "Weekly ATM straddle with a combined stop",
                            "tags": [
                              "weekly"
                            ],
                            "display_status": "draft",
                            "latest_version": 0,
                            "revision": 1,
                            "visibility": "private",
                            "forked_from": {
                              "strategy_id": "01M5W90R03C4SMJZRNMFG0AM8Q",
                              "version": 1
                            },
                            "archived": false,
                            "deployments": {
                              "active": 0,
                              "paused": 0,
                              "error": 0,
                              "stopped": 0
                            },
                            "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                            "deployable": true,
                            "blockers": [],
                            "warnings": [],
                            "schema_version": 1,
                            "draft": {
                              "$schema": "/v2/strategies/schema/1.json",
                              "schema_version": 1,
                              "kind": "cirrus.strategy",
                              "metadata": {
                                "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                                "description": "Weekly ATM straddle with a combined stop",
                                "tags": [
                                  "weekly"
                                ]
                              },
                              "spec": {
                                "underlying": {
                                  "name": "NIFTY",
                                  "exchange": "NFO",
                                  "reference": "future"
                                },
                                "watch": {},
                                "positional": false,
                                "legs": {
                                  "selector": "chain@1",
                                  "items": [
                                    {
                                      "id": "sc",
                                      "instrument": "option",
                                      "side": "sell",
                                      "option_type": "call",
                                      "expiry": {
                                        "kind": "weekly",
                                        "n": 0
                                      },
                                      "strike": {
                                        "by": "atm",
                                        "offset": 0
                                      },
                                      "lots": 1,
                                      "hedge_for": null,
                                      "risk": null,
                                      "liquidity": {
                                        "max_spread_pct": 3,
                                        "min_oi": 0,
                                        "min_premium": 1
                                      }
                                    },
                                    {
                                      "id": "sp",
                                      "instrument": "option",
                                      "side": "sell",
                                      "option_type": "put",
                                      "expiry": {
                                        "kind": "weekly",
                                        "n": 0
                                      },
                                      "strike": {
                                        "by": "atm",
                                        "offset": 0
                                      },
                                      "lots": 1,
                                      "hedge_for": null,
                                      "risk": null,
                                      "liquidity": {
                                        "max_spread_pct": 3,
                                        "min_oi": 0,
                                        "min_premium": 1
                                      }
                                    }
                                  ]
                                },
                                "entry": {
                                  "source": {
                                    "type": "conditions@1",
                                    "when": null,
                                    "on": "close",
                                    "hold_s": 0
                                  },
                                  "window": {
                                    "start": "09:30",
                                    "end": "13:30"
                                  },
                                  "skip_first_min": 0,
                                  "skip_last_min": 0,
                                  "days": [
                                    "mon",
                                    "tue",
                                    "wed",
                                    "thu",
                                    "fri"
                                  ],
                                  "expiry_day": "normal",
                                  "active_from": null,
                                  "active_until": null
                                },
                                "exit": {
                                  "sources": [],
                                  "square_off": "15:15",
                                  "expiry_day_exit": null,
                                  "max_hold_min": null
                                },
                                "sizing": {
                                  "type": "fixed_lots@1",
                                  "max_lots": 10
                                },
                                "execution": {
                                  "type": "protected_limit@1",
                                  "order": "auto",
                                  "hedge_wait_ms": 5000,
                                  "stagger_ms": 0,
                                  "buffer_pct": 0.5,
                                  "chase": {
                                    "every_ms": 1000,
                                    "max_slippage_pct": 1,
                                    "max_attempts": 10
                                  },
                                  "on_incomplete": "safest",
                                  "retry_next_signal": null
                                },
                                "risk": {
                                  "per_leg": {
                                    "type": "per_leg@1",
                                    "stop_loss": null,
                                    "target": null,
                                    "trail": null,
                                    "on_leg_stop": "nothing",
                                    "at_broker": false
                                  },
                                  "combined": {
                                    "type": "combined@1",
                                    "scope": "account",
                                    "basis": "rupees",
                                    "stop_loss": {
                                      "rupees": 3000
                                    },
                                    "target": null,
                                    "breakeven": null,
                                    "trail": null,
                                    "lock_ladder": [],
                                    "deployment": null
                                  },
                                  "limits": {
                                    "type": "limits@1",
                                    "max_loss_per_day": null,
                                    "max_profit_per_day": null,
                                    "max_loss_per_week": null,
                                    "max_cycles_per_day": 3,
                                    "max_orders_per_day": 50,
                                    "exit_on_limit": true,
                                    "on_breaker": "nothing"
                                  }
                                },
                                "reentry": {
                                  "on": [],
                                  "max": 0,
                                  "delay_s": 300,
                                  "require_fresh_signal": true,
                                  "same_direction_only": true,
                                  "until": null
                                },
                                "adjustments": [],
                                "notify": [],
                                "costs": {
                                  "model": "auto",
                                  "slippage_pct": null
                                }
                              }
                            },
                            "created_at": "2026-10-26T14:14:50.566Z",
                            "updated_at": "2026-10-26T14:14:50.566Z"
                          },
                          "validation": {
                            "ok": true,
                            "deployable": true,
                            "schema_version": 1,
                            "migrated_from": null,
                            "errors": [],
                            "blockers": [],
                            "warnings": [],
                            "needs_ack": [],
                            "summary": "Sell 1 lot of an ATM call (weekly expiry) and sell 1 lot of an ATM put (weekly expiry) on NIFTY. Enter as soon as the window opens, between 09:30 and 13:30, Monday to Friday. Everything closes at 15:15. Size: the legs' lots times each account's multiplier, at most 10 lots per leg. Orders: hedges first when there are any, limit prices 0.5% beyond the market, chasing up to 1% slippage; if only some legs fill: close a sold option left without its hedge, keep the rest. Protection: stop at ₹3,000 loss; no per-leg stops; at most 3 trades a day. No re-entries.",
                            "compiled_hash": "sha256:44ffd35c2d50344cd553dba925e707521b55be5023eae9a4a165acdc1190a9cf",
                            "components": [
                              "chain@1",
                              "combined@1",
                              "conditions@1",
                              "fixed_lots@1",
                              "limits@1",
                              "per_leg@1",
                              "protected_limit@1"
                            ],
                            "warm_up": null
                          }
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`idempotency_key_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "idempotency_key_required": {
                    "summary": "A purchase needs an Idempotency-Key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "idempotency_key_required",
                        "message": "Idempotency-Key header is required (use a new UUID per request)",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`listing_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "listing_not_found": {
                    "summary": "No such listing",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "listing_not_found",
                        "message": "No such listing: it was withdrawn, taken down, or never existed.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`insufficient_credits`, `purchase_failed` (nothing charged) or `purchase_in_progress` (retry with the same key).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "insufficient_credits": {
                    "summary": "Not enough credits; nothing charged",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "insufficient_credits",
                        "message": "This template costs 25 credits and you have 0. Nothing was charged.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: free now, or yours.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_request": {
                    "summary": "Your own listing is copied free, not bought",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "this listing is yours; copy it for free",
                        "field": "listing_id"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`credits_unavailable`: nothing charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v2/credits": {
      "get": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Your platform credits",
        "description": "Your credit balance (your platform credits wallet: buys paid gallery templates; your share of your templates' sales adds to it) and its latest gallery changes. Only while paid templates are on (else 403).",
        "operationId": "get_credits",
        "responses": {
          "200": {
            "description": "Your credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoCredits"
                },
                "examples": {
                  "success": {
                    "summary": "Credits after buying a template",
                    "value": {
                      "status": "success",
                      "data": {
                        "balance": 75,
                        "entries": [
                          {
                            "at": "2026-10-26T14:14:50.558Z",
                            "delta": -25,
                            "balance_after": 75,
                            "kind": "purchase",
                            "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                            "note": "Gallery template \"Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH\" by Theta Lab (non-refundable)"
                          },
                          {
                            "at": "2026-10-26T14:14:50.530Z",
                            "delta": 100,
                            "balance_after": 100,
                            "kind": "grant",
                            "listing_id": null,
                            "note": "Credits added by staff"
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery or paid templates are not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`credits_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v2/strategies/{strategy_id}/gallery/eligibility": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Whether a version may be listed",
        "description": "For a saved version (default: the newest), per badge (`paper`, `live`): its finished trades in your own runs of that mode, and whether they reach the 20 a listing needs, with the reason when not. Counted from the same runs as listing it. The other listing checks (a deployable version, a combined stop for unlimited loss, no promise of results, one listing waiting for review) run when you list it. Off unless `OMS_AUTO_GALLERY` is on.",
        "operationId": "get_auto_strategy_gallery_eligibility",
        "parameters": [
          {
            "name": "strategy_id",
            "in": "path",
            "description": "Strategy id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "query",
            "description": "The saved version (default: the newest).",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per badge.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoGalleryEligibility"
                },
                "examples": {
                  "success": {
                    "summary": "Paper ready, live not yet",
                    "value": {
                      "status": "success",
                      "data": {
                        "strategy_id": "01M5W6711PRZGP3VMPA499ES8J",
                        "version": 1,
                        "required_cycles": 20,
                        "badges": [
                          {
                            "badge": "paper",
                            "finished_cycles": 20,
                            "eligible": true,
                            "reason": null
                          },
                          {
                            "badge": "live",
                            "finished_cycles": 0,
                            "eligible": false,
                            "reason": "A listing needs at least 20 finished trades of this version with the chosen badge; it has 0."
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`strategy_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "strategy_not_found": {
                    "summary": "No such strategy of yours",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "strategy_not_found",
                        "message": "Strategy not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`no_saved_version`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "no_saved_version": {
                    "summary": "Only a draft",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "no_saved_version",
                        "message": "Save a version first: a listing is a saved version, never the draft.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: the runs can't be read now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/strategies/stock-status": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Today's stock safety checks",
        "description": "For each stock asked (1 to 50 NSE symbols), the checks the engine runs before a new stock entry today: `fno_ban` (NSE's F&O ban list; options and futures), `ex_date` (today's corporate actions; shares and F&O) and `circuit` (the price within `circuit_gap_pct` of a circuit limit; shares). Each check is `clear`, `blocked` or `unknown` (a list not written for today, stale or unreadable, a stock not in today's list, or no fresh price: new entries wait, as in the engine), with the engine's waiting `code` and a `reason`. `new_entries` is the worst of the three. Open trades keep every exit whatever these say.",
        "operationId": "get_auto_stock_status",
        "parameters": [
          {
            "name": "symbols",
            "in": "query",
            "description": "NSE symbols, comma separated (1 to 50), e.g. `RELIANCE,TCS`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "circuit_gap_pct",
            "in": "query",
            "description": "The circuit gap to check (0.5 to 10 percent of the limit, default\n2): a strategy's `stock.circuit_gap_pct`.",
            "required": false,
            "schema": {
              "type": "number",
              "format": "double"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The checks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoStockStatusList"
                },
                "examples": {
                  "success": {
                    "summary": "An ex-date, a stock near its circuit and a banned one",
                    "value": {
                      "status": "success",
                      "data": {
                        "trading_day": "2026-10-26",
                        "circuit_gap_pct": 2,
                        "stocks": [
                          {
                            "name": "RELIANCE",
                            "new_entries": "blocked",
                            "fno_ban": {
                              "state": "clear",
                              "code": null,
                              "reason": null
                            },
                            "ex_date": {
                              "state": "blocked",
                              "code": "ex_date",
                              "reason": "RELIANCE goes ex-date today"
                            },
                            "corporate_actions": [
                              "Dividend - Rs 10 Per Share"
                            ],
                            "circuit": {
                              "state": "clear",
                              "code": null,
                              "reason": null,
                              "ltp": 1400,
                              "lower_circuit": 1260,
                              "upper_circuit": 1540
                            }
                          },
                          {
                            "name": "TCS",
                            "new_entries": "blocked",
                            "fno_ban": {
                              "state": "clear",
                              "code": null,
                              "reason": null
                            },
                            "ex_date": {
                              "state": "clear",
                              "code": null,
                              "reason": null
                            },
                            "corporate_actions": [],
                            "circuit": {
                              "state": "blocked",
                              "code": "circuit",
                              "reason": "TCS: it trades at 3500.00, within 2% of its upper circuit 3520.00",
                              "ltp": 3500,
                              "lower_circuit": 3150,
                              "upper_circuit": 3520
                            }
                          },
                          {
                            "name": "IDEA",
                            "new_entries": "blocked",
                            "fno_ban": {
                              "state": "blocked",
                              "code": "fno_ban",
                              "reason": "IDEA is in NSE's F&O ban period today"
                            },
                            "ex_date": {
                              "state": "clear",
                              "code": null,
                              "reason": null
                            },
                            "corporate_actions": [],
                            "circuit": {
                              "state": "unknown",
                              "code": "circuit_unknown",
                              "reason": "IDEA: its circuit limits or price are not known",
                              "ltp": null,
                              "lower_circuit": null,
                              "upper_circuit": null
                            }
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key without the scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` with `field`: bad `symbols` or `circuit_gap_pct`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_request": {
                    "summary": "Not an NSE symbol",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "A B isn't an NSE symbol",
                        "field": "symbols"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/gallery/pricing": {
      "get": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Paid-template settings",
        "description": "Whether paid templates are on for this tenant, the promotion, the price limits authors set within, the author's share of a sale, and that purchases are non-refundable. Each listing also carries `effective_price`, `is_free` and `price_reason`.",
        "operationId": "get_gallery_pricing",
        "responses": {
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoGalleryPricing"
                },
                "examples": {
                  "success": {
                    "summary": "Paid templates on, 70% to the author",
                    "value": {
                      "status": "success",
                      "data": {
                        "paid_enabled": true,
                        "all_free": false,
                        "min_price_credits": 10,
                        "max_price_credits": 10000,
                        "author_share_pct": 70,
                        "non_refundable": true,
                        "purchases_available": true
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v2/gallery/purchases": {
      "get": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Your purchase receipts",
        "description": "Templates you bought, newest first (at most 500): what you paid, your copy and the receipt id (also on your wallet's transaction). Purchases are non-refundable.",
        "operationId": "list_gallery_purchases",
        "responses": {
          "200": {
            "description": "Your receipts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_AutoGalleryReceipt"
                },
                "examples": {
                  "success": {
                    "summary": "Your receipts",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "receipt_id": "gal_f75aea3e834242cd8c671c041702e4a6",
                          "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                          "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                          "author": "Theta Lab",
                          "charged_credits": 25,
                          "strategy_id": "62M3WVQ8PSDFR8MSDHPBFG6E4D",
                          "bought_at": "2026-10-26T14:14:50.557Z",
                          "non_refundable": true
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v2/gallery/earnings": {
      "get": {
        "tags": [
          "automated_strategies",
          "app_session_only"
        ],
        "summary": "Your earnings as an author",
        "description": "Sales of your templates (latest 500) and your share of them in platform credits, overall and per template. Earnings are credits you can spend on the platform: no withdrawal or payout. Never names a buyer.",
        "operationId": "get_gallery_earnings",
        "responses": {
          "200": {
            "description": "Your earnings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AutoGalleryEarnings"
                },
                "examples": {
                  "success": {
                    "summary": "One sale: 17 of 25 credits",
                    "value": {
                      "status": "success",
                      "data": {
                        "author_share_pct": 70,
                        "sales": 1,
                        "credits_earned": 17,
                        "templates": [
                          {
                            "listing_id": "01M5W90R6E1MM606W1ZM1WW4S1",
                            "name": "Weekly straddle 01M5W90QZWNR5ZDD6W1Z44VGCH",
                            "sales": 1,
                            "credits_earned": 17
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the gallery is not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "forbidden": {
                    "summary": "An API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "Only available when signed in to the app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v2/backtests": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List backtests",
        "description": "The caller's backtests, newest first (at most 50; kept 30 days), without their daily equity.",
        "operationId": "list_auto_backtests",
        "responses": {
          "200": {
            "description": "Backtests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_BacktestView"
                },
                "examples": {
                  "success": {
                    "summary": "The caller's backtests",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "id": "01M66QA2YJGRWYHB9VJRAW6BRW",
                          "strategy_id": "01M66QA2V4VGYTC47SA6EEBXZM",
                          "version": 1,
                          "status": "cancelled",
                          "from": "2026-10-14",
                          "to": "2026-10-16",
                          "capital": 500000,
                          "costs": {
                            "charges": "india",
                            "slippage_bps": 2,
                            "spread_proxy_bps": 10
                          },
                          "progress": {
                            "done": 0,
                            "total": 0
                          },
                          "cancel_requested": true,
                          "created_at": "2026-10-30T15:37:00.627Z",
                          "started_at": null,
                          "finished_at": "2026-10-30T15:37:00.640Z",
                          "expires_at": "2026-11-29T15:37:00.627Z",
                          "error": null,
                          "summary": null,
                          "labels": null,
                          "sources": [],
                          "counts": {
                            "trades": 0,
                            "cycles": 0
                          }
                        },
                        {
                          "id": "01M66QA2X382CT2C47RR5XN0FY",
                          "strategy_id": "01M66QA2V4VGYTC47SA6EEBXZM",
                          "version": 1,
                          "status": "done",
                          "from": "2026-10-14",
                          "to": "2026-10-16",
                          "capital": 500000,
                          "costs": {
                            "charges": "india",
                            "slippage_bps": 2,
                            "spread_proxy_bps": 10
                          },
                          "progress": {
                            "done": 3,
                            "total": 3
                          },
                          "cancel_requested": false,
                          "created_at": "2026-10-30T15:37:00.588Z",
                          "started_at": "2026-10-30T15:37:00.752Z",
                          "finished_at": "2026-10-30T15:37:02.016Z",
                          "expires_at": "2026-11-29T15:37:00.588Z",
                          "error": null,
                          "summary": {
                            "capital": 500000,
                            "final_equity": 496635.79,
                            "net_pnl": -3364.21,
                            "charges": 307.96,
                            "cycles": 3,
                            "trades": 12,
                            "wins": 0,
                            "losses": 3,
                            "win_rate": 0,
                            "best_cycle": -54.99,
                            "worst_cycle": -3176.51,
                            "avg_cycle": -1121.4,
                            "max_drawdown": 3592.73,
                            "max_drawdown_pct": 0.0072,
                            "days": 3,
                            "days_traded": 3,
                            "metrics": {
                              "total_return": -0.0066,
                              "cagr": -0.4276,
                              "annualized_vol": 0.0462,
                              "sharpe": -12.247,
                              "sortino": -9.6967,
                              "calmar": -64.5952,
                              "max_drawdown": 0.0066,
                              "profit_factor": 0
                            },
                            "band": null
                          },
                          "labels": {
                            "estimated": true,
                            "text": "Estimated: option prices are modelled from NIFTY and India VIX, not real trades",
                            "notes": [
                              "Expiries follow the exchange's weekday rules, strikes are 50 points apart and one lot is 75 units (today's lot size).",
                              "Every strike uses the same volatility: India VIX × 1; real prices have a skew.",
                              "Fills follow the forward test's rules: protected limits on entry, crossing the spread on exit, 2 bps slippage."
                            ]
                          },
                          "sources": [
                            {
                              "series": "underlying",
                              "symbol": "CT:EX:BTNIFTY50",
                              "source": "chart_api",
                              "estimated": false
                            },
                            {
                              "series": "vix",
                              "symbol": "CT:EX:BTINDIAVIX",
                              "source": "chart_api",
                              "estimated": false
                            },
                            {
                              "series": "options",
                              "symbol": "NFO:NIFTY",
                              "source": "estimator",
                              "estimated": true,
                              "note": "no option history yet: prices are modelled"
                            },
                            {
                              "series": "futures",
                              "symbol": "NFO:NIFTY",
                              "source": "estimator",
                              "estimated": true,
                              "note": "no option history yet: prices are modelled"
                            }
                          ],
                          "counts": {
                            "trades": 12,
                            "cycles": 3
                          }
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Start a backtest",
        "description": "Queues a backtest of a saved strategy version over past days. It runs the same engine as live deployments over 1-minute history, with simulated fills by the forward test's rules; option prices are modelled from the underlying and India VIX when no option history exists, and the result says so (`labels`). Poll `GET /v2/backtests/{backtest_id}`. Limits: at most 1098 days (3 years) per run, 3 queued or running and 50 a day per user, 10 submissions a minute.",
        "operationId": "create_auto_backtest",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BacktestInput"
              },
              "examples": {
                "queued": {
                  "summary": "Queued for a worker",
                  "value": {
                    "strategy_id": "01M66QA2V4VGYTC47SA6EEBXZM",
                    "version": 1,
                    "from": "2026-10-14",
                    "to": "2026-10-16",
                    "capital": 500000,
                    "costs": {
                      "charges": "india",
                      "slippage_bps": 2
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_BacktestView"
                },
                "examples": {
                  "queued": {
                    "summary": "Queued for a worker",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M66QA2X382CT2C47RR5XN0FY",
                        "strategy_id": "01M66QA2V4VGYTC47SA6EEBXZM",
                        "version": 1,
                        "status": "queued",
                        "from": "2026-10-14",
                        "to": "2026-10-16",
                        "capital": 500000,
                        "costs": {
                          "charges": "india",
                          "slippage_bps": 2,
                          "spread_proxy_bps": 10
                        },
                        "progress": {
                          "done": 0,
                          "total": 0
                        },
                        "cancel_requested": false,
                        "created_at": "2026-10-30T15:37:00.588Z",
                        "started_at": null,
                        "finished_at": null,
                        "expires_at": "2026-11-29T15:37:00.588Z",
                        "error": null,
                        "summary": null,
                        "labels": null,
                        "sources": [],
                        "counts": {
                          "trades": 0,
                          "cycles": 0
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`version_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`backtest_limit_reached`: too many running or today.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "limit_reached": {
                    "summary": "Three are already queued or running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "backtest_limit_reached",
                        "message": "At most 3 backtests may run at once; wait for one to finish or cancel one",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: a bad range, capital or cost, or a strategy that can't be backtested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "bad_range": {
                    "summary": "from after to",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "from must be on or before to",
                        "field": "from"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/backtests/{backtest_id}": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Get a backtest",
        "description": "Where the backtest is (`queued`, `running` with `progress`, `done`, `failed`, `cancelled`) and, once done, its summary, daily equity, labels and sources.",
        "operationId": "get_auto_backtest",
        "parameters": [
          {
            "name": "backtest_id",
            "in": "path",
            "description": "Backtest id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The backtest.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_BacktestView"
                },
                "examples": {
                  "done": {
                    "summary": "A finished backtest on modelled option prices",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M66QA2X382CT2C47RR5XN0FY",
                        "strategy_id": "01M66QA2V4VGYTC47SA6EEBXZM",
                        "version": 1,
                        "status": "done",
                        "from": "2026-10-14",
                        "to": "2026-10-16",
                        "capital": 500000,
                        "costs": {
                          "charges": "india",
                          "slippage_bps": 2,
                          "spread_proxy_bps": 10
                        },
                        "progress": {
                          "done": 3,
                          "total": 3
                        },
                        "cancel_requested": false,
                        "created_at": "2026-10-30T15:37:00.588Z",
                        "started_at": "2026-10-30T15:37:00.752Z",
                        "finished_at": "2026-10-30T15:37:02.016Z",
                        "expires_at": "2026-11-29T15:37:00.588Z",
                        "error": null,
                        "summary": {
                          "capital": 500000,
                          "final_equity": 496635.79,
                          "net_pnl": -3364.21,
                          "charges": 307.96,
                          "cycles": 3,
                          "trades": 12,
                          "wins": 0,
                          "losses": 3,
                          "win_rate": 0,
                          "best_cycle": -54.99,
                          "worst_cycle": -3176.51,
                          "avg_cycle": -1121.4,
                          "max_drawdown": 3592.73,
                          "max_drawdown_pct": 0.0072,
                          "days": 3,
                          "days_traded": 3,
                          "metrics": {
                            "total_return": -0.0066,
                            "cagr": -0.4276,
                            "annualized_vol": 0.0462,
                            "sharpe": -12.247,
                            "sortino": -9.6967,
                            "calmar": -64.5952,
                            "max_drawdown": 0.0066,
                            "profit_factor": 0
                          },
                          "band": null
                        },
                        "labels": {
                          "estimated": true,
                          "text": "Estimated: option prices are modelled from NIFTY and India VIX, not real trades",
                          "notes": [
                            "Expiries follow the exchange's weekday rules, strikes are 50 points apart and one lot is 75 units (today's lot size).",
                            "Every strike uses the same volatility: India VIX × 1; real prices have a skew.",
                            "Fills follow the forward test's rules: protected limits on entry, crossing the spread on exit, 2 bps slippage."
                          ]
                        },
                        "sources": [
                          {
                            "series": "underlying",
                            "symbol": "CT:EX:BTNIFTY50",
                            "source": "chart_api",
                            "estimated": false
                          },
                          {
                            "series": "vix",
                            "symbol": "CT:EX:BTINDIAVIX",
                            "source": "chart_api",
                            "estimated": false
                          },
                          {
                            "series": "options",
                            "symbol": "NFO:NIFTY",
                            "source": "estimator",
                            "estimated": true,
                            "note": "no option history yet: prices are modelled"
                          },
                          {
                            "series": "futures",
                            "symbol": "NFO:NIFTY",
                            "source": "estimator",
                            "estimated": true,
                            "note": "no option history yet: prices are modelled"
                          }
                        ],
                        "equity": [
                          {
                            "day": "2026-10-14",
                            "equity": 499945.01,
                            "pnl": -54.99,
                            "drawdown": 283.51
                          },
                          {
                            "day": "2026-10-15",
                            "equity": 499812.3,
                            "pnl": -132.71,
                            "drawdown": 416.22
                          },
                          {
                            "day": "2026-10-16",
                            "equity": 496635.79,
                            "pnl": -3176.51,
                            "drawdown": 3592.73
                          }
                        ],
                        "counts": {
                          "trades": 12,
                          "cycles": 3
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`backtest_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such backtest",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "backtest_not_found",
                        "message": "Backtest not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/backtests/{backtest_id}/trades": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List a backtest's trades",
        "description": "The simulated fills of a finished backtest in time order, a page at a time (`offset`, `limit` up to 200). `estimated` marks modelled prices.",
        "operationId": "list_auto_backtest_trades",
        "parameters": [
          {
            "name": "backtest_id",
            "in": "path",
            "description": "Backtest id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of trades.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TradesPage"
                },
                "examples": {
                  "success": {
                    "summary": "The first two fills",
                    "value": {
                      "status": "success",
                      "data": {
                        "items": [
                          {
                            "n": 1,
                            "day": "2026-10-14",
                            "cycle": 1,
                            "leg_id": "sc",
                            "symbol": "BT:NFO:NIFTY:20261019:24450:CE",
                            "side": "SELL",
                            "qty": 75,
                            "price": 36.6,
                            "charges": 27.74,
                            "at_ms": 1791950400000,
                            "purpose": "entry",
                            "estimated": true
                          },
                          {
                            "n": 2,
                            "day": "2026-10-14",
                            "cycle": 1,
                            "leg_id": "sp",
                            "symbol": "BT:NFO:NIFTY:20261019:23850:PE",
                            "side": "SELL",
                            "qty": 75,
                            "price": 45.5,
                            "charges": 28.74,
                            "at_ms": 1791950400000,
                            "purpose": "entry",
                            "estimated": true
                          }
                        ],
                        "offset": 0,
                        "limit": 2,
                        "total": 12
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`backtest_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: a bad limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/backtests/{backtest_id}/cycles": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List a backtest's cycles",
        "description": "The cycles of a finished backtest in time order, each with its P&L and journey (the engine's own steps and sentences), a page at a time (`offset`, `limit` up to 200).",
        "operationId": "list_auto_backtest_cycles",
        "parameters": [
          {
            "name": "backtest_id",
            "in": "path",
            "description": "Backtest id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of cycles.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_CyclesPage"
                },
                "examples": {
                  "success": {
                    "summary": "The first cycle and its journey",
                    "value": {
                      "status": "success",
                      "data": {
                        "items": [
                          {
                            "n": 1,
                            "day": "2026-10-14",
                            "cycle": 1,
                            "opened_at_ms": 1791950400000,
                            "closed_at_ms": 1791971100000,
                            "exit_reason": "square_off",
                            "pnl": -54.99,
                            "charges": 103.74,
                            "steps": [
                              {
                                "at_ms": 1791950400000,
                                "code": "entry_sent",
                                "phase": "entering",
                                "text": "The entry window is open (time-based entry). Entering: sell 1 lot call, sell 1 lot put."
                              },
                              {
                                "at_ms": 1791950400000,
                                "code": "entered",
                                "phase": "managing",
                                "text": "Entered: sold 75 × BT:NFO:NIFTY:20261019:24450:CE at ₹36.60, sold 75 × BT:NFO:NIFTY:20261019:23850:PE at ₹45.50. Protected: combined stop at -₹3,000, target at +₹2,000, square-off at 15:15."
                              },
                              {
                                "at_ms": 1791971100000,
                                "code": "exit_sent",
                                "phase": "exiting",
                                "text": "Square-off time: P&L +₹75. Closing the trade."
                              },
                              {
                                "at_ms": 1791971100000,
                                "code": "cycle_closed",
                                "phase": "cooldown",
                                "text": "Closed every leg. Trade P&L +₹49 (charges excluded). Today: +₹49 · 1 of 3 trades."
                              },
                              {
                                "at_ms": 1791971100000,
                                "code": "finished",
                                "phase": "finished",
                                "text": "No more trades today (re-entry rules)."
                              }
                            ]
                          }
                        ],
                        "offset": 0,
                        "limit": 1,
                        "total": 3
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`backtest_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: a bad limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v2/backtests/{backtest_id}/cancel": {
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Cancel a backtest",
        "description": "A queued backtest is cancelled at once; a running one stops within seconds (`cancel_requested` until it does). A finished one answers 409 `backtest_finished`.",
        "operationId": "cancel_auto_backtest",
        "parameters": [
          {
            "name": "backtest_id",
            "in": "path",
            "description": "Backtest id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The backtest after the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_BacktestView"
                },
                "examples": {
                  "cancelled": {
                    "summary": "A queued backtest is cancelled at once",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M66QA2YJGRWYHB9VJRAW6BRW",
                        "strategy_id": "01M66QA2V4VGYTC47SA6EEBXZM",
                        "version": 1,
                        "status": "cancelled",
                        "from": "2026-10-14",
                        "to": "2026-10-16",
                        "capital": 500000,
                        "costs": {
                          "charges": "india",
                          "slippage_bps": 2,
                          "spread_proxy_bps": 10
                        },
                        "progress": {
                          "done": 0,
                          "total": 0
                        },
                        "cancel_requested": true,
                        "created_at": "2026-10-30T15:37:00.627Z",
                        "started_at": null,
                        "finished_at": "2026-10-30T15:37:00.640Z",
                        "expires_at": "2026-11-29T15:37:00.627Z",
                        "error": null,
                        "summary": null,
                        "labels": null,
                        "sources": [],
                        "counts": {
                          "trades": 0,
                          "cycles": 0
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`backtest_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`backtest_finished`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "finished": {
                    "summary": "Nothing to cancel",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "backtest_finished",
                        "message": "This backtest has already finished",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/backtests/sweeps": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "List sweeps",
        "description": "The caller's sweeps, newest first (at most 50; kept 30 days), without their versions.",
        "operationId": "list_auto_backtest_sweeps",
        "responses": {
          "200": {
            "description": "Sweeps.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_SweepView"
                },
                "examples": {
                  "success": {
                    "summary": "The caller's sweeps",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "id": "01M6729QKEQ99A4TXHNMZAA7NG",
                          "strategy_id": "01M6729PTSDV47N0JD25NBZQVX",
                          "version": 1,
                          "status": "done",
                          "from": "2026-10-14",
                          "to": "2026-10-16",
                          "capital": 500000,
                          "costs": {
                            "charges": "india",
                            "slippage_bps": 2,
                            "spread_proxy_bps": 10
                          },
                          "axes": [
                            {
                              "path": "/spec/legs/items/0/strike/delta",
                              "values": [
                                0.15,
                                0.2
                              ]
                            },
                            {
                              "path": "/spec/risk/combined/stop_loss/rupees",
                              "values": [
                                2000,
                                3000
                              ]
                            }
                          ],
                          "progress": {
                            "total": 4,
                            "queued": 0,
                            "running": 0,
                            "done": 3,
                            "failed": 1,
                            "cancelled": 0
                          },
                          "cost": 1,
                          "cancel_requested": false,
                          "created_at": "2026-10-30T18:49:03.347Z",
                          "finished_at": "2026-10-30T18:49:04.277Z",
                          "expires_at": "2026-11-29T18:49:03.347Z",
                          "error": null,
                          "recommended": 0,
                          "warnings": [
                            "Best result may be luck: after testing 3 versions, the chance the best one is really better than average is low (deflated Sharpe 0.17).",
                            "Fewer than 30 trades: too few to judge."
                          ],
                          "notes": [
                            "Walk-forward test skipped: it needs at least 100 trading days of history (20 per window), and this sweep has 3.",
                            "Overfitting check (PBO) skipped: it needs at least 16 versions, and this sweep has 3.",
                            "1 of 4 versions did not finish (failed or cancelled) and are left out of the checks."
                          ],
                          "deflated_sharpe": 0.1691982360279356,
                          "pbo": null,
                          "walk_forward": null
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Start a sweep",
        "description": "Backtests every version of up to 3 settings of a saved strategy version over the same past days (one backtest per version, same history and fill rules as `POST /v2/backtests`). Each setting is a JSON pointer to a number in the strategy document and the values to try; at most 200 versions, each checked as a strategy document. Poll `GET /v2/backtests/sweeps/{sweep_id}`: once done it names the recommended version (the best plateau of neighbouring settings, not the best single result) and the overfitting warnings to show before deploy. One sweep at a time per user; its versions run at most 3 at a time, sharing workers fairly with other users. A sweep counts as 1 backtest plus 1 per 20 versions against the 50 a day, and as one of the 3 running at once.",
        "operationId": "create_auto_backtest_sweep",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SweepInput"
              },
              "examples": {
                "queued": {
                  "summary": "Four versions queued",
                  "value": {
                    "strategy_id": "01M66YJSSC5QFRPRW0AF5Y9HXM",
                    "version": 1,
                    "from": "2026-10-14",
                    "to": "2026-10-16",
                    "axes": [
                      {
                        "path": "/spec/legs/items/0/strike/delta",
                        "values": [
                          0.15,
                          0.2
                        ]
                      },
                      {
                        "path": "/spec/risk/combined/stop_loss/rupees",
                        "values": [
                          2000,
                          3000
                        ]
                      }
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SweepView"
                },
                "examples": {
                  "queued": {
                    "summary": "Four versions queued",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M66YJTX11JWSA4K90RGYJPMA",
                        "strategy_id": "01M66YJSSC5QFRPRW0AF5Y9HXM",
                        "version": 1,
                        "status": "running",
                        "from": "2026-10-14",
                        "to": "2026-10-16",
                        "capital": 500000,
                        "costs": {
                          "charges": "india",
                          "slippage_bps": 2,
                          "spread_proxy_bps": 10
                        },
                        "axes": [
                          {
                            "path": "/spec/legs/items/0/strike/delta",
                            "values": [
                              0.15,
                              0.2
                            ]
                          },
                          {
                            "path": "/spec/risk/combined/stop_loss/rupees",
                            "values": [
                              2000,
                              3000
                            ]
                          }
                        ],
                        "progress": {
                          "total": 4,
                          "queued": 4,
                          "running": 0,
                          "done": 0,
                          "failed": 0,
                          "cancelled": 0
                        },
                        "cost": 1,
                        "cancel_requested": false,
                        "created_at": "2026-10-30T17:44:07.342Z",
                        "finished_at": null,
                        "expires_at": "2026-11-29T17:44:07.342Z",
                        "error": null,
                        "recommended": null,
                        "warnings": [],
                        "notes": [],
                        "deflated_sharpe": null,
                        "pbo": null,
                        "walk_forward": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`version_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`backtest_limit_reached`: a sweep already running, too many running, or not enough left today.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: a bad setting path or value, too many versions, a version that is not a valid strategy, or a bad range, capital or cost.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_setting": {
                    "summary": "A path that is not a setting",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "/spec/legs/items/0/strike/gamma is not a setting of this strategy (a JSON pointer such as /spec/legs/items/0/strike/delta)",
                        "field": "axes"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v2/backtests/sweeps/{sweep_id}": {
      "get": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Get a sweep",
        "description": "Where the sweep is (`running` with `progress`, then `done`, `failed` or `cancelled`), every version with its values, status and summary, and once done the recommended version, its scores, the warnings to show before deploy and notes on checks that did not run or versions left out.",
        "operationId": "get_auto_backtest_sweep",
        "parameters": [
          {
            "name": "sweep_id",
            "in": "path",
            "description": "Sweep id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The sweep.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SweepView"
                },
                "examples": {
                  "done": {
                    "summary": "Done with one version failed: recommended version, warnings and notes",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M6729QKEQ99A4TXHNMZAA7NG",
                        "strategy_id": "01M6729PTSDV47N0JD25NBZQVX",
                        "version": 1,
                        "status": "done",
                        "from": "2026-10-14",
                        "to": "2026-10-16",
                        "capital": 500000,
                        "costs": {
                          "charges": "india",
                          "slippage_bps": 2,
                          "spread_proxy_bps": 10
                        },
                        "axes": [
                          {
                            "path": "/spec/legs/items/0/strike/delta",
                            "values": [
                              0.15,
                              0.2
                            ]
                          },
                          {
                            "path": "/spec/risk/combined/stop_loss/rupees",
                            "values": [
                              2000,
                              3000
                            ]
                          }
                        ],
                        "progress": {
                          "total": 4,
                          "queued": 0,
                          "running": 0,
                          "done": 3,
                          "failed": 1,
                          "cancelled": 0
                        },
                        "cost": 1,
                        "cancel_requested": false,
                        "created_at": "2026-10-30T18:49:03.347Z",
                        "finished_at": "2026-10-30T18:49:04.277Z",
                        "expires_at": "2026-11-29T18:49:03.347Z",
                        "error": null,
                        "recommended": 0,
                        "warnings": [
                          "Best result may be luck: after testing 3 versions, the chance the best one is really better than average is low (deflated Sharpe 0.17).",
                          "Fewer than 30 trades: too few to judge."
                        ],
                        "notes": [
                          "Walk-forward test skipped: it needs at least 100 trading days of history (20 per window), and this sweep has 3.",
                          "Overfitting check (PBO) skipped: it needs at least 16 versions, and this sweep has 3.",
                          "1 of 4 versions did not finish (failed or cancelled) and are left out of the checks."
                        ],
                        "deflated_sharpe": 0.1691982360279356,
                        "pbo": null,
                        "walk_forward": null,
                        "versions": [
                          {
                            "n": 0,
                            "values": [
                              0.15,
                              2000
                            ],
                            "backtest_id": "01M6729QKFE6A2XEC6Q2PBZZ26",
                            "status": "done",
                            "error": null,
                            "summary": {
                              "capital": 500000,
                              "final_equity": 498079.58,
                              "net_pnl": -1920.42,
                              "charges": 304.17,
                              "cycles": 3,
                              "trades": 12,
                              "wins": 2,
                              "losses": 1,
                              "win_rate": 0.67,
                              "best_cycle": 182.21,
                              "worst_cycle": -2193.13,
                              "avg_cycle": -640.14,
                              "max_drawdown": 2394.76,
                              "max_drawdown_pct": 0.0048,
                              "days": 3,
                              "days_traded": 3,
                              "metrics": {
                                "total_return": -0.0042,
                                "cagr": -0.298,
                                "annualized_vol": 0.0349,
                                "sharpe": -9.2477,
                                "sortino": -8.025,
                                "calmar": -67.9822,
                                "max_drawdown": 0.0044,
                                "profit_factor": 0
                              },
                              "band": null
                            },
                            "sharpe": -0.475648339981058,
                            "plateau": -0.5498070234280426,
                            "recommended": true
                          },
                          {
                            "n": 1,
                            "values": [
                              0.15,
                              3000
                            ],
                            "backtest_id": "01M6729QKG9GG46QSCPWZ7S1Q8",
                            "status": "done",
                            "error": null,
                            "summary": {
                              "capital": 500000,
                              "final_equity": 497097.07,
                              "net_pnl": -2902.93,
                              "charges": 304.18,
                              "cycles": 3,
                              "trades": 12,
                              "wins": 2,
                              "losses": 1,
                              "win_rate": 0.67,
                              "best_cycle": 182.21,
                              "worst_cycle": -3175.64,
                              "avg_cycle": -967.64,
                              "max_drawdown": 3377.27,
                              "max_drawdown_pct": 0.0067,
                              "days": 3,
                              "days_traded": 3,
                              "metrics": {
                                "total_return": -0.0062,
                                "cagr": -0.4053,
                                "annualized_vol": 0.0496,
                                "sharpe": -9.8352,
                                "sortino": -8.3778,
                                "calmar": -63.8507,
                                "max_drawdown": 0.0063,
                                "profit_factor": 0
                              },
                              "band": null
                            },
                            "sharpe": -0.5058669394394733,
                            "plateau": -0.5498070234280426,
                            "recommended": false
                          },
                          {
                            "n": 2,
                            "values": [
                              0.2,
                              2000
                            ],
                            "backtest_id": "01M6729QKHZPHC8KN8E4K30RKP",
                            "status": "done",
                            "error": null,
                            "summary": {
                              "capital": 500000,
                              "final_equity": 497933.3,
                              "net_pnl": -2066.7,
                              "charges": 307.95,
                              "cycles": 3,
                              "trades": 12,
                              "wins": 0,
                              "losses": 3,
                              "win_rate": 0,
                              "best_cycle": -54.99,
                              "worst_cycle": -1879,
                              "avg_cycle": -688.9,
                              "max_drawdown": 2397.95,
                              "max_drawdown_pct": 0.0048,
                              "days": 3,
                              "days_traded": 3,
                              "metrics": {
                                "total_return": -0.004,
                                "cagr": -0.2873,
                                "annualized_vol": 0.0267,
                                "sharpe": -12.9856,
                                "sortino": -10.0511,
                                "calmar": -71.3976,
                                "max_drawdown": 0.004,
                                "profit_factor": 0
                              },
                              "band": null
                            },
                            "sharpe": -0.6679057908635965,
                            "plateau": -0.5498070234280426,
                            "recommended": false
                          },
                          {
                            "n": 3,
                            "values": [
                              0.2,
                              3000
                            ],
                            "backtest_id": "01M6729QKJ72C8CF01BZ1ND5C9",
                            "status": "failed",
                            "error": "History for NIFTY 50 is missing on 2026-10-15",
                            "summary": null,
                            "sharpe": null,
                            "plateau": null,
                            "recommended": false
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`backtest_not_found`: no such sweep.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such sweep",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "backtest_not_found",
                        "message": "Sweep not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "delete": {
        "tags": [
          "automated_strategies"
        ],
        "summary": "Cancel a sweep",
        "description": "Queued versions are cancelled at once and running ones stop within seconds; the sweep is `cancelled` when the last one has (`cancel_requested` until then). The sweep and the versions that finished stay readable. A finished sweep answers 409 `backtest_finished`.",
        "operationId": "cancel_auto_backtest_sweep",
        "parameters": [
          {
            "name": "sweep_id",
            "in": "path",
            "description": "Sweep id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The sweep after the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SweepView"
                },
                "examples": {
                  "cancelled": {
                    "summary": "Every queued version cancelled at once",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M66YJW74ZVAWVXYG8XH6E9KA",
                        "strategy_id": "01M66YJSSC5QFRPRW0AF5Y9HXM",
                        "version": 1,
                        "status": "cancelled",
                        "from": "2026-10-14",
                        "to": "2026-10-16",
                        "capital": 500000,
                        "costs": {
                          "charges": "india",
                          "slippage_bps": 2,
                          "spread_proxy_bps": 10
                        },
                        "axes": [
                          {
                            "path": "/spec/legs/items/0/strike/delta",
                            "values": [
                              0.15,
                              0.2
                            ]
                          },
                          {
                            "path": "/spec/risk/combined/stop_loss/rupees",
                            "values": [
                              2000,
                              3000
                            ]
                          }
                        ],
                        "progress": {
                          "total": 4,
                          "queued": 0,
                          "running": 0,
                          "done": 0,
                          "failed": 0,
                          "cancelled": 4
                        },
                        "cost": 1,
                        "cancel_requested": true,
                        "created_at": "2026-10-30T17:44:08.683Z",
                        "finished_at": "2026-10-30T17:44:08.693Z",
                        "expires_at": "2026-11-29T17:44:08.683Z",
                        "error": null,
                        "recommended": null,
                        "warnings": [],
                        "notes": [],
                        "deflated_sharpe": null,
                        "pbo": null,
                        "walk_forward": null,
                        "versions": [
                          {
                            "n": 0,
                            "values": [
                              0.15,
                              2000
                            ],
                            "backtest_id": "01M66YJW76BYE5CF5QP9WSQYKM",
                            "status": "cancelled",
                            "error": null,
                            "summary": null,
                            "sharpe": null,
                            "plateau": null,
                            "recommended": false
                          },
                          {
                            "n": 1,
                            "values": [
                              0.15,
                              3000
                            ],
                            "backtest_id": "01M66YJW78S2SFS8FPXBTX3GWA",
                            "status": "cancelled",
                            "error": null,
                            "summary": null,
                            "sharpe": null,
                            "plateau": null,
                            "recommended": false
                          },
                          {
                            "n": 2,
                            "values": [
                              0.2,
                              2000
                            ],
                            "backtest_id": "01M66YJW79PPVQMH0ERFK033DJ",
                            "status": "cancelled",
                            "error": null,
                            "summary": null,
                            "sharpe": null,
                            "plateau": null,
                            "recommended": false
                          },
                          {
                            "n": 3,
                            "values": [
                              0.2,
                              3000
                            ],
                            "backtest_id": "01M66YJW7BQT1DP0N3MPMV006A",
                            "status": "cancelled",
                            "error": null,
                            "summary": null,
                            "sharpe": null,
                            "plateau": null,
                            "recommended": false
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: not enabled for this user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`backtest_not_found`: no such sweep.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "`backtest_finished`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "finished": {
                    "summary": "Nothing to cancel",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "backtest_finished",
                        "message": "This sweep has already finished",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "strategies"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "strategies"
      }
    },
    "/v1/accounts": {
      "get": {
        "tags": [
          "accounts"
        ],
        "summary": "List linked broker accounts",
        "description": "Every broker account the user linked, sorted by id, with whether it can trade now (`status`), what it lacks (`missing`) and how order updates arrive (`updates`). Never a credential.",
        "operationId": "list_accounts",
        "responses": {
          "200": {
            "description": "The accounts (may be empty).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AccountList"
                },
                "examples": {
                  "success": {
                    "summary": "Ready, login-required and incomplete accounts",
                    "value": {
                      "status": "success",
                      "data": {
                        "items": [
                          {
                            "account": "5P1",
                            "broker": "5paisa",
                            "broker_name": "5paisa",
                            "tag": null,
                            "multiplier": 1,
                            "supported": true,
                            "status": "login_required",
                            "missing": [
                              {
                                "field": "static_ip",
                                "label": "Static IP",
                                "required": false
                              }
                            ],
                            "updates": "stream",
                            "static_ip": null,
                            "last_login_at": null,
                            "session_expires_at": null,
                            "seat_assigned": null,
                            "last_update_at": null,
                            "protection": {
                              "bracket": false,
                              "cover": false,
                              "gtt": false,
                              "gtt_two_leg": false
                            },
                            "warnings": []
                          },
                          {
                            "account": "MO1",
                            "broker": "motilaloswal",
                            "broker_name": "Motilal Oswal",
                            "tag": null,
                            "multiplier": 1,
                            "supported": true,
                            "status": "login_required",
                            "missing": [
                              {
                                "field": "static_ip",
                                "label": "Static IP",
                                "required": false
                              }
                            ],
                            "updates": "stream",
                            "static_ip": null,
                            "last_login_at": null,
                            "session_expires_at": null,
                            "seat_assigned": null,
                            "last_update_at": null,
                            "protection": {
                              "bracket": false,
                              "cover": false,
                              "gtt": false,
                              "gtt_two_leg": false
                            },
                            "warnings": []
                          },
                          {
                            "account": "P1",
                            "broker": "paper",
                            "broker_name": "Paper",
                            "tag": null,
                            "multiplier": 1,
                            "supported": true,
                            "status": "ready",
                            "missing": [],
                            "updates": "postback",
                            "static_ip": null,
                            "last_login_at": null,
                            "session_expires_at": null,
                            "seat_assigned": null,
                            "last_update_at": null,
                            "protection": {
                              "bracket": true,
                              "cover": true,
                              "gtt": true,
                              "gtt_two_leg": true
                            },
                            "warnings": []
                          },
                          {
                            "account": "P2",
                            "broker": "paper",
                            "broker_name": "Paper",
                            "tag": null,
                            "multiplier": 2,
                            "supported": true,
                            "status": "ready",
                            "missing": [],
                            "updates": "postback",
                            "static_ip": null,
                            "last_login_at": null,
                            "session_expires_at": null,
                            "seat_assigned": null,
                            "last_update_at": null,
                            "protection": {
                              "bracket": true,
                              "cover": true,
                              "gtt": true,
                              "gtt_two_leg": true
                            },
                            "warnings": []
                          },
                          {
                            "account": "PF1",
                            "broker": "pocketful",
                            "broker_name": "Pocketful",
                            "tag": null,
                            "multiplier": 1,
                            "supported": true,
                            "status": "login_required",
                            "missing": [],
                            "updates": "stream",
                            "static_ip": null,
                            "last_login_at": null,
                            "session_expires_at": null,
                            "seat_assigned": null,
                            "last_update_at": null,
                            "protection": {
                              "bracket": true,
                              "cover": true,
                              "gtt": true,
                              "gtt_two_leg": false
                            },
                            "warnings": []
                          },
                          {
                            "account": "TJ1",
                            "broker": "tradejini",
                            "broker_name": "Tradejini",
                            "tag": null,
                            "multiplier": 1,
                            "supported": true,
                            "status": "ready",
                            "missing": [
                              {
                                "field": "static_ip",
                                "label": "Static IP",
                                "required": false
                              }
                            ],
                            "updates": "stream",
                            "static_ip": null,
                            "last_login_at": null,
                            "session_expires_at": "2026-10-12T11:31:53Z",
                            "seat_assigned": null,
                            "last_update_at": "2026-10-12T10:31:53.299825Z",
                            "protection": {
                              "bracket": true,
                              "cover": true,
                              "gtt": true,
                              "gtt_two_leg": true
                            },
                            "warnings": []
                          },
                          {
                            "account": "U1",
                            "broker": "upstox",
                            "broker_name": "Upstox",
                            "tag": null,
                            "multiplier": 1,
                            "supported": true,
                            "status": "login_required",
                            "missing": [],
                            "updates": "stream",
                            "static_ip": null,
                            "last_login_at": null,
                            "session_expires_at": null,
                            "seat_assigned": null,
                            "last_update_at": null,
                            "protection": {
                              "bracket": false,
                              "cover": false,
                              "gtt": false,
                              "gtt_two_leg": false
                            },
                            "warnings": []
                          },
                          {
                            "account": "Z1",
                            "broker": "zerodha",
                            "broker_name": "Zerodha",
                            "tag": null,
                            "multiplier": 1,
                            "supported": true,
                            "status": "setup_incomplete",
                            "missing": [
                              {
                                "field": "api_key",
                                "label": "API Key",
                                "required": true
                              },
                              {
                                "field": "static_ip",
                                "label": "Static IP",
                                "required": false
                              }
                            ],
                            "updates": "stream",
                            "static_ip": null,
                            "last_login_at": null,
                            "session_expires_at": null,
                            "seat_assigned": null,
                            "last_update_at": null,
                            "protection": {
                              "bracket": false,
                              "cover": false,
                              "gtt": true,
                              "gtt_two_leg": true
                            },
                            "warnings": []
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or their status could not be read; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/accounts/{account}": {
      "get": {
        "tags": [
          "accounts"
        ],
        "summary": "One linked broker account",
        "description": "The account as in `GET /v1/accounts`, plus `health`: what its live worker last reported (order-update stream, polling, last book read, last broker error: its kind and `last_error_message`, safe to show the user).",
        "operationId": "get_account",
        "parameters": [
          {
            "name": "account",
            "in": "path",
            "description": "Account id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_AccountDetail"
                },
                "examples": {
                  "login_required": {
                    "summary": "No session and no recent health report",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "U1",
                        "broker": "upstox",
                        "broker_name": "Upstox",
                        "tag": null,
                        "multiplier": 1,
                        "supported": true,
                        "status": "login_required",
                        "missing": [],
                        "updates": "stream",
                        "static_ip": null,
                        "last_login_at": null,
                        "session_expires_at": null,
                        "seat_assigned": null,
                        "last_update_at": null,
                        "protection": {
                          "bracket": false,
                          "cover": false,
                          "gtt": false,
                          "gtt_two_leg": false
                        },
                        "warnings": [],
                        "health": null
                      },
                      "error": null
                    }
                  },
                  "static_ip_not_registered": {
                    "summary": "The broker refused an order: no static IP registered for the API app",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "Z1",
                        "broker": "zerodha",
                        "broker_name": "Zerodha",
                        "tag": null,
                        "multiplier": 1,
                        "supported": true,
                        "status": "setup_incomplete",
                        "missing": [
                          {
                            "field": "api_key",
                            "label": "API Key",
                            "required": true
                          },
                          {
                            "field": "static_ip",
                            "label": "Static IP",
                            "required": false
                          }
                        ],
                        "updates": "stream",
                        "static_ip": null,
                        "last_login_at": null,
                        "session_expires_at": null,
                        "seat_assigned": null,
                        "last_update_at": null,
                        "protection": {
                          "bracket": false,
                          "cover": false,
                          "gtt": true,
                          "gtt_two_leg": true
                        },
                        "warnings": [
                          "static_ip_not_registered"
                        ],
                        "health": null
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "A live account with its health",
                    "value": {
                      "status": "success",
                      "data": {
                        "account": "TJ1",
                        "broker": "tradejini",
                        "broker_name": "Tradejini",
                        "tag": null,
                        "multiplier": 1,
                        "supported": true,
                        "status": "ready",
                        "missing": [
                          {
                            "field": "static_ip",
                            "label": "Static IP",
                            "required": false
                          }
                        ],
                        "updates": "stream",
                        "static_ip": null,
                        "last_login_at": null,
                        "session_expires_at": "2026-10-06T06:33:54Z",
                        "seat_assigned": null,
                        "last_update_at": "2026-10-06T05:33:54.471247Z",
                        "protection": {
                          "bracket": true,
                          "cover": true,
                          "gtt": true,
                          "gtt_two_leg": true
                        },
                        "warnings": [],
                        "health": {
                          "stream": "up",
                          "polls": false,
                          "last_book_read_at": "2026-10-06T05:33:54.471247Z",
                          "open_orders": 2,
                          "last_error_kind": null,
                          "last_error_message": null,
                          "last_error_at": null
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`account_not_found`: not one of the caller's linked accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "account_not_found": {
                    "summary": "Not one of the caller's accounts",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "account_not_found",
                        "message": "No linked broker account with this id",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: accounts or their status could not be read; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/instruments": {
      "get": {
        "tags": [
          "instruments"
        ],
        "summary": "Search instruments",
        "description": "Searches today's instrument list. Give `q` or at least one filter. `q` is matched literally and case-insensitively (no wildcards): exact trading symbol first, then symbol prefix, then a word prefix of the name or underlying; every word of a multi-word `q` must match. Filters are exact (case-insensitive). At most `limit` items (default 20, at most 100) per page; when more match, `next_cursor` fetches the next page (send it as `cursor` with the same parameters).\n\n`exchange` is the catalog's exchange as this route returns it: futures and options (index and stock) are listed under `NSE` / `BSE` (e.g. NIFTY / SENSEX options), which is the value an item carries here. `exchange=NFO` / `BFO` is accepted too and finds the futures and options listed under `NSE` / `BSE`.",
        "operationId": "search_instruments",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Search text (at most 64 characters).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "exchange",
            "in": "query",
            "description": "Exchange as this route returns it (`NSE`, `BSE`, `MCX`, ...); futures and options are under `NSE` / `BSE`. `NFO` / `BFO` find the futures and options listed under `NSE` / `BSE`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "underlying",
            "in": "query",
            "description": "Exact underlying symbol, e.g. `NIFTY` (not a prefix).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "instrument",
            "in": "query",
            "description": "Instrument type, e.g. `EQUITY`, `OPTIDX`, `FUTSTK`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "expiry",
            "in": "query",
            "description": "Expiry date `YYYY-MM-DD`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "strike",
            "in": "query",
            "description": "Strike price.",
            "required": false,
            "schema": {
              "type": "number",
              "format": "double"
            }
          },
          {
            "name": "option_type",
            "in": "query",
            "description": "`CE` or `PE`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Most items to return (default 20; above 100 means 100).",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` of the previous page (opaque).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matches (may be empty).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_InstrumentSearchResult"
                },
                "examples": {
                  "filters": {
                    "summary": "Filters only: calls at one strike (`NFO` finds the options listed under NSE)",
                    "value": {
                      "status": "success",
                      "data": {
                        "items": [
                          {
                            "cirrus_token": "CT:1:6:FINNIFTY27OCT202625000CE",
                            "exchange": "NSE",
                            "instrument": "OPTIDX",
                            "exchange_token": "50319",
                            "lot_size": 60,
                            "expiry": "2026-10-27",
                            "strike": 25000,
                            "option_type": "CE",
                            "tick_size": 0.05,
                            "underlying_symbol": "FINNIFTY",
                            "isin": null,
                            "freeze_qty": 1801,
                            "name": "FINNIFTY",
                            "tradingsymbol": "FINNIFTY27OCT202625000CE",
                            "sector": null,
                            "indices": [],
                            "instrument_token": "CT:1:6:FINNIFTY27OCT202625000CE"
                          }
                        ],
                        "count": 1,
                        "next_cursor": null
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "Search by symbol or name",
                    "value": {
                      "status": "success",
                      "data": {
                        "items": [
                          {
                            "cirrus_token": "CT:1:2:RELIANCE-EQ",
                            "exchange": "NSE",
                            "instrument": "EQUITY",
                            "exchange_token": "2885",
                            "lot_size": 1,
                            "expiry": null,
                            "strike": null,
                            "option_type": null,
                            "tick_size": 0.1,
                            "underlying_symbol": "RELIANCE",
                            "isin": "INE002A01018",
                            "freeze_qty": 81195,
                            "name": "RELIANCE",
                            "tradingsymbol": "RELIANCE",
                            "sector": "Oil Gas & Consumable Fuels",
                            "indices": [
                              "NIFTY",
                              "NIFTY100",
                              "NIFTYENERGY"
                            ],
                            "instrument_token": "CT:1:2:RELIANCE-EQ"
                          },
                          {
                            "cirrus_token": "CT:2:2:RELIANCE-A",
                            "exchange": "BSE",
                            "instrument": "EQUITY",
                            "exchange_token": "500325",
                            "lot_size": 1,
                            "expiry": null,
                            "strike": null,
                            "option_type": null,
                            "tick_size": 0.05,
                            "underlying_symbol": "RELIANCE",
                            "isin": "INE002A01018",
                            "freeze_qty": null,
                            "name": "RELIANCE",
                            "tradingsymbol": "RELIANCE",
                            "sector": "Oil Gas & Consumable Fuels",
                            "indices": [
                              "NIFTY",
                              "NIFTY100",
                              "NIFTYENERGY"
                            ],
                            "instrument_token": "CT:2:2:RELIANCE-A"
                          }
                        ],
                        "count": 2,
                        "next_cursor": "2-839b1b69914e"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "description": "`invalid_request`: neither `q` nor a filter (`field`: `q`), a value too long (filters: 32 characters), `strike` not a number, `limit` not a whole number of at least 1, `cursor` not one this API returned or made before the list was reloaded (`field` names the parameter), or an unreadable query string (`field`: `query`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "no_query": {
                    "summary": "Neither `q` nor a filter",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "Give `q` or at least one filter (exchange, instrument, expiry, strike, option_type, underlying)",
                        "field": "q"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`instruments_unavailable`: the instrument list is still loading; retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "instruments_unavailable": {
                    "summary": "The instrument list is still loading",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "instruments_unavailable",
                        "message": "The instrument list is loading. Please retry in a minute.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/instruments.csv": {
      "get": {
        "tags": [
          "instruments"
        ],
        "summary": "Download the instrument list (CSV)",
        "description": "Today's full instrument list as one CSV file (UTF-8, header row), gzip-compressed when the request accepts it (`Accept-Encoding: gzip`). Send the `ETag` back in `If-None-Match` (or `Last-Modified` in `If-Modified-Since`) to get `304 Not Modified` while it is unchanged; validators are the same on every server.\n\nColumns (find them by header name; new columns may be added): the instrument id (under its legacy name; the same value as `instrument_token`), `exchange`, `instrument` (type), `exchange_token`, `lot_size`, `expiry` (`YYYY-MM-DD`), `strike`, `option_type` (`CE` / `PE`), `tick_size`, `underlying_symbol`, `isin`, `freeze_qty`, `name`, `tradingsymbol`, `sector`, `indices` (`|`-separated). Empty cells mean no value; numbers may be written with a decimal point (`1.0`).",
        "operationId": "download_instruments",
        "parameters": [
          {
            "name": "If-None-Match",
            "in": "header",
            "description": "An `ETag` received earlier.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "If-Modified-Since",
            "in": "header",
            "description": "A `Last-Modified` received earlier.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file (`Content-Disposition: attachment; filename=\"instruments.csv\"`).",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`public, max-age=300`."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Version of the file (differs for the gzip encoding)."
              },
              "Last-Modified": {
                "schema": {
                  "type": "string"
                },
                "description": "When the file was published."
              }
            },
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "304": {
            "description": "Not modified: the copy the client has is current."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`instruments_unavailable`: the instrument list is still loading; retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "instruments_unavailable": {
                    "summary": "The instrument list is still loading",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "instruments_unavailable",
                        "message": "The instrument list is loading. Please retry in a minute.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/instruments/expiries": {
      "get": {
        "tags": [
          "instruments"
        ],
        "summary": "Expiry dates of an underlying",
        "description": "Distinct expiry dates of every contract (futures and options) on `underlying` in today's instrument list, earliest first. `exchange` narrows to the exchange the list gives the contracts (index options: `NSE` / `BSE`).",
        "operationId": "list_instrument_expiries",
        "parameters": [
          {
            "name": "underlying",
            "in": "query",
            "description": "Exact underlying symbol, e.g. `NIFTY`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "exchange",
            "in": "query",
            "description": "Only contracts on this exchange, as `GET /v1/instruments` returns it (`NFO` / `BFO` mean the contracts listed under `NSE` / `BSE`).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Expiry dates (may be empty).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_InstrumentExpiries"
                },
                "examples": {
                  "success": {
                    "summary": "Expiries of an index's contracts (`NFO` finds those listed under NSE)",
                    "value": {
                      "status": "success",
                      "data": {
                        "underlying": "FINNIFTY",
                        "expiries": [
                          "2026-10-27"
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "description": "`invalid_request`: `underlying` missing (`field`: `underlying`), a value too long, or an unreadable query string (`field`: `query`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "no_underlying": {
                    "summary": "`underlying` is required",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "`underlying` is required, e.g. NIFTY",
                        "field": "underlying"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`instruments_unavailable`: the instrument list is still loading; retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/instruments/{instrument_token}": {
      "get": {
        "tags": [
          "instruments"
        ],
        "summary": "One instrument",
        "description": "The instrument with this id, from today's instrument list, else from the live instrument master (fields it lacks are null).",
        "operationId": "get_instrument",
        "parameters": [
          {
            "name": "instrument_token",
            "in": "path",
            "description": "Instrument id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The instrument.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_InstrumentRow"
                },
                "examples": {
                  "success": {
                    "summary": "An index option",
                    "value": {
                      "status": "success",
                      "data": {
                        "cirrus_token": "CT:1:6:FINNIFTY27OCT202625000CE",
                        "exchange": "NSE",
                        "instrument": "OPTIDX",
                        "exchange_token": "50319",
                        "lot_size": 60,
                        "expiry": "2026-10-27",
                        "strike": 25000,
                        "option_type": "CE",
                        "tick_size": 0.05,
                        "underlying_symbol": "FINNIFTY",
                        "isin": null,
                        "freeze_qty": 1801,
                        "name": "FINNIFTY",
                        "tradingsymbol": "FINNIFTY27OCT202625000CE",
                        "sector": null,
                        "indices": [],
                        "instrument_token": "CT:1:6:FINNIFTY27OCT202625000CE"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`instrument_not_found`: unknown or expired instrument id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "instrument_not_found": {
                    "summary": "Unknown or expired instrument",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "instrument_not_found",
                        "message": "No instrument with this instrument_token (expired or invalid)",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: instrument lookup is temporarily unavailable; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/user/profile": {
      "get": {
        "tags": [
          "user"
        ],
        "summary": "Who am I",
        "description": "The user and the credential of this request (session, API key or partner app) with its scopes. Any valid credential may call it, whatever its scopes. Never returns a secret.",
        "operationId": "get_profile",
        "responses": {
          "200": {
            "description": "The caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_UserProfile"
                },
                "examples": {
                  "api_key": {
                    "summary": "Called with an IP-restricted API key",
                    "value": {
                      "status": "success",
                      "data": {
                        "username": "user-01M65VA95T7KHB54A65SPDCDN8",
                        "auth": {
                          "kind": "api_key",
                          "key_id": "ck_HER43mGjt79JtHSu5YT6",
                          "name": "Reporting",
                          "scopes": [
                            "read"
                          ],
                          "ip_allowlist": [
                            "203.0.113.7"
                          ]
                        }
                      },
                      "error": null
                    }
                  },
                  "session": {
                    "summary": "Signed in to the app",
                    "value": {
                      "status": "success",
                      "data": {
                        "username": "user-01M65VA95T7KHB54A65SPDCDN8",
                        "auth": {
                          "kind": "session",
                          "impersonated": false,
                          "scopes": [
                            "read",
                            "orders",
                            "triggers",
                            "strategies",
                            "strategies_live",
                            "strategies_signal",
                            "webhooks",
                            "notifications",
                            "watchlists"
                          ]
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: the API key's details are temporarily unavailable; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "any"
      }
    },
    "/v1/stream": {
      "get": {
        "tags": [
          "stream"
        ],
        "summary": "Live updates (WebSocket)",
        "description": "Upgrades to a WebSocket carrying the user's live order and portfolio state and new activity-log records, as JSON text frames. Client messages are `StreamClientMessage`, server messages `StreamServerMessage` (see `x-websocket-messages`).\n\n**Authentication.** Either send the credential on the upgrade request (an `Authorization` header, as on every route), or send as the first message `{\"type\":\"auth\",\"token\":\"...\"}` within 5 s of connecting. Credentials are never read from the URL. The credential needs the `read` scope. A failed check does not answer 401/403: the upgrade succeeds and the socket is closed with code 4001. The credential is re-checked every 10 s; logout or revocation closes the stream (4001).\n\n**Messages.** Every server message has a per-connection `seq` (1, 2, 3, ...). First `hello` (user and accounts), then one `snapshot` per account and data kind (`orders` always, an empty list when there are none; other kinds when there is data), or for an account with no live data (no broker session, or its session expired; broker not supported) one `missing` message with the same `code` / `reason` as REST `missing`; then `snapshot_done`; after that live `order_update`, `portfolio` and `activity` messages. Every event carries full state (the whole order, the whole kind), never a diff, so a missed message is repaired by the next one for the same order or kind. After a gap in `seq`, send `{\"type\":\"resync\"}` to get every snapshot again (then `snapshot_done`). If live updates cannot be set up an `error` message (`unavailable`) is sent and the stream ends: reconnect.\n\n**Heartbeat.** The server pings every 15 s and closes a connection it has heard nothing from for 45 s (code 1000).\n\n**Close codes.** 4001: credential missing, invalid, expired, revoked or without the `read` scope (or the first message was not `auth`); 4002: no `auth` message within 5 s; 1013: the client fell too far behind (reconnect for a fresh snapshot); 1001: server shutting down; 1000: idle.",
        "operationId": "open_stream",
        "responses": {
          "101": {
            "description": "Switching Protocols: the WebSocket is open."
          },
          "400": {
            "description": "Not a valid WebSocket upgrade (missing or wrong `Connection`, `Upgrade`, `Sec-WebSocket-Version` or `Sec-WebSocket-Key` header): plain text.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "426": {
            "description": "Upgrade Required: the connection cannot be upgraded (e.g. an HTTP/1.0 or proxied connection that drops the upgrade); plain text.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-websocket-messages": {
          "client": {
            "$ref": "#/components/schemas/StreamClientMessage"
          },
          "server": {
            "$ref": "#/components/schemas/StreamServerMessage"
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/activity": {
      "get": {
        "tags": [
          "activity"
        ],
        "summary": "List activity",
        "description": "One trading day (IST) of the activity log, newest first, in pages. Filters combine (all must match); comma-separated lists match any of their values. Follow `next_cursor` (same filters) for older records of the same day. Older days are read from the archive (`source`: `archive`).",
        "operationId": "list_activity",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "description": "Trading day `YYYY-MM-DD` (IST); today when absent.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Only records touching this account.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Comma-separated `ActivityKind` values (e.g. `place,cancel`).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Comma-separated `ActivityCategory` values (e.g. `orders,protection`; also `signals`, `account`, `access`, `strategies`).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "description": "Comma-separated `ActivityOutcome` values (e.g. `failed,partial`).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Case-insensitive text in the summary or trading symbol (at most 64 characters).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "description": "Only records made by this partner connection (the `client_id` of the record's source).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` of the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, at least 1 (default 50; above 200 means 200).",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_ActivityPage"
                },
                "examples": {
                  "filtered": {
                    "summary": "Only successful order records of one account",
                    "value": {
                      "status": "success",
                      "data": {
                        "items": [
                          {
                            "id": "01M660NFS333BMRSCBY7Z9KW7V",
                            "username": "user-01M660NFQ3RXTAEFHAEZA14Z4W",
                            "at": "2026-10-30T09:01:16.924368667Z",
                            "kind": "place",
                            "category": "orders",
                            "source": {
                              "type": "app",
                              "name": null,
                              "via": "app"
                            },
                            "request_id": "01M660NFQW7YEQ6KERHPNKY8ZF",
                            "instrument": {
                              "cirrus_token": "CT:TEST:RELIANCE",
                              "tradingsymbol": "RELIANCE-EQ",
                              "exchange": "NSE",
                              "instrument_token": "CT:TEST:RELIANCE"
                            },
                            "side": "BUY",
                            "order_type": "LIMIT",
                            "product": "DELIVERY",
                            "quantity": 1,
                            "price": 2500,
                            "trigger_price": null,
                            "summary": "Buy 1 RELIANCE at ₹2,500 (Limit) in 1 account",
                            "message": null,
                            "outcome": "ok",
                            "duration_ms": 39,
                            "accounts": [
                              {
                                "account": "P1",
                                "broker": "paper",
                                "status": "placed",
                                "order_ids": [
                                  "PAPER-1"
                                ],
                                "message": null,
                                "broker_message": null,
                                "duration_ms": 1,
                                "route": "direct"
                              }
                            ]
                          }
                        ],
                        "next_cursor": null,
                        "source": "hot"
                      },
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "Today's records, newest first",
                    "value": {
                      "status": "success",
                      "data": {
                        "items": [
                          {
                            "id": "01M660NFS333BMRSCBY7Z9KW7V",
                            "username": "user-01M660NFQ3RXTAEFHAEZA14Z4W",
                            "at": "2026-10-30T09:01:16.924368667Z",
                            "kind": "place",
                            "category": "orders",
                            "source": {
                              "type": "app",
                              "name": null,
                              "via": "app"
                            },
                            "request_id": "01M660NFQW7YEQ6KERHPNKY8ZF",
                            "instrument": {
                              "cirrus_token": "CT:TEST:RELIANCE",
                              "tradingsymbol": "RELIANCE-EQ",
                              "exchange": "NSE",
                              "instrument_token": "CT:TEST:RELIANCE"
                            },
                            "side": "BUY",
                            "order_type": "LIMIT",
                            "product": "DELIVERY",
                            "quantity": 1,
                            "price": 2500,
                            "trigger_price": null,
                            "summary": "Buy 1 RELIANCE at ₹2,500 (Limit) in 1 account",
                            "message": null,
                            "outcome": "ok",
                            "duration_ms": 39,
                            "accounts": [
                              {
                                "account": "P1",
                                "broker": "paper",
                                "status": "placed",
                                "order_ids": [
                                  "PAPER-1"
                                ],
                                "message": null,
                                "broker_message": null,
                                "duration_ms": 1,
                                "route": "direct"
                              }
                            ]
                          }
                        ],
                        "next_cursor": null,
                        "source": "hot"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: unreadable query string (an unknown parameter, or `limit` not a whole number).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "description": "`invalid_request` (`field` names the parameter: `date` not `YYYY-MM-DD` or out of range, unknown `kind` / `category` / `outcome`, `q` too long, `client_id` blank or too long, bad `cursor`, `limit` 0), or `archive_day_too_large`: that archived day is too large to serve.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_kind": {
                    "summary": "An unknown kind is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "unknown kind `teleport`",
                        "field": "kind"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: the activity log is not available on this server, or temporarily unavailable; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/activity/{id}": {
      "get": {
        "tags": [
          "activity"
        ],
        "summary": "One activity record",
        "description": "The record with its `timeline`: every step of the orders it touched (from the order journal), oldest first. Archived records are found by the day in their id.",
        "operationId": "get_activity",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Record id (a ULID).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The record, with `timeline`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_ActivityRecord"
                },
                "examples": {
                  "success": {
                    "summary": "An order placement with its timeline",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "01M660NFS344PVP5P58TW43D0B",
                        "username": "user-01M660NFQ3BKPQ48Q3F079H9F3",
                        "at": "2026-10-30T09:01:16.924345459Z",
                        "kind": "place",
                        "category": "orders",
                        "source": {
                          "type": "app",
                          "name": null,
                          "via": "app"
                        },
                        "request_id": "01M660NFQW7RSJDWQ5JTNJ4WSG",
                        "instrument": {
                          "cirrus_token": "CT:TEST:RELIANCE",
                          "tradingsymbol": "RELIANCE-EQ",
                          "exchange": "NSE",
                          "instrument_token": "CT:TEST:RELIANCE"
                        },
                        "side": "BUY",
                        "order_type": "LIMIT",
                        "product": "DELIVERY",
                        "quantity": 1,
                        "price": 2500,
                        "trigger_price": null,
                        "summary": "Buy 1 RELIANCE at ₹2,500 (Limit) in 1 account",
                        "message": null,
                        "outcome": "ok",
                        "duration_ms": 39,
                        "accounts": [
                          {
                            "account": "P1",
                            "broker": "paper",
                            "status": "placed",
                            "order_ids": [
                              "PAPER-1"
                            ],
                            "message": null,
                            "broker_message": null,
                            "duration_ms": 1,
                            "route": "direct"
                          }
                        ],
                        "timeline": [
                          {
                            "at": "2026-10-30T09:01:18.070171Z",
                            "account": "P1",
                            "order_id": "PAPER-1",
                            "state": "OPEN",
                            "message": null,
                            "filled_qty": 0,
                            "average_price": null
                          },
                          {
                            "at": "2026-10-30T09:01:19.070171Z",
                            "account": "P1",
                            "order_id": "PAPER-1",
                            "state": "FILLED",
                            "message": null,
                            "filled_qty": 1,
                            "average_price": 2499.5
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`activity_not_found`: no record with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "activity_not_found": {
                    "summary": "No record with this id",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "activity_not_found",
                        "message": "Activity not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`archive_day_too_large`: the record's archived day is too large to read.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: the activity log is not available on this server, or temporarily unavailable; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/postbacks": {
      "get": {
        "tags": [
          "webhooks"
        ],
        "summary": "List webhooks",
        "description": "The signed-in user's webhooks (never their secrets), oldest first. Event bodies are described in the document's `webhooks` section (`order_update`, `trade`, `account_alert`, `positions`, `ping`; components `WebhookOrderUpdate`, `WebhookTrade`, `WebhookAccountAlert`, `WebhookPositions`, `WebhookPing`), with how deliveries are signed and retried.",
        "operationId": "list_webhooks",
        "responses": {
          "200": {
            "description": "The user's webhooks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_WebhookView"
                },
                "examples": {
                  "success": {
                    "summary": "The user's webhooks",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "id": "pb_01m5yb0gy8qwqm4gbe8tg61nhf",
                          "url": "http://127.0.0.1:61319/hooks/orders",
                          "events": [
                            "order_update",
                            "trade"
                          ],
                          "accounts": [
                            "P1"
                          ],
                          "description": "Order desk",
                          "enabled": true,
                          "disabled_reason": null,
                          "disabled_at": null,
                          "consecutive_failures": 0,
                          "last_success_at": null,
                          "last_failure_at": null,
                          "previous_secret_expires_at": null,
                          "secret_rotated_at": null,
                          "created_at": "2026-10-27T09:28:08.904Z",
                          "updated_at": "2026-10-27T09:28:08.904Z"
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`webhooks_disabled`: webhooks are not enabled on this server; or `service_unavailable`: the webhook store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Create a webhook",
        "description": "Registers an HTTPS receiver for the chosen events (optionally only for some of the user's accounts). The signing secret is in this response only: store it now. A user may have at most 5 webhooks. Event bodies are described in the document's `webhooks` section (`order_update`, `trade`, `account_alert`, `positions`, `ping`; components `WebhookOrderUpdate`, `WebhookTrade`, `WebhookAccountAlert`, `WebhookPositions`, `WebhookPing`), with how deliveries are signed and retried.\n\nOnly the account holder can create webhooks: signed in themselves, or with one of their API keys holding the `webhooks` scope (never a partner app).",
        "operationId": "create_webhook",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewWebhook"
              },
              "examples": {
                "success": {
                  "summary": "Order and trade events of one account",
                  "value": {
                    "url": "http://127.0.0.1:61319/hooks/orders",
                    "events": [
                      "order_update",
                      "trade"
                    ],
                    "accounts": [
                      "P1"
                    ],
                    "description": "Order desk"
                  }
                },
                "with_trigger_updates": {
                  "summary": "Also v2 trigger changes (`trigger_update`), chosen at creation",
                  "value": {
                    "url": "http://127.0.0.1:53767/hooks/triggers",
                    "events": [
                      "order_update"
                    ],
                    "trigger_updates": true
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created; the secret is shown only here.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_WebhookWithSecret"
                },
                "examples": {
                  "success": {
                    "summary": "Order and trade events of one account",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "pb_01m5yb0gy8qwqm4gbe8tg61nhf",
                        "url": "http://127.0.0.1:61319/hooks/orders",
                        "events": [
                          "order_update",
                          "trade"
                        ],
                        "accounts": [
                          "P1"
                        ],
                        "description": "Order desk",
                        "enabled": true,
                        "disabled_reason": null,
                        "disabled_at": null,
                        "consecutive_failures": 0,
                        "last_success_at": null,
                        "last_failure_at": null,
                        "previous_secret_expires_at": null,
                        "secret_rotated_at": null,
                        "created_at": "2026-10-27T09:28:08.904Z",
                        "updated_at": "2026-10-27T09:28:08.904Z",
                        "secret": "whsec_lW1M6I7AW+mbrgsUJkWvnLgrevwb/FI4DX+XFigSAuU=",
                        "note": "Store the secret now: it is not shown again."
                      },
                      "error": null
                    }
                  },
                  "with_trigger_updates": {
                    "summary": "Also v2 trigger changes (`trigger_update`), chosen at creation",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "pb_01m5yatz1ebj0tfsb83zk0aaw2",
                        "url": "http://127.0.0.1:53767/hooks/triggers",
                        "events": [
                          "order_update"
                        ],
                        "accounts": null,
                        "description": null,
                        "enabled": true,
                        "disabled_reason": null,
                        "disabled_at": null,
                        "consecutive_failures": 0,
                        "last_success_at": null,
                        "last_failure_at": null,
                        "previous_secret_expires_at": null,
                        "secret_rotated_at": null,
                        "created_at": "2026-10-27T09:25:06.734Z",
                        "updated_at": "2026-10-27T09:25:06.734Z",
                        "trigger_updates": true,
                        "secret": "whsec_ddZXEjVZ/JUHLIS1YhmiVcxErjefrMRKK/0pW6YPR7Q=",
                        "note": "Store the secret now: it is not shown again."
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`: the body is not JSON or does not fit (unknown field, wrong type).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_field": {
                    "summary": "The secret cannot be chosen",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `secret`, expected one of `url`, `events`, `accounts`, `description`, `trigger_updates`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_api_key": {
                    "summary": "An unknown or revoked API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Invalid API key",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session or API key (an operator acting as the user, or a partner app); or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the `webhooks` scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `webhooks` scope",
                        "field": null
                      }
                    }
                  },
                  "own_session_required": {
                    "summary": "An operator acting as the user cannot create webhooks",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "own_session_required",
                        "message": "Only the account holder, signed in themselves, can do this",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`webhook_limit_reached`: the user already has 5 webhooks; delete one first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`; `field` names the input: `url` (not an `https://` URL on a public host), `events` (none, unknown or `ping`), `accounts` (empty, or not the user's) or `description` (over 200 characters).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_event": {
                    "summary": "An unknown event name is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "unknown event `fills`; expected one of order_update, trade, account_alert, positions",
                        "field": "events"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`webhooks_disabled`: webhooks are not enabled on this server; or `service_unavailable`: the webhook store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "webhooks"
      }
    },
    "/v1/postbacks/{id}": {
      "get": {
        "tags": [
          "webhooks"
        ],
        "summary": "Get a webhook",
        "description": "One webhook (never its secret): its settings and delivery health.",
        "operationId": "get_webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The webhook's `id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_WebhookView"
                },
                "examples": {
                  "success": {
                    "summary": "One webhook",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "pb_01m5yb0gy8qwqm4gbe8tg61nhf",
                        "url": "http://127.0.0.1:61319/hooks/orders",
                        "events": [
                          "order_update",
                          "trade"
                        ],
                        "accounts": [
                          "P1"
                        ],
                        "description": "Order desk",
                        "enabled": true,
                        "disabled_reason": null,
                        "disabled_at": null,
                        "consecutive_failures": 0,
                        "last_success_at": null,
                        "last_failure_at": null,
                        "previous_secret_expires_at": null,
                        "secret_rotated_at": null,
                        "created_at": "2026-10-27T09:28:08.904Z",
                        "updated_at": "2026-10-27T09:28:08.904Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`webhook_not_found`: no webhook with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such webhook",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "webhook_not_found",
                        "message": "Webhook not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`webhooks_disabled`: webhooks are not enabled on this server; or `service_unavailable`: the webhook store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "delete": {
        "tags": [
          "webhooks"
        ],
        "summary": "Delete a webhook",
        "description": "Deletes the webhook; nothing more is sent to it. Only the account holder, signed in themselves, can delete webhooks.",
        "operationId": "delete_webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The webhook's `id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_DeletedWebhook"
                },
                "examples": {
                  "success": {
                    "summary": "Deleted",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "pb_01m3pgps5ctt0rdj2zq50g1dad",
                        "deleted": true
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session or API key (an operator acting as the user, or a partner app); or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`webhook_not_found`: no webhook with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Already deleted",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "webhook_not_found",
                        "message": "Webhook not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`webhooks_disabled`: webhooks are not enabled on this server; or `service_unavailable`: the webhook store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "webhooks"
      },
      "patch": {
        "tags": [
          "webhooks"
        ],
        "summary": "Change a webhook",
        "description": "Changes only the fields sent: `url`, `events`, `accounts` (`null` = every account), `description` (`null` removes it) and `enabled`. `enabled: true` turns a webhook back on, also after it was turned off for failing (its failure count starts again). An empty body changes nothing.\n\nOnly the account holder, signed in themselves, can change webhooks.",
        "operationId": "update_webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The webhook's `id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPatch"
              },
              "examples": {
                "success": {
                  "summary": "Every account, one more event, turned off",
                  "value": {
                    "events": [
                      "order_update",
                      "trade",
                      "positions"
                    ],
                    "accounts": null,
                    "enabled": false
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The webhook after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_WebhookView"
                },
                "examples": {
                  "success": {
                    "summary": "Every account, one more event, turned off",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "pb_01m5yb0gy8qwqm4gbe8tg61nhf",
                        "url": "http://127.0.0.1:61319/hooks/orders",
                        "events": [
                          "order_update",
                          "trade",
                          "positions"
                        ],
                        "accounts": null,
                        "description": "Order desk",
                        "enabled": false,
                        "disabled_reason": "disabled_by_user",
                        "disabled_at": "2026-10-27T09:28:08.908Z",
                        "consecutive_failures": 0,
                        "last_success_at": null,
                        "last_failure_at": null,
                        "previous_secret_expires_at": null,
                        "secret_rotated_at": null,
                        "created_at": "2026-10-27T09:28:08.904Z",
                        "updated_at": "2026-10-27T09:28:08.908Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`: the body is not JSON or does not fit (unknown field, wrong type).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session or API key (an operator acting as the user, or a partner app); or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`webhook_not_found`: no webhook with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`; `field` names the input: `url`, `events`, `accounts` or `description` (same rules as on creation).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_own_account": {
                    "summary": "Only the user's own accounts",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "`NOT-MINE` is not one of your accounts",
                        "field": "accounts"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`webhooks_disabled`: webhooks are not enabled on this server; or `service_unavailable`: the webhook store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "webhooks"
      }
    },
    "/v1/postbacks/{id}/rotate-secret": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Rotate a webhook's secret",
        "description": "Issues a new signing secret, shown only in this response. For 24 hours deliveries are signed with both the new and the previous secret (one signature each in `webhook-signature`), so the receiver can switch without losing any. Only the account holder, signed in themselves, can rotate secrets.",
        "operationId": "rotate_webhook_secret",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The webhook's `id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook with its new secret (shown only here).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_WebhookWithSecret"
                },
                "examples": {
                  "success": {
                    "summary": "A new secret; the old one signs for 24 hours",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "pb_01m3pgps5ctt0rdj2zq50g1dad",
                        "url": "http://127.0.0.1:63815/hooks/alerts",
                        "events": [
                          "account_alert"
                        ],
                        "accounts": null,
                        "description": null,
                        "enabled": true,
                        "disabled_reason": null,
                        "disabled_at": null,
                        "consecutive_failures": 0,
                        "last_success_at": null,
                        "last_failure_at": null,
                        "previous_secret_expires_at": "2026-09-30T12:02:21.998Z",
                        "secret_rotated_at": "2026-09-29T12:02:21.998Z",
                        "created_at": "2026-09-29T12:02:21.996Z",
                        "updated_at": "2026-09-29T12:02:21.998Z",
                        "secret": "whsec_sesnDRH8eVMm3rJqiKEp0+QVa3wcLxUqhsXlqR2dqeQ=",
                        "note": "Store the secret now: it is not shown again."
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session or API key (an operator acting as the user, or a partner app); or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`webhook_not_found`: no webhook with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such webhook",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "webhook_not_found",
                        "message": "Webhook not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`webhooks_disabled`: webhooks are not enabled on this server; or `service_unavailable`: the webhook store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "webhooks"
      }
    },
    "/v1/postbacks/{id}/test": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Send a test delivery",
        "description": "Sends one signed `ping` event (body: component `WebhookPing`) to the webhook now, even when it is turned off, and says how the receiver answered. One attempt, no retry; it is logged with the webhook's deliveries. Only the account holder, signed in themselves, can send tests.",
        "operationId": "test_webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The webhook's `id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The attempt was made (check `delivered`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_WebhookTestResult"
                },
                "examples": {
                  "success": {
                    "summary": "The receiver answered 200",
                    "value": {
                      "status": "success",
                      "data": {
                        "event_id": "evt_cc2f23548b726e8a6a8bf980be542540",
                        "delivered": true,
                        "status_code": 200,
                        "duration_ms": 0,
                        "error_kind": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session or API key (an operator acting as the user, or a partner app); or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`webhook_not_found`: no webhook with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such webhook",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "webhook_not_found",
                        "message": "Webhook not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`webhooks_disabled`: webhooks are not enabled on this server; or `service_unavailable`: the webhook store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "webhooks"
      }
    },
    "/v1/postbacks/{id}/deliveries": {
      "get": {
        "tags": [
          "webhooks"
        ],
        "summary": "List a webhook's delivery attempts",
        "description": "Every delivery attempt of the last 7 days, newest first: event, attempt number, outcome, the receiver's status and timing (never the body). Page with `limit` and `cursor`.",
        "operationId": "list_webhook_deliveries",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The webhook's `id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1-200 (default 50).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` of the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of attempts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_WebhookDeliveryPage"
                },
                "examples": {
                  "success": {
                    "summary": "The test delivery",
                    "value": {
                      "status": "success",
                      "data": {
                        "deliveries": [
                          {
                            "id": "01M3PGPS5DF35SYE2PF2KKBM9V",
                            "event_id": "evt_cc2f23548b726e8a6a8bf980be542540",
                            "type": "ping",
                            "attempt": 1,
                            "outcome": "delivered",
                            "status_code": 200,
                            "duration_ms": 0,
                            "error_kind": null,
                            "at": "2026-09-29T12:02:21.997Z"
                          }
                        ],
                        "next_cursor": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: the query string does not parse (e.g. `limit` is not a number).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`webhook_not_found`: no webhook with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such webhook",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "webhook_not_found",
                        "message": "Webhook not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `limit`): `limit` is not 1-200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_limit": {
                    "summary": "At most 200 per page",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "limit must be 1 to 200",
                        "field": "limit"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`webhooks_disabled`: webhooks are not enabled on this server; or `service_unavailable`: the webhook store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/notifications": {
      "get": {
        "tags": [
          "notifications"
        ],
        "summary": "List notifications",
        "description": "The app inbox: every notification of the last 30 days, newest first, whatever other channels it also went to. Failures say what happened (`what_happened`), what was done (`what_we_did`) and what to do (`what_you_should_do`). Live ones arrive on `/v1/stream` with the `notifications` topic. Page with `limit` and `before`.",
        "operationId": "list_notifications",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1-100 (default 50).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "`next_cursor` of the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_NotificationPage"
                },
                "examples": {
                  "success": {
                    "summary": "The app inbox",
                    "value": {
                      "status": "success",
                      "data": {
                        "notifications": [
                          {
                            "id": "ntf_192dff593f9807f33bb4efe6",
                            "event": "trigger_fired",
                            "severity": "info",
                            "title": "Stop-loss hit on RELIANCE",
                            "what_happened": "RELIANCE traded at ₹2,474.50.",
                            "what_we_did": "We're placing the exit order.",
                            "what_you_should_do": null,
                            "account": "P1",
                            "strategy": "nifty-momentum",
                            "trigger_id": "01JA0000000000000000000001",
                            "source": {
                              "kind": "strategy",
                              "name": "nifty-momentum",
                              "role": "stop_loss"
                            },
                            "thread": "trigger:01JA0000000000000000000001",
                            "origin": {
                              "kind": "trigger_update",
                              "id": "01JA0000000000000000000001:3"
                            },
                            "at": "2026-10-16T10:45:30+05:30"
                          }
                        ],
                        "next_cursor": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: the query string does not parse.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_query": {
                    "summary": "limit is not a number",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_query",
                        "message": "invalid query string: invalid digit found in string",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "description": "`invalid_request` (`field`: `limit`): not 1-100.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_limit": {
                    "summary": "limit out of range",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "limit must be 1 to 100",
                        "field": "limit"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`notifications_disabled`: notifications are not enabled on this server (or not for this user); or `service_unavailable`: the notification store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "disabled": {
                    "summary": "Notifications are off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Notifications are not enabled on this server",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/notifications/events": {
      "get": {
        "tags": [
          "notifications"
        ],
        "summary": "List notification event types",
        "description": "Every event type a user can route, in display order, with its group, default and whether the app always shows it (`mandatory`). Types with `available: false` can be routed but are not sent yet.",
        "operationId": "list_notification_events",
        "responses": {
          "200": {
            "description": "Every event type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_NotificationEventInfo"
                },
                "examples": {
                  "success": {
                    "summary": "Every event type and its defaults",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "event": "trigger_fired",
                          "label": "Trigger fired",
                          "description": "A stop-loss, target, alert or ladder rung was hit.",
                          "group": "triggers",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "trigger_refused",
                          "label": "Trigger refused or errored",
                          "description": "A change to a trigger was refused, or the trigger stopped with an error.",
                          "group": "errors",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "trigger_ended",
                          "label": "Trigger ended",
                          "description": "A trigger ended on its own at day end or contract expiry.",
                          "group": "triggers",
                          "default_on": false,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "exit_placed",
                          "label": "Exit placed",
                          "description": "A trigger placed its exit order.",
                          "group": "triggers",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "exit_filled",
                          "label": "Exit filled",
                          "description": "An exit placed by a trigger filled.",
                          "group": "triggers",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "exit_refused",
                          "label": "Exit refused",
                          "description": "An exit could not be placed, or the broker refused it.",
                          "group": "errors",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "order_filled",
                          "label": "Order filled",
                          "description": "Any other order filled.",
                          "group": "orders",
                          "default_on": false,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "order_rejected",
                          "label": "Order rejected",
                          "description": "The broker refused an order.",
                          "group": "errors",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "order_unconfirmed",
                          "label": "Order not confirmed",
                          "description": "The broker did not confirm whether an order went through.",
                          "group": "errors",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "protection_failed",
                          "label": "Protection failed",
                          "description": "A stop-loss or target for a position could not be set up.",
                          "group": "errors",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "entry_failed",
                          "label": "Entry failed",
                          "description": "An automated entry failed, may not have gone through, or is still resting unfilled.",
                          "group": "errors",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "strategy_entered",
                          "label": "Strategy entered",
                          "description": "An automated strategy opened its positions.",
                          "group": "strategies",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "strategy_exited",
                          "label": "Strategy exited",
                          "description": "An automated strategy closed its positions.",
                          "group": "strategies",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "risk_breached",
                          "label": "Risk limit breached",
                          "description": "A loss or profit limit was reached: positions exited or the strategy paused.",
                          "group": "errors",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "session_expired",
                          "label": "Broker session expired",
                          "description": "A broker login expired or was replaced; orders cannot be placed until you log in again.",
                          "group": "account",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": true,
                          "available": true
                        },
                        {
                          "event": "live_updates",
                          "label": "Live updates",
                          "description": "Live updates from a broker stopped or came back.",
                          "group": "account",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": true,
                          "available": true
                        },
                        {
                          "event": "account_setup",
                          "label": "Account setup",
                          "description": "An account is missing a setting a feature needs.",
                          "group": "account",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": true,
                          "available": true
                        },
                        {
                          "event": "webhook_disabled",
                          "label": "Webhook turned off",
                          "description": "One of your webhooks was turned off after it kept failing.",
                          "group": "account",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": true,
                          "available": true
                        },
                        {
                          "event": "daily_summary",
                          "label": "Daily summary",
                          "description": "Your day's trades and P&L after market close.",
                          "group": "summary",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": true,
                          "available": false
                        },
                        {
                          "event": "channel_broken",
                          "label": "Notifications not reaching you",
                          "description": "A channel (such as Telegram) stopped delivering your updates.",
                          "group": "account",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": true,
                          "available": true
                        },
                        {
                          "event": "strategy_armed",
                          "label": "Strategy armed",
                          "description": "An automated strategy started watching for its entry.",
                          "group": "strategies",
                          "default_on": false,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "strategy_refused",
                          "label": "Strategy entry refused",
                          "description": "An automated strategy's entry was refused; nothing was placed and it tries again as its rules allow.",
                          "group": "strategies",
                          "default_on": true,
                          "mandatory": false,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "strategy_safety_pause",
                          "label": "Strategy paused for safety",
                          "description": "An automated strategy paused itself: too many orders or losses too fast, positions that differ from the broker's, or an entry the broker did not confirm.",
                          "group": "errors",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": false,
                          "available": true
                        },
                        {
                          "event": "strategy_kill_switch",
                          "label": "All strategies stopped",
                          "description": "Every automated strategy was stopped at once (the kill switch).",
                          "group": "strategies",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": true,
                          "available": true
                        },
                        {
                          "event": "strategy_error",
                          "label": "Strategy error",
                          "description": "An automated strategy stopped with an error.",
                          "group": "errors",
                          "default_on": true,
                          "mandatory": true,
                          "account_level": false,
                          "available": true
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`notifications_disabled`: notifications are not enabled on this server (or not for this user); or `service_unavailable`: the notification store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "disabled": {
                    "summary": "Notifications are off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Notifications are not enabled on this server",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/notifications/channels": {
      "get": {
        "tags": [
          "notifications"
        ],
        "summary": "Get notification channels",
        "description": "Each channel's state for the user: Telegram (`not_linked`, `linked` or `broken` with `broken_reason`, e.g. the user blocked the bot), the app, and the user's webhooks. `telegram.available: false` means the server has no Telegram bot: show `telegram.unavailable_reason` instead of a connect button (nothing is sent to Telegram; the app and webhooks still work). `prompts` lists what the app should show, most urgent first: `connect_telegram` (offer to connect; never while Telegram is unavailable), `telegram_broken` (updates are not reaching Telegram and go to the app instead), `webhook_failing`.",
        "operationId": "get_notification_channels",
        "responses": {
          "200": {
            "description": "Every channel's state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_NotificationChannels"
                },
                "examples": {
                  "linked": {
                    "summary": "Telegram linked and delivering",
                    "value": {
                      "status": "success",
                      "data": {
                        "telegram": {
                          "available": true,
                          "unavailable_reason": null,
                          "state": "linked",
                          "linked": true,
                          "healthy": true,
                          "broken_reason": null,
                          "broken_at": null,
                          "linked_at": "2026-10-18T13:27:56.350+05:30",
                          "last_delivered_at": null,
                          "telegram_username": "asha_trades",
                          "bot_username": "desk_bot"
                        },
                        "app_push": {
                          "healthy": true,
                          "stream_topic": "notifications"
                        },
                        "webhook": {
                          "enabled": false,
                          "receivers": []
                        },
                        "prompts": []
                      },
                      "error": null
                    }
                  },
                  "not_linked": {
                    "summary": "Telegram not linked yet: the app offers to connect it",
                    "value": {
                      "status": "success",
                      "data": {
                        "telegram": {
                          "available": true,
                          "unavailable_reason": null,
                          "state": "not_linked",
                          "linked": false,
                          "healthy": false,
                          "broken_reason": null,
                          "broken_at": null,
                          "linked_at": null,
                          "last_delivered_at": null,
                          "telegram_username": null,
                          "bot_username": "desk_bot"
                        },
                        "app_push": {
                          "healthy": true,
                          "stream_topic": "notifications"
                        },
                        "webhook": {
                          "enabled": false,
                          "receivers": []
                        },
                        "prompts": [
                          {
                            "kind": "connect_telegram",
                            "severity": "info",
                            "message": "Get your trade updates on Telegram: connect it in one tap."
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "telegram_unavailable": {
                    "summary": "No Telegram bot on this server: the app and webhooks only",
                    "value": {
                      "status": "success",
                      "data": {
                        "telegram": {
                          "available": false,
                          "unavailable_reason": "Telegram isn't set up on this server yet",
                          "state": "not_linked",
                          "linked": false,
                          "healthy": false,
                          "broken_reason": null,
                          "broken_at": null,
                          "linked_at": null,
                          "last_delivered_at": null,
                          "telegram_username": null,
                          "bot_username": ""
                        },
                        "app_push": {
                          "healthy": true,
                          "stream_topic": "notifications"
                        },
                        "webhook": {
                          "enabled": false,
                          "receivers": []
                        },
                        "prompts": []
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`notifications_disabled`: notifications are not enabled on this server (or not for this user); or `service_unavailable`: the notification store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "disabled": {
                    "summary": "Notifications are off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Notifications are not enabled on this server",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/notifications/preferences": {
      "get": {
        "tags": [
          "notifications"
        ],
        "summary": "Get notification preferences",
        "description": "Per channel (`telegram`, `app_push`, `webhook`): on or off, every event type on or off (defaults filled in), and the scope (`all`, or `selected` strategies and triggers; account events such as an expired login always come through). A notice goes to every channel that wants it. Mandatory events always reach the app; while Telegram is broken its notices go to the app instead.",
        "operationId": "get_notification_preferences",
        "responses": {
          "200": {
            "description": "The preferences.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_NotificationPreferences"
                },
                "examples": {
                  "defaults": {
                    "summary": "Never changed: every default",
                    "value": {
                      "status": "success",
                      "data": {
                        "telegram": {
                          "enabled": true,
                          "events": {
                            "account_setup": true,
                            "channel_broken": true,
                            "daily_summary": true,
                            "entry_failed": true,
                            "exit_filled": true,
                            "exit_placed": true,
                            "exit_refused": true,
                            "live_updates": true,
                            "order_filled": false,
                            "order_rejected": true,
                            "order_unconfirmed": true,
                            "protection_failed": true,
                            "risk_breached": true,
                            "session_expired": true,
                            "strategy_armed": false,
                            "strategy_entered": true,
                            "strategy_error": true,
                            "strategy_exited": true,
                            "strategy_kill_switch": true,
                            "strategy_refused": true,
                            "strategy_safety_pause": true,
                            "trigger_ended": false,
                            "trigger_fired": true,
                            "trigger_refused": true,
                            "webhook_disabled": true
                          },
                          "scope": {
                            "mode": "all",
                            "strategies": [],
                            "triggers": []
                          }
                        },
                        "app_push": {
                          "enabled": true,
                          "events": {
                            "account_setup": true,
                            "channel_broken": true,
                            "daily_summary": true,
                            "entry_failed": true,
                            "exit_filled": true,
                            "exit_placed": true,
                            "exit_refused": true,
                            "live_updates": true,
                            "order_filled": false,
                            "order_rejected": true,
                            "order_unconfirmed": true,
                            "protection_failed": true,
                            "risk_breached": true,
                            "session_expired": true,
                            "strategy_armed": false,
                            "strategy_entered": true,
                            "strategy_error": true,
                            "strategy_exited": true,
                            "strategy_kill_switch": true,
                            "strategy_refused": true,
                            "strategy_safety_pause": true,
                            "trigger_ended": false,
                            "trigger_fired": true,
                            "trigger_refused": true,
                            "webhook_disabled": true
                          },
                          "scope": {
                            "mode": "all",
                            "strategies": [],
                            "triggers": []
                          }
                        },
                        "webhook": {
                          "enabled": false,
                          "events": {
                            "account_setup": true,
                            "channel_broken": true,
                            "daily_summary": true,
                            "entry_failed": true,
                            "exit_filled": true,
                            "exit_placed": true,
                            "exit_refused": true,
                            "live_updates": true,
                            "order_filled": false,
                            "order_rejected": true,
                            "order_unconfirmed": true,
                            "protection_failed": true,
                            "risk_breached": true,
                            "session_expired": true,
                            "strategy_armed": false,
                            "strategy_entered": true,
                            "strategy_error": true,
                            "strategy_exited": true,
                            "strategy_kill_switch": true,
                            "strategy_refused": true,
                            "strategy_safety_pause": true,
                            "trigger_ended": false,
                            "trigger_fired": true,
                            "trigger_refused": true,
                            "webhook_disabled": true
                          },
                          "scope": {
                            "mode": "all",
                            "strategies": [],
                            "triggers": []
                          }
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`notifications_disabled`: notifications are not enabled on this server (or not for this user); or `service_unavailable`: the notification store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "disabled": {
                    "summary": "Notifications are off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Notifications are not enabled on this server",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "put": {
        "tags": [
          "notifications"
        ],
        "summary": "Replace notification preferences",
        "description": "Replaces the preferences. A channel left out goes back to its defaults; an event left out of `events` follows its default. `webhook.webhook_ids` picks which of the user's webhooks get the `notification` event (null: every enabled one).",
        "operationId": "update_notification_preferences",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationPreferencesUpdate"
              },
              "examples": {
                "success": {
                  "summary": "Fills on Telegram, one strategy only",
                  "value": {
                    "telegram": {
                      "enabled": true,
                      "events": {
                        "order_filled": true,
                        "trigger_ended": false
                      },
                      "scope": {
                        "mode": "selected",
                        "strategies": [
                          "nifty-momentum"
                        ],
                        "triggers": []
                      }
                    },
                    "app_push": {
                      "enabled": true,
                      "events": {},
                      "scope": {
                        "mode": "all"
                      }
                    },
                    "webhook": {
                      "enabled": false
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The preferences as stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_NotificationPreferences"
                },
                "examples": {
                  "success": {
                    "summary": "Fills on Telegram, one strategy only",
                    "value": {
                      "status": "success",
                      "data": {
                        "telegram": {
                          "enabled": true,
                          "events": {
                            "account_setup": true,
                            "channel_broken": true,
                            "daily_summary": true,
                            "entry_failed": true,
                            "exit_filled": true,
                            "exit_placed": true,
                            "exit_refused": true,
                            "live_updates": true,
                            "order_filled": true,
                            "order_rejected": true,
                            "order_unconfirmed": true,
                            "protection_failed": true,
                            "risk_breached": true,
                            "session_expired": true,
                            "strategy_armed": false,
                            "strategy_entered": true,
                            "strategy_error": true,
                            "strategy_exited": true,
                            "strategy_kill_switch": true,
                            "strategy_refused": true,
                            "strategy_safety_pause": true,
                            "trigger_ended": false,
                            "trigger_fired": true,
                            "trigger_refused": true,
                            "webhook_disabled": true
                          },
                          "scope": {
                            "mode": "selected",
                            "strategies": [
                              "nifty-momentum"
                            ],
                            "triggers": []
                          }
                        },
                        "app_push": {
                          "enabled": true,
                          "events": {
                            "account_setup": true,
                            "channel_broken": true,
                            "daily_summary": true,
                            "entry_failed": true,
                            "exit_filled": true,
                            "exit_placed": true,
                            "exit_refused": true,
                            "live_updates": true,
                            "order_filled": false,
                            "order_rejected": true,
                            "order_unconfirmed": true,
                            "protection_failed": true,
                            "risk_breached": true,
                            "session_expired": true,
                            "strategy_armed": false,
                            "strategy_entered": true,
                            "strategy_error": true,
                            "strategy_exited": true,
                            "strategy_kill_switch": true,
                            "strategy_refused": true,
                            "strategy_safety_pause": true,
                            "trigger_ended": false,
                            "trigger_fired": true,
                            "trigger_refused": true,
                            "webhook_disabled": true
                          },
                          "scope": {
                            "mode": "all",
                            "strategies": [],
                            "triggers": []
                          }
                        },
                        "webhook": {
                          "enabled": false,
                          "events": {
                            "account_setup": true,
                            "channel_broken": true,
                            "daily_summary": true,
                            "entry_failed": true,
                            "exit_filled": true,
                            "exit_placed": true,
                            "exit_refused": true,
                            "live_updates": true,
                            "order_filled": false,
                            "order_rejected": true,
                            "order_unconfirmed": true,
                            "protection_failed": true,
                            "risk_breached": true,
                            "session_expired": true,
                            "strategy_armed": false,
                            "strategy_entered": true,
                            "strategy_error": true,
                            "strategy_exited": true,
                            "strategy_kill_switch": true,
                            "strategy_refused": true,
                            "strategy_safety_pause": true,
                            "trigger_ended": false,
                            "trigger_fired": true,
                            "trigger_refused": true,
                            "webhook_disabled": true
                          },
                          "scope": {
                            "mode": "all",
                            "strategies": [],
                            "triggers": []
                          }
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`: the body is not JSON or does not fit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "malformed": {
                    "summary": "Not a preferences body",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: invalid length 0, expected struct PreferencesUpdate with 3 elements",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_api_key": {
                    "summary": "An unknown or revoked API key",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Invalid API key",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session or API key (an operator acting as the user, or a partner app); or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the `notifications` scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `notifications` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`; `field` names the input, e.g. `telegram.events.fills` (unknown event), `app_push.events.protection_failed` (always shown in the app), `webhook.scope` (`selected` with nothing chosen) or `webhook.webhook_ids` (not the user's).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_event": {
                    "summary": "An unknown event name is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "unknown event; see GET /v1/notifications/events",
                        "field": "telegram.events.fills"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`notifications_disabled`: notifications are not enabled on this server (or not for this user); or `service_unavailable`: the notification store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "disabled": {
                    "summary": "Notifications are off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Notifications are not enabled on this server",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "notifications"
      }
    },
    "/v1/notifications/telegram/link": {
      "post": {
        "tags": [
          "notifications",
          "app_session_only"
        ],
        "summary": "Start linking Telegram",
        "description": "A one-time deep link to the bot (`https://t.me/<bot>?start=<token>`), valid for a few minutes. Opening it and tapping Start links that Telegram chat to the user and confirms in the chat; a new link replaces nothing until used. Poll `GET /v1/notifications/channels` to see it linked. Only the account holder, signed in themselves, can link.",
        "operationId": "start_telegram_link",
        "responses": {
          "201": {
            "description": "The link (works once).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TelegramLinkStart"
                },
                "examples": {
                  "success": {
                    "summary": "A one-time link to the bot",
                    "value": {
                      "status": "success",
                      "data": {
                        "url": "https://t.me/desk_bot?start=tl_V8hLhHejvIyDpAQwWDcQNnGeI8IdEVIZ",
                        "bot_username": "desk_bot",
                        "expires_at": "2026-10-18T13:37:56.348541+05:30",
                        "expires_in_seconds": 600
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session; or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "own_session_required": {
                    "summary": "An operator acting as the user cannot link",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "own_session_required",
                        "message": "Only the account holder, signed in themselves, can do this",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`notifications_disabled`: notifications are not enabled on this server (or not for this user), or Telegram is not set up on this server (`message` says so; `GET /v1/notifications/channels` shows `telegram.available: false`); or `service_unavailable`: the notification store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "disabled": {
                    "summary": "Notifications are off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Notifications are not enabled on this server",
                        "field": null
                      }
                    }
                  },
                  "telegram_unavailable": {
                    "summary": "Telegram is not set up on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Telegram isn't set up on this server yet",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      },
      "delete": {
        "tags": [
          "notifications",
          "app_session_only"
        ],
        "summary": "Unlink Telegram",
        "description": "Stops all Telegram messages to the user (sending `/stop` to the bot does the same). Their notices keep reaching the app.",
        "operationId": "unlink_telegram",
        "responses": {
          "200": {
            "description": "Unlinked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_UnlinkedTelegram"
                },
                "examples": {
                  "success": {
                    "summary": "Telegram unlinked",
                    "value": {
                      "status": "success",
                      "data": {
                        "unlinked": true
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`telegram_not_linked`: Telegram is not linked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_linked": {
                    "summary": "Telegram was not linked",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "telegram_not_linked",
                        "message": "Telegram is not connected; connect it first",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`notifications_disabled`: notifications are not enabled on this server (or not for this user); or `service_unavailable`: the notification store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "disabled": {
                    "summary": "Notifications are off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Notifications are not enabled on this server",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/notifications/telegram/test": {
      "post": {
        "tags": [
          "notifications",
          "app_session_only"
        ],
        "summary": "Send a Telegram test message",
        "description": "Sends a test message to the linked chat now and says whether Telegram took it. When Telegram refuses it for good (the bot is blocked), the link is marked `broken`, `broken_reason` says why and `message` what to do.",
        "operationId": "test_telegram",
        "responses": {
          "200": {
            "description": "The attempt was made (check `delivered`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_TelegramTestResult"
                },
                "examples": {
                  "delivered": {
                    "summary": "Telegram took the test message",
                    "value": {
                      "status": "success",
                      "data": {
                        "delivered": true,
                        "message": "Sent. Check your Telegram chat with the bot.",
                        "broken_reason": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`telegram_not_linked`: Telegram is not linked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_linked": {
                    "summary": "Telegram is not linked",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "telegram_not_linked",
                        "message": "Telegram is not connected; connect it first",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`notifications_disabled`: notifications are not enabled on this server (or not for this user), or Telegram is not set up on this server (`message` says so; `GET /v1/notifications/channels` shows `telegram.available: false`); or `service_unavailable`: the notification store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "disabled": {
                    "summary": "Notifications are off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Notifications are not enabled on this server",
                        "field": null
                      }
                    }
                  },
                  "telegram_unavailable": {
                    "summary": "Telegram is not set up on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "notifications_disabled",
                        "message": "Telegram isn't set up on this server yet",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/hooks/endpoints": {
      "get": {
        "tags": [
          "signal_urls",
          "app_session_only"
        ],
        "summary": "List signal URLs",
        "description": "The signed-in user's live signal URLs (never their secrets).",
        "operationId": "list_signal_urls",
        "responses": {
          "200": {
            "description": "Live signal URLs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_SignalUrl"
                },
                "examples": {
                  "success": {
                    "summary": "The user's live URLs",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "endpoint_id": "we_6USUzj3Fc2VUfgXa",
                          "kind": "tradingview",
                          "strategy_id": "nifty-breakout-01M3PGPS2RED832PWZ7N5VS16P",
                          "created_at": "2026-09-29T12:02:21.916811+00:00",
                          "has_body_secret": true
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: signal URLs are not enabled on this server, or their store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      },
      "post": {
        "tags": [
          "signal_urls",
          "app_session_only"
        ],
        "summary": "Issue a signal URL",
        "description": "Issues a secret URL for one strategy and provider. Give the provider the API origin followed by `path`; for TradingView also put `\"secret\": \"<body_secret>\"` in the alert message. The URL (and body secret) are shown only in this response. Issuing a new URL for the same strategy and provider revokes the previous one at once.\n\nWhat each provider sends to the URL, and every reply, is described on `POST /v1/hooks/{kind}/{secret}`. Only the account holder, signed in themselves, can issue URLs.",
        "operationId": "issue_signal_url",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueSignalUrlRequest"
              },
              "examples": {
                "success": {
                  "summary": "A TradingView URL (with a body secret)",
                  "value": {
                    "kind": "tradingview",
                    "strategy_id": "nifty-breakout-01M3PGPS2RED832PWZ7N5VS16P"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Issued; the URL is shown only here.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_IssuedSignalUrl"
                },
                "examples": {
                  "success": {
                    "summary": "A TradingView URL (with a body secret)",
                    "value": {
                      "status": "success",
                      "data": {
                        "endpoint_id": "we_6USUzj3Fc2VUfgXa",
                        "kind": "tradingview",
                        "strategy_id": "nifty-breakout-01M3PGPS2RED832PWZ7N5VS16P",
                        "created_at": "2026-09-29T12:02:21.916811+00:00",
                        "has_body_secret": true,
                        "path": "/v1/hooks/tradingview/wh_wDMkI4XGVWLhusCX9Bb0UatmpoJdHTLECRdRR9ggged",
                        "body_secret": "tvs_bD1ZOvrvN4dKZrKmCkfTL7eg7i0LVOW0",
                        "note": "Keep this URL private: anyone with it can send signals. Issuing a new one revokes this."
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`: the body is not JSON or does not fit (unknown field, unknown `kind`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_kind": {
                    "summary": "An unknown provider is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown variant `telegram`, expected one of `kuberhunt`, `tradingview`, `chartink`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session; or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `strategy_id`): not 1-64 letters, digits, `-` or `_`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_strategy_id": {
                    "summary": "Strategy ids are letters, digits, - and _",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "strategy_id must be 1-64 letters, digits, '-' or '_'",
                        "field": "strategy_id"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: signal URLs are not enabled on this server, or their store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/hooks/endpoints/{endpoint_id}": {
      "delete": {
        "tags": [
          "signal_urls",
          "app_session_only"
        ],
        "summary": "Revoke a signal URL",
        "description": "Revokes the URL at once: the provider's next request gets 404.",
        "operationId": "revoke_signal_url",
        "parameters": [
          {
            "name": "endpoint_id",
            "in": "path",
            "description": "The signal URL's `endpoint_id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_RevokedSignalUrl"
                },
                "examples": {
                  "success": {
                    "summary": "Revoked",
                    "value": {
                      "status": "success",
                      "data": {
                        "endpoint_id": "we_6USUzj3Fc2VUfgXa",
                        "revoked": true
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`endpoint_not_found`: no live signal URL with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Already revoked",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "endpoint_not_found",
                        "message": "Webhook endpoint not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: signal URLs are not enabled on this server, or their store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/hooks/endpoints/{endpoint_id}/rotate": {
      "post": {
        "tags": [
          "signal_urls",
          "app_session_only"
        ],
        "summary": "Rotate a signal URL",
        "description": "Issues a new secret URL (and, for TradingView, a new body secret) for the same `endpoint_id`, shown only in this response. The old URL stops working at once. Only the account holder, signed in themselves, can rotate URLs.",
        "operationId": "rotate_signal_url",
        "parameters": [
          {
            "name": "endpoint_id",
            "in": "path",
            "description": "The signal URL's `endpoint_id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The new URL (shown only here).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_IssuedSignalUrl"
                },
                "examples": {
                  "success": {
                    "summary": "A new URL and body secret; the old URL is dead",
                    "value": {
                      "status": "success",
                      "data": {
                        "endpoint_id": "we_6USUzj3Fc2VUfgXa",
                        "kind": "tradingview",
                        "strategy_id": "nifty-breakout-01M3PGPS2RED832PWZ7N5VS16P",
                        "created_at": "2026-09-29T12:02:21.926086+00:00",
                        "has_body_secret": true,
                        "path": "/v1/hooks/tradingview/wh_afgJybcPb09zIeVruYYtBlwm1paQkKo1VtryahqbOTB",
                        "body_secret": "tvs_GKEskzlA7wA0oZ2TWs3ph7g0mHUeiPba",
                        "note": "Give the provider this new URL now: the old one no longer works. It is shown only once."
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session; or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`endpoint_not_found`: no live signal URL with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "A revoked URL",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "endpoint_not_found",
                        "message": "Webhook endpoint not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: signal URLs are not enabled on this server, or their store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/hooks/endpoints/{endpoint_id}/deliveries": {
      "get": {
        "tags": [
          "signal_urls",
          "app_session_only"
        ],
        "summary": "List what a signal URL received",
        "description": "Every request the URL received in the last 7 days, newest first: when, the outcome in one word, why in plain words, the orders it placed and the status the provider was answered with (never the payload). Page with `limit` and `cursor`.",
        "operationId": "list_signal_url_deliveries",
        "parameters": [
          {
            "name": "endpoint_id",
            "in": "path",
            "description": "The signal URL's `endpoint_id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, at least 1 (default 50; above 200 counts as 200).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` of the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of deliveries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SignalUrlDeliveryPage"
                },
                "examples": {
                  "success": {
                    "summary": "Newest first: rate limited, two duplicates, placed",
                    "value": {
                      "status": "success",
                      "data": {
                        "items": [
                          {
                            "delivery_id": "01M3PGPS5220JGR75R52C6M2XY",
                            "at": "2026-09-29T12:02:21.986Z",
                            "provider": "chartink",
                            "outcome": "rate_limited",
                            "reason": "too many alerts in a short time; extra ones were refused",
                            "orders_placed": 0,
                            "order_ids": [],
                            "http_status": 429,
                            "request_id": "01M3PGPS4YGSNDQW6RQGZXNDP9"
                          },
                          {
                            "delivery_id": "01M3PGPS4YZ5CPAXJSB94WSXSQ",
                            "at": "2026-09-29T12:02:21.982Z",
                            "provider": "chartink",
                            "outcome": "duplicate",
                            "reason": "the same alert arrived twice; the copy was skipped",
                            "orders_placed": 0,
                            "order_ids": [],
                            "http_status": 200,
                            "request_id": "01M3PGPS4WS2X3TGFQEG16DYKD"
                          },
                          {
                            "delivery_id": "01M3PGPS4WTGQ0EJZRCMW5RA52",
                            "at": "2026-09-29T12:02:21.980Z",
                            "provider": "chartink",
                            "outcome": "duplicate",
                            "reason": "the same alert arrived twice; the copy was skipped",
                            "orders_placed": 0,
                            "order_ids": [],
                            "http_status": 200,
                            "request_id": "01M3PGPS4V5PYNQGZ8ZC2A4FV2"
                          },
                          {
                            "delivery_id": "01M3PGPS4VERYPXBJRKY6DFR6Y",
                            "at": "2026-09-29T12:02:21.979Z",
                            "provider": "chartink",
                            "outcome": "placed",
                            "reason": null,
                            "orders_placed": 1,
                            "order_ids": [
                              "PAPER-1"
                            ],
                            "http_status": 200,
                            "request_id": "01M3PGPS4KQG8PH1F4PJ1YC283"
                          }
                        ],
                        "next_cursor": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_query`: the query string does not parse (unknown parameter, `limit` not a number).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`endpoint_not_found`: no live signal URL with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such signal URL",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "endpoint_not_found",
                        "message": "Webhook endpoint not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`; `field` is `limit` (0) or `cursor` (not a cursor this route gave).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_cursor": {
                    "summary": "A cursor this route did not give",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "invalid cursor",
                        "field": "cursor"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: signal URLs are not enabled on this server, or their store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/hooks/endpoints/{endpoint_id}/test": {
      "post": {
        "tags": [
          "signal_urls",
          "app_session_only"
        ],
        "summary": "Dry-run a signal",
        "description": "Runs a payload through the same checks, parsing and strategy rules as a real delivery to this URL and says which orders it would place, without placing anything or touching any state (duplicate / sequence checks, daily entry counts, the URL's rate limit, the activity and delivery logs). Send the provider's payload as the body (for Kuberhunt, with its signature headers to check the signature too); an empty body checks a sample alert. Problems with the payload are reported in `errors` with 200, not as HTTP errors.",
        "operationId": "test_signal_url",
        "parameters": [
          {
            "name": "endpoint_id",
            "in": "path",
            "description": "The signal URL's `endpoint_id`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Kuberhunt-Signature",
            "in": "header",
            "description": "Kuberhunt only: `v1=<hex HMAC-SHA256>`; without it the signature is not checked (a warning says so).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "X-Kuberhunt-Timestamp",
            "in": "header",
            "description": "Kuberhunt only: Unix seconds the signature was made at.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "description": "The payload the provider would send (optional).",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TradingViewAlert"
                  },
                  {
                    "$ref": "#/components/schemas/ChartinkAlert"
                  },
                  {
                    "$ref": "#/components/schemas/KuberhuntEvent"
                  }
                ],
                "description": "What the provider sends, by the URL's `kind`: `tradingview` -> `TradingViewAlert` (the alert's message as JSON, with the body secret), `chartink` -> `ChartinkAlert` (Chartink's scanner alert as it sends it), `kuberhunt` -> `KuberhuntEvent` (signed with `X-Kuberhunt-Signature` / `X-Kuberhunt-Timestamp`)."
              },
              "examples": {
                "would_place": {
                  "summary": "A Chartink alert would place one order",
                  "value": {
                    "stocks": "TESTSU",
                    "trigger_prices": "100.03",
                    "triggered_at": "9:30 am",
                    "scan_name": "Breakouts",
                    "alert_name": "Breakout alert"
                  }
                },
                "wrong_secret": {
                  "summary": "A TradingView alert with the wrong body secret would be refused",
                  "value": {
                    "type": "entry",
                    "secret": "tvs_not_the_secret"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "What a real delivery would do (check `valid`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SignalDryRun"
                },
                "examples": {
                  "would_place": {
                    "summary": "A Chartink alert would place one order",
                    "value": {
                      "status": "success",
                      "data": {
                        "valid": true,
                        "errors": [],
                        "warnings": [],
                        "would_place": [
                          {
                            "account": "P1",
                            "symbol": "TESTSU-EQ",
                            "exchange": "NSE",
                            "side": "BUY",
                            "qty": 3,
                            "order_type": "LIMIT",
                            "price": 100.55,
                            "product": "MIS"
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "wrong_secret": {
                    "summary": "A TradingView alert with the wrong body secret would be refused",
                    "value": {
                      "status": "success",
                      "data": {
                        "valid": false,
                        "errors": [
                          "the alert's secret did not match this strategy"
                        ],
                        "warnings": [],
                        "would_place": []
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`endpoint_not_found`: no live signal URL with this id for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such signal URL",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "endpoint_not_found",
                        "message": "Webhook endpoint not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: signal URLs are not enabled on this server, or the URL or strategy store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/hooks/{kind}/{secret}": {
      "post": {
        "tags": [
          "signal_urls"
        ],
        "summary": "Receive a provider signal",
        "description": "The URL a provider (TradingView, Chartink, Kuberhunt) calls; no `Authorization`: the secret in the URL is the credential (plus the body secret for TradingView and the signature for Kuberhunt). The body depends on `kind` (see `TradingViewAlert`, `ChartinkAlert`, `KuberhuntEvent`). Orders are placed as the URL's owner, following the strategy's settings.\n\nReplies are not the REST envelope: they are made for the providers, which only look at the status. 200 means received (whatever it came to: see the URL's deliveries and the activity log); only 503 asks for the same delivery again. Each URL has its own rate limit, shown in `X-RateLimit-Limit` / `X-RateLimit-Remaining` on every reply once the URL is known.",
        "operationId": "receive_signal",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "description": "The provider the URL was issued for.",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/SignalProvider"
            }
          },
          {
            "name": "secret",
            "in": "path",
            "description": "The URL secret (`wh_...`), from `path` when the URL was issued.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Kuberhunt-Signature",
            "in": "header",
            "description": "Kuberhunt: `v1=<hex HMAC-SHA256>` of `{timestamp}.{raw body}`, keyed with the strategy's Kuberhunt webhook secret.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "X-Kuberhunt-Timestamp",
            "in": "header",
            "description": "Kuberhunt: Unix seconds, within 300 s of now.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "description": "The provider's payload, by `kind`.",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TradingViewAlert"
                  },
                  {
                    "$ref": "#/components/schemas/ChartinkAlert"
                  },
                  {
                    "$ref": "#/components/schemas/KuberhuntEvent"
                  }
                ],
                "description": "What the provider sends, by the URL's `kind`: `tradingview` -> `TradingViewAlert` (the alert's message as JSON, with the body secret), `chartink` -> `ChartinkAlert` (Chartink's scanner alert as it sends it), `kuberhunt` -> `KuberhuntEvent` (signed with `X-Kuberhunt-Signature` / `X-Kuberhunt-Timestamp`)."
              },
              "examples": {
                "chartink_alert": {
                  "summary": "A Chartink alert placed its orders",
                  "value": {
                    "stocks": "TESTSU",
                    "trigger_prices": "100.03",
                    "triggered_at": "9:20 am",
                    "scan_name": "Breakouts",
                    "alert_name": "Breakout alert"
                  }
                },
                "duplicate": {
                  "summary": "The same alert again: skipped",
                  "value": {
                    "stocks": "TESTSU",
                    "trigger_prices": "100.03",
                    "triggered_at": "9:20 am",
                    "scan_name": "Breakouts",
                    "alert_name": "Breakout alert"
                  }
                },
                "kuberhunt_event": {
                  "summary": "A signed Kuberhunt entry placed its order",
                  "value": {
                    "event": "reco.activated",
                    "event_id": "evt-01M3PGPS4KDK6VC8MKRGQSFN27",
                    "event_seq": 1,
                    "timestamp": "2026-09-29T12:02:21.971076+00:00",
                    "reco": {
                      "reco_id": "reco-01M3PGPS4KZ5869A3TDC0DG7KT",
                      "instrument_token": "CT:TEST:RELIANCE",
                      "action": "BUY",
                      "product": "INTRADAY",
                      "lower_price": 2490,
                      "entry_price": 2500
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Received (also when nothing was placed: duplicates, paused strategies, unreadable payloads and failed Kuberhunt signature checks are answered 200 so the provider does not retry).",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "description": "Requests this URL may receive per window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "description": "Requests left in the window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignalAck",
                  "description": "Received (see `SignalAckMessage` for every message)."
                },
                "examples": {
                  "chartink_alert": {
                    "summary": "A Chartink alert placed its orders",
                    "value": {
                      "message": "Webhook received"
                    }
                  },
                  "duplicate": {
                    "summary": "The same alert again: skipped",
                    "value": {
                      "message": "Duplicate"
                    }
                  },
                  "kuberhunt_event": {
                    "summary": "A signed Kuberhunt entry placed its order",
                    "value": {
                      "message": "Webhook received"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The TradingView body secret is missing or wrong (`SignalForbidden`), or the URL's owner is not enabled for order management (`oms_not_enabled`, REST envelope).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SignalForbidden"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    }
                  ],
                  "description": "`SignalForbidden` (`Invalid secret`: the TradingView body secret is missing or wrong), or the standard error envelope with `error.code` `oms_not_enabled` (the URL's owner is not enabled for order management)."
                },
                "examples": {
                  "wrong_body_secret": {
                    "summary": "A TradingView alert with the wrong body secret",
                    "value": {
                      "message": "Invalid secret"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`Unknown webhook`: unknown, revoked or malformed URL (also when signal URLs are off on this server).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignalError",
                  "description": "Before the URL's strategy is known."
                },
                "examples": {
                  "unknown_url": {
                    "summary": "An unknown or revoked URL",
                    "value": {
                      "status": "error",
                      "message": "Unknown webhook"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`rate limited; retry in {n} ms`: the URL's rate limit is reached; nothing was processed.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "description": "Seconds to wait."
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "description": "Requests this URL may receive per window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "description": "Always 0."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignalError",
                  "description": "Before the URL's strategy is known."
                },
                "examples": {
                  "rate_limited": {
                    "summary": "Over the URL's rate limit",
                    "value": {
                      "status": "error",
                      "message": "rate limited; retry in 988 ms"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; send the same delivery again later.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SignalRetry"
                    },
                    {
                      "$ref": "#/components/schemas/SignalError"
                    }
                  ],
                  "description": "Send the same delivery again later: `SignalRetry` once the URL is known, `SignalError` (`temporarily unavailable`) when the URL could not be looked up."
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/api-keys": {
      "get": {
        "tags": [
          "api_keys",
          "app_session_only"
        ],
        "summary": "List API keys",
        "description": "The signed-in user's active API keys (revoked ones are not listed). Secrets are never returned.",
        "operationId": "list_api_keys",
        "responses": {
          "200": {
            "description": "Active keys, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_ApiKeyView"
                },
                "examples": {
                  "success": {
                    "summary": "The user's active keys",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "key_id": "ck_KD6UFTQOmSAeXuOp1skp",
                          "name": "Trading bot",
                          "scopes": [
                            "read",
                            "orders"
                          ],
                          "ip_allowlist": [
                            "203.0.113.7"
                          ],
                          "created_at": "2026-10-30T07:27:47.011712+00:00",
                          "last_used_at": null
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: API keys are not enabled on this server, or the key store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      },
      "post": {
        "tags": [
          "api_keys",
          "app_session_only"
        ],
        "summary": "Create an API key",
        "description": "Creates a long-lived API key with the chosen scopes (and optionally an IP allowlist). The secret is in this response only: store it now. Authenticate with `Authorization: token <key_id>:<api_secret>`. At most 10 keys may be active at once.\n\nOnly the account holder, signed in themselves, can create keys (an operator acting as the user gets 403 `own_session_required`).",
        "operationId": "create_api_key",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewApiKey"
              },
              "examples": {
                "success": {
                  "summary": "A key for reads and orders from one IP",
                  "value": {
                    "name": "Trading bot",
                    "scopes": [
                      "read",
                      "orders"
                    ],
                    "ip_allowlist": [
                      "203.0.113.7"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created; the secret is shown only here.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_CreatedApiKey"
                },
                "examples": {
                  "success": {
                    "summary": "A key for reads and orders from one IP",
                    "value": {
                      "status": "success",
                      "data": {
                        "key_id": "ck_KD6UFTQOmSAeXuOp1skp",
                        "name": "Trading bot",
                        "scopes": [
                          "read",
                          "orders"
                        ],
                        "ip_allowlist": [
                          "203.0.113.7"
                        ],
                        "created_at": "2026-10-30T07:27:47.011712+00:00",
                        "last_used_at": null,
                        "api_secret": "cs_VitRnJ2TL0fQitoxmXL1yk0mhQo66fmZXe0VFNXL",
                        "note": "Store the secret now: it is not shown again."
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`: the body is not JSON or does not fit (unknown field, unknown scope, wrong type).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_scope": {
                    "summary": "An unknown scope is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown variant `admin`, expected one of `read`, `orders`, `triggers`, `strategies`, `strategies_live`, `strategies_signal`, `webhooks`, `notifications`, `watchlists`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session; or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "own_session_required": {
                    "summary": "An operator acting as the user cannot create keys",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "own_session_required",
                        "message": "Only the account holder, signed in themselves, can do this",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `api_key`): name not 1-64 characters, no scope, more than 20 or an invalid IP address, or 10 keys already active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "no_scope": {
                    "summary": "A key needs at least one scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "choose at least one scope",
                        "field": "api_key"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: API keys are not enabled on this server, or the key store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/api-keys/{key_id}": {
      "delete": {
        "tags": [
          "api_keys",
          "app_session_only"
        ],
        "summary": "Revoke an API key",
        "description": "Revokes the key at once: requests with it are refused from now on (on every server within a few seconds at most).",
        "operationId": "revoke_api_key",
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "description": "The key's `key_id` (`ck_...`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_RevokedApiKey"
                },
                "examples": {
                  "success": {
                    "summary": "Revoked",
                    "value": {
                      "status": "success",
                      "data": {
                        "key_id": "ck_KD6UFTQOmSAeXuOp1skp",
                        "revoked": true
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`api_key_not_found`: no active key with this id for the caller (unknown, another user's, or already revoked).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Already revoked",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "api_key_not_found",
                        "message": "API key not found",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: API keys are not enabled on this server, or the key store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/partner-apps": {
      "get": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "List your partner apps",
        "description": "The partner apps the signed-in user registered, oldest first, disabled ones included (`disabled: true`). Client secrets are never shown again.",
        "operationId": "list_partner_apps",
        "responses": {
          "200": {
            "description": "The user's apps.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_PartnerApp"
                },
                "examples": {
                  "success": {
                    "summary": "The user's apps",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "client_id": "cp_FALC8i71s3F8cUwwozJ3",
                          "owner": "user-01M65VA95TDN35YPSTZ49AQXKA",
                          "name": "Charts Co",
                          "verified": false,
                          "logo_url": "https://partner.example/logo.png",
                          "redirect_uris": [
                            "https://partner.example/callback"
                          ],
                          "scopes": [
                            "read",
                            "orders"
                          ],
                          "created_at": "2026-10-30T07:27:47.011712+00:00",
                          "disabled": false
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access is off on this server or its store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unavailable": {
                    "summary": "Partner access is off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Partner access is not enabled on this server",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      },
      "post": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "Register a partner app",
        "description": "Registers an OAuth client owned by the signed-in user (at most 10 active apps per user). The response carries `client_secret` once: store it now, it cannot be shown again. New apps are unverified.",
        "operationId": "create_partner_app",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewPartnerApp"
              },
              "examples": {
                "success": {
                  "summary": "Registered; the client secret is shown once",
                  "value": {
                    "name": "Charts Co",
                    "redirect_uris": [
                      "https://partner.example/callback"
                    ],
                    "scopes": [
                      "read",
                      "orders"
                    ],
                    "logo_url": "https://partner.example/logo.png"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Registered; `client_secret` is shown only here.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_RegisteredPartnerApp"
                },
                "examples": {
                  "success": {
                    "summary": "Registered; the client secret is shown once",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_FALC8i71s3F8cUwwozJ3",
                        "owner": "user-01M65VA95TDN35YPSTZ49AQXKA",
                        "name": "Charts Co",
                        "verified": false,
                        "logo_url": "https://partner.example/logo.png",
                        "redirect_uris": [
                          "https://partner.example/callback"
                        ],
                        "scopes": [
                          "read",
                          "orders"
                        ],
                        "created_at": "2026-10-30T07:27:47.011712+00:00",
                        "disabled": false,
                        "client_secret": "cps_CwtJDmZDiRmYlwiK6Vysz7KlDl8VGnJ6vDK6H5avLE328NAl",
                        "note": "Store the client secret now: it is not shown again."
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`: not JSON, an unknown field, or an unknown scope name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_scope": {
                    "summary": "An unknown scope name is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown variant `admin`, expected one of `read`, `orders`, `triggers`, `strategies`, `strategies_live`, `strategies_signal`, `webhooks`, `notifications`, `watchlists`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: only the account holder, signed in themselves, can register apps; `forbidden`: not an app session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: bad name (1-80 characters), redirect URIs (1-10, https or localhost, no fragment) or `logo_url` (https), or the 10 active apps limit is reached; `invalid_scope`: no scope chosen.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_redirect_uri": {
                    "summary": "A plain-HTTP redirect URI (not localhost) is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "redirect URI `http://partner.example/cb` must be https (http only for localhost), without a fragment",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access is off on this server or its store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/partner-apps/{client_id}": {
      "delete": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "Disable a partner app",
        "description": "Disables one of the user's own apps: every token issued to it stops working at once, for every user who connected it. Cannot be undone.",
        "operationId": "disable_partner_app",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "The app's client id (`cp_...`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_DisabledPartnerApp"
                },
                "examples": {
                  "success": {
                    "summary": "Disabled; its tokens stop working",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_FALC8i71s3F8cUwwozJ3",
                        "disabled": true
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`unknown_app`: no active app with this client id owned by the user (unknown, someone else's, or already disabled).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_app": {
                    "summary": "Already disabled (or not the user's app)",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unknown_app",
                        "message": "No such active app of yours",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access is off on this server or its store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      },
      "patch": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "Set a partner app's webhook",
        "description": "Sets, changes, turns off or removes the webhook of one of the user's own active apps. For every user connected to the app it gets `order_update` and `trade` for orders the app placed, `account_alert` for the user's accounts (also with kind `account_removed` when an account is no longer linked) and `connection_revoked` when a connection ends. Each body also carries `username` (top level): the bodies are `PartnerWebhookOrderUpdate`, `PartnerWebhookTrade`, `PartnerWebhookAccountAlert` (kinds `PartnerWebhookAlertKind`) and `WebhookConnectionRevoked`, together `PartnerWebhookBody`. Signing, retries and turning off after repeated failures are as for a user's webhooks (see `webhooks`). Deliveries to partner apps start only once the server turns on partner webhooks; until then this route answers 503. The first `webhook_url` creates the webhook and returns `webhook_secret` once; `webhook_url: null` removes it. Own session only.",
        "operationId": "update_partner_app",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "The app's client id (`cp_...`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerAppPatch"
              },
              "examples": {
                "created": {
                  "summary": "First webhook URL: the secret is shown once",
                  "value": {
                    "webhook_url": "https://partner.example/hook",
                    "webhook_events": [
                      "order_update",
                      "trade",
                      "account_alert",
                      "connection_revoked"
                    ]
                  }
                },
                "turned_off": {
                  "summary": "Deliveries turned off",
                  "value": {
                    "webhook_enabled": false
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Changed; `webhook_secret` only when the webhook was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_UpdatedPartnerApp"
                },
                "examples": {
                  "created": {
                    "summary": "First webhook URL: the secret is shown once",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_nTYrRysBvVEizO0aMNCX",
                        "owner": "user-01M4Z65SRSKA2K7SGT33094P5V",
                        "name": "Charts Co",
                        "verified": false,
                        "logo_url": "https://partner.example/logo.png",
                        "redirect_uris": [
                          "https://partner.example/callback"
                        ],
                        "scopes": [
                          "read",
                          "orders"
                        ],
                        "created_at": "2026-10-15T07:07:11.535867+00:00",
                        "disabled": false,
                        "webhook": {
                          "url": "https://partner.example/hook",
                          "events": [
                            "order_update",
                            "trade",
                            "account_alert",
                            "connection_revoked"
                          ],
                          "enabled": true,
                          "disabled_reason": null,
                          "consecutive_failures": 0,
                          "last_success_at": null,
                          "last_failure_at": null,
                          "previous_secret_expires_at": null,
                          "secret_rotated_at": null
                        },
                        "webhook_secret": "whsec_…",
                        "note": "Store the webhook secret now: it is not shown again."
                      },
                      "error": null
                    }
                  },
                  "turned_off": {
                    "summary": "Deliveries turned off",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_nTYrRysBvVEizO0aMNCX",
                        "owner": "user-01M4Z65SRSKA2K7SGT33094P5V",
                        "name": "Charts Co",
                        "verified": false,
                        "logo_url": "https://partner.example/logo.png",
                        "redirect_uris": [
                          "https://partner.example/callback"
                        ],
                        "scopes": [
                          "read",
                          "orders"
                        ],
                        "created_at": "2026-10-15T07:07:11.535867+00:00",
                        "disabled": false,
                        "webhook": {
                          "url": "https://partner.example/hook",
                          "events": [
                            "order_update",
                            "trade",
                            "account_alert",
                            "connection_revoked"
                          ],
                          "enabled": false,
                          "disabled_reason": "disabled_by_user",
                          "consecutive_failures": 0,
                          "last_success_at": null,
                          "last_failure_at": null,
                          "previous_secret_expires_at": null,
                          "secret_rotated_at": null
                        }
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`: not JSON or an unknown field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the user's own session; `forbidden`: not an app session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`unknown_app`: no such active app of yours.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_app": {
                    "summary": "Not an active app of the user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unknown_app",
                        "message": "No such active app of yours",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`conflict`: the webhook was changed at the same time; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: `webhook_url` is not https on a public host, `webhook_events` is empty or names an unknown event, or a setting came for an app without a webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_request": {
                    "summary": "A plain HTTP receiver is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "url uses a scheme that is not allowed (an https:// URL on a public host is required)",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access or webhooks are off on this server, or its store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/partner-apps/{client_id}/rotate-secret": {
      "post": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "Rotate a partner app's client secret",
        "description": "Issues a new client secret (shown once). The previous secret keeps working until `previous_secret_expires_at` (24 hours), so the partner can roll the new one out without downtime; rotating again replaces it. Own session only.",
        "operationId": "rotate_partner_app_secret",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "The app's client id (`cp_...`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rotated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_RotatedPartnerSecret"
                },
                "examples": {
                  "success": {
                    "summary": "New secret; the old one works for 24 hours",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_thoAw2SKE8Q8mv2sno0m",
                        "client_secret": "cps_eu0PNR6P8S3lBc6aiWLr7fHtwZjdBiNSF9jmPF6zd9G1zosO",
                        "previous_secret_expires_at": "2026-09-30T12:02:21Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the user's own session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`unknown_app`: no such active app of yours.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_app": {
                    "summary": "Not an active app of the user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unknown_app",
                        "message": "No such active app of yours",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access is off or temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/partner-apps/{client_id}/rotate-webhook-secret": {
      "post": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "Rotate a partner app's webhook secret",
        "description": "Issues a new webhook signing secret (shown once). Deliveries are signed with both the new and the previous secret until `previous_secret_expires_at` (24 hours), so the receiver can switch without downtime. Own session only. Answers 503 until the server turns on partner webhooks.",
        "operationId": "rotate_partner_webhook_secret",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "The app's client id (`cp_...`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rotated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_RotatedPartnerWebhookSecret"
                },
                "examples": {
                  "success": {
                    "summary": "New secret; the old one signs for 24 hours",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_nTYrRysBvVEizO0aMNCX",
                        "webhook_secret": "whsec_…",
                        "previous_secret_expires_at": "2026-10-16T07:07:11.542Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: not the user's own session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`unknown_app`: no such active app of yours.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_app": {
                    "summary": "Not an active app of the user",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unknown_app",
                        "message": "No such active app of yours",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`conflict`: the webhook was changed at the same time; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request`: the app has no webhook yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "no_webhook": {
                    "summary": "The app has no webhook yet",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "this app has no webhook: set `webhook_url` first",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access or webhooks are off on this server, or its store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/oauth/token": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Exchange a code or refresh token for tokens",
        "description": "The partner's server-to-server token endpoint (RFC 6749). No API credential: the client authenticates with `client_id` + `client_secret` in the body or with HTTP Basic; a client registered with `POST /v1/oauth/register` is public and sends only `client_id` (its code is bound by PKCE).\n\n- `grant_type=authorization_code`: exchanges the code from the redirect (single use, valid 60 seconds) with the same `redirect_uri` and the PKCE `code_verifier`.\n- `grant_type=refresh_token`: rotates the refresh token. Each refresh token works once; presenting a used one again revokes the whole connection (a theft signal), except within 30 seconds of its rotation, which returns the same new pair (so concurrent refreshes are safe).\n\nAccess tokens last one day (`expires_in: 86400`), refresh tokens 90 days. Responses (success and error) are not the usual envelope: success is the RFC 6749 token response, errors are `{\"error\", \"error_description\"}`. Every response carries `Cache-Control: no-store`. After too many failed client or grant checks from one source (counted with failed API-key attempts), requests get 429 `slow_down` with `Retry-After` until the window is over.",
        "operationId": "issue_oauth_token",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "Optional HTTP Basic client authentication: `Basic base64(client_id:client_secret)`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "description": "Form-encoded (`application/x-www-form-urlencoded`, per RFC 6749) or JSON (when `Content-Type` is `application/json`).",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OAuthTokenRequest"
              },
              "examples": {
                "authorization_code": {
                  "summary": "Exchange a code (PKCE)",
                  "value": {
                    "grant_type": "authorization_code",
                    "code": "oc_3zb5bRr1InWe3ipR7EXinezj5kpxNWDpk9piRJNB",
                    "redirect_uri": "https://partner.example/callback",
                    "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
                    "client_id": "cp_3Oq3YXcuepv3Qx5Z2iC2",
                    "client_secret": "cps_dG69y0yLbVBxwXqsWbWbrQk1aP0sEuT7mYw2HcN4vZ8LxJfR"
                  }
                },
                "refresh_token": {
                  "summary": "Refresh token rotated: new access and refresh tokens",
                  "value": {
                    "grant_type": "refresh_token",
                    "refresh_token": "pr_X0I0VMDKFSkae48wpL4Yd6PSF7mLh12LbmwW3vHeZpcmgMf83zEOgHlj",
                    "client_id": "cp_BTyZelUBINLhZzpdghL8",
                    "client_secret": "cps_8XAJOlYzFZGreE8Hc6YTFpLjbfhtKUeIH3H3J7jMyacSdKGP"
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/OAuthTokenRequest"
              },
              "examples": {
                "authorization_code": {
                  "summary": "Exchange a code (PKCE)",
                  "value": {
                    "grant_type": "authorization_code",
                    "code": "oc_3zb5bRr1InWe3ipR7EXinezj5kpxNWDpk9piRJNB",
                    "redirect_uri": "https://partner.example/callback",
                    "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
                    "client_id": "cp_3Oq3YXcuepv3Qx5Z2iC2",
                    "client_secret": "cps_dG69y0yLbVBxwXqsWbWbrQk1aP0sEuT7mYw2HcN4vZ8LxJfR"
                  }
                },
                "refresh_token": {
                  "summary": "Rotate a refresh token",
                  "value": {
                    "grant_type": "refresh_token",
                    "refresh_token": "pr_osYL5rbnTCReFsHjMztYb2B4hTERl1EKUfZTM1sNvUT0pwXPpsaTWNyu",
                    "client_id": "cp_3Oq3YXcuepv3Qx5Z2iC2",
                    "client_secret": "cps_dG69y0yLbVBxwXqsWbWbrQk1aP0sEuT7mYw2HcN4vZ8LxJfR"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Tokens issued.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`no-store`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthTokenResponse"
                },
                "examples": {
                  "authorization_code": {
                    "summary": "Code exchanged for an access and a refresh token",
                    "value": {
                      "access_token": "pa_skuF0MRH41ytp5qLfnrdbtWjm4mXpHG8VsfirtfNG9T25WFF",
                      "token_type": "Bearer",
                      "expires_in": 86400,
                      "refresh_token": "pr_X0I0VMDKFSkae48wpL4Yd6PSF7mLh12LbmwW3vHeZpcmgMf83zEOgHlj",
                      "scope": "read orders"
                    }
                  },
                  "refresh_token": {
                    "summary": "Refresh token rotated: new access and refresh tokens",
                    "value": {
                      "access_token": "pa_K4OtjRq36Cl0on8mGbl04TAR3jkkotH0u0GbVq9wUvPNfnbY",
                      "token_type": "Bearer",
                      "expires_in": 86400,
                      "refresh_token": "pr_u7YF0HEew41R9LKS8u1GVVmksir6giVn5Cfk6mUF3Sz0U4cyhCVXGkdh",
                      "scope": "read orders"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request`: unreadable body or a missing field (`code`, `redirect_uri`, `code_verifier`, `refresh_token`). `unsupported_grant_type`: `grant_type` missing or not `authorization_code` / `refresh_token`. `invalid_grant`: the code is invalid, expired or already used, was issued to another client or `redirect_uri`, or `code_verifier` does not match; the refresh token is invalid, already used, expired, or the user revoked the connection; `resource` is not the one the user authorized.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`no-store`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponse"
                },
                "examples": {
                  "invalid_grant": {
                    "summary": "An authorization code used twice is refused",
                    "value": {
                      "error": "invalid_grant",
                      "error_description": "code is invalid, expired or already used"
                    }
                  },
                  "unsupported_grant_type": {
                    "summary": "Only authorization_code and refresh_token are supported",
                    "value": {
                      "error": "unsupported_grant_type",
                      "error_description": "unsupported grant_type `password`; use authorization_code or refresh_token"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`invalid_client`: no client credentials, an unknown, disabled or deleted app, a wrong secret, or a secret sent by a public client.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`no-store`."
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "`Basic` challenge, when the client authenticated with HTTP Basic."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponse"
                },
                "examples": {
                  "invalid_client": {
                    "summary": "Wrong client secret",
                    "value": {
                      "error": "invalid_client",
                      "error_description": "client authentication failed"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "`slow_down`: too many failed attempts from this source; retry after `Retry-After` seconds.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`no-store`."
              },
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "`temporarily_unavailable`: partner access is off on this server or its store is temporarily unavailable; retry.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`no-store`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponse"
                },
                "examples": {
                  "temporarily_unavailable": {
                    "summary": "Partner access is off on this server",
                    "value": {
                      "error": "temporarily_unavailable",
                      "error_description": "storage unavailable: partner access is not enabled"
                    }
                  }
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/connections": {
      "get": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "List connected partner apps",
        "description": "The partner apps the user has granted access to, plus those revoked in the last 30 days (they carry `revoked_at`; live ones do not).",
        "operationId": "list_partner_connections",
        "responses": {
          "200": {
            "description": "The user's connections.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_PartnerConnection"
                },
                "examples": {
                  "success": {
                    "summary": "One connected app",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "client_id": "cp_ZY0ZTp7e7G4JH2oGkHgr",
                          "app_name": "Charts Co",
                          "verified": false,
                          "dynamic": false,
                          "scopes": [
                            "read",
                            "orders"
                          ],
                          "connected_at": "2026-10-30T14:25:07.285908+00:00",
                          "updated_at": "2026-10-30T14:25:07.285908+00:00",
                          "last_used_at": null,
                          "calls_today": 0
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access is off on this server or its store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unavailable": {
                    "summary": "Partner access is off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Partner access is not enabled on this server",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/connections/{client_id}": {
      "delete": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "Disconnect a partner app",
        "description": "Revokes the user's connection to the app: every access token dies at once and every refresh token is deleted. The partner must ask the user to connect again.",
        "operationId": "revoke_partner_connection",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "The app's client id (`cp_...`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Disconnected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_RevokedPartnerConnection"
                },
                "examples": {
                  "success": {
                    "summary": "Disconnected; every token of the app for this user dies",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_Ay2T4dfVLByf9ct7XzAH",
                        "revoked": true
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "`connection_not_found`: no live connection to that app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "connection_not_found": {
                    "summary": "No live connection to that app",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "connection_not_found",
                        "message": "No live connection to that app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access is off on this server or its store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/connections/{client_id}/left": {
      "get": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "What a connected app left running",
        "description": "What the app `client_id` created for the signed-in user that is still running: its open orders, active GTTs, open v2 triggers and strategy deployments that are not stopped. Works after the connection was revoked: disconnecting an app never cancels what it started. The app session of the owning user only. A `client_id` the user never connected gives empty lists.",
        "operationId": "get_connection_left_by",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "The partner app's client id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "What the app left running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_LeftBy"
                },
                "examples": {
                  "success": {
                    "summary": "An open order the app left behind, after it was disconnected",
                    "value": {
                      "status": "success",
                      "data": {
                        "orders": [
                          {
                            "cirrus_tag": "01M66MX90TMJPA92R4EKMZ55NR",
                            "broker_tag": null,
                            "order_id": "250101000123",
                            "parent_tag": null,
                            "username": "user-01M66MX7P51T9S9V6RA68F15JR",
                            "account": "P1",
                            "broker": "paper",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "tradingsymbol": "RELIANCE-EQ",
                            "side": "BUY",
                            "order_type": "LIMIT",
                            "product": "MIS",
                            "quantity": 5,
                            "price": 2400,
                            "trigger_price": null,
                            "state": "OPEN",
                            "filled_qty": 0,
                            "average_price": null,
                            "status_message": null,
                            "broker_updated_at": null,
                            "created_at": "2026-10-30T14:55:03.706582Z",
                            "status_history": [],
                            "partner_client_id": "cp_9oN8crnsKGBC0epxXm9q",
                            "lot_size": 1,
                            "exchange": "NSE",
                            "instrument_type": "EQUITY",
                            "symbol": "RELIANCE",
                            "expiry": "",
                            "strike": 0,
                            "option_type": "",
                            "ltp": 2500,
                            "prev_close": 2490,
                            "instrument_token": "CT:TEST:RELIANCE",
                            "order_tag": "01M66MX90TMJPA92R4EKMZ55NR"
                          }
                        ],
                        "gtt": [],
                        "triggers": [],
                        "deployments": []
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: only the account holder, signed in themselves.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: a store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/connections/{client_id}/limits": {
      "get": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "A connection's limits",
        "description": "The limits of the user's live connection to a partner app: what the app may trade and deploy on top of its scopes. They bind `mcp` tokens (AI agents) only; classic partner tokens are not limited by them. When the user never set limits, the defaults are returned with `is_default: true`.",
        "operationId": "get_connection_limits",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "The app's client id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The connection's limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_ConnectionLimitsView"
                },
                "examples": {
                  "defaults": {
                    "summary": "No limits were set: the defaults, `is_default: true`",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_uLZ1purc60GwZKfU8e0K",
                        "limits": {
                          "trading": true,
                          "accounts": [],
                          "paper_only": true,
                          "max_order_value": null,
                          "max_orders_per_day": 20,
                          "live_strategies": false,
                          "max_deployments": 1
                        },
                        "is_default": true,
                        "applies_to": [
                          "mcp"
                        ]
                      },
                      "error": null
                    }
                  },
                  "set": {
                    "summary": "Limits the user set",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_uLZ1purc60GwZKfU8e0K",
                        "limits": {
                          "trading": true,
                          "accounts": [
                            "P1"
                          ],
                          "paper_only": true,
                          "max_order_value": 10000,
                          "max_orders_per_day": 5,
                          "live_strategies": false,
                          "max_deployments": 1
                        },
                        "is_default": false,
                        "applies_to": [
                          "mcp"
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: only the account holder, signed in themselves; `forbidden`: not an app session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`connection_not_found`: no live connection to that app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "connection_not_found": {
                    "summary": "No live connection to that app",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "connection_not_found",
                        "message": "No live connection to that app",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access is off on this server or its store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      },
      "put": {
        "tags": [
          "partners",
          "app_session_only"
        ],
        "summary": "Change a connection's limits",
        "description": "Replaces the limits of the user's live connection to a partner app. Takes effect at once, on every server. Every listed account must be the user's; `live_strategies` needs `trading`, `paper_only` off and the `strategies_live` scope on the connection. `max_order_value` is in whole rupees. Recorded in activity with the before and after.",
        "operationId": "set_connection_limits",
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "description": "The app's client id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectionLimits"
              },
              "examples": {
                "success": {
                  "summary": "Paper trading on one account, capped",
                  "value": {
                    "trading": true,
                    "accounts": [
                      "P1"
                    ],
                    "paper_only": true,
                    "max_order_value": 10000,
                    "max_orders_per_day": 5,
                    "max_deployments": 1
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The limits now in force.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_ConnectionLimitsView"
                },
                "examples": {
                  "success": {
                    "summary": "Paper trading on one account, capped",
                    "value": {
                      "status": "success",
                      "data": {
                        "client_id": "cp_uLZ1purc60GwZKfU8e0K",
                        "limits": {
                          "trading": true,
                          "accounts": [
                            "P1"
                          ],
                          "paper_only": true,
                          "max_order_value": 10000,
                          "max_orders_per_day": 5,
                          "live_strategies": false,
                          "max_deployments": 1
                        },
                        "is_default": false,
                        "applies_to": [
                          "mcp"
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`: not JSON or an unknown field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`own_session_required`: only the account holder, signed in themselves; `forbidden`: not an app session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "`connection_not_found`: no live connection to that app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` with `field` (`accounts`, `live_strategies` or `max_order_value`): the limits are not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_your_account": {
                    "summary": "A listed account is not the user's",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "account NOT-MINE is not one of yours",
                        "field": "accounts"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: partner access is off on this server or its store is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_session": []
          }
        ],
        "x-app-only": true
      }
    },
    "/v1/oauth/register": {
      "post": {
        "tags": [
          "partners"
        ],
        "summary": "Register an OAuth client (AI agents)",
        "description": "Dynamic client registration (RFC 7591) for AI agents connecting through the MCP server. No credential needed. The client is public: no secret is issued; it authenticates at `POST /v1/oauth/token` with `client_id` and the PKCE `code_verifier` (`token_endpoint_auth_method: none`). It is never verified, never listed among anyone's partner apps, and may be granted at most `read`, `orders`, `triggers`, `strategies` and `strategies_live`. The answer says what was registered, whatever `grant_types`, `response_types` or `token_endpoint_auth_method` asked for; other client metadata is ignored. Redirect URIs are stored and returned as parsed (scheme and host lower-cased). `client_name` is printable ASCII; one naming a known AI vendor is refused unless every redirect URI other than loopback http or a known desktop app scheme is that vendor's own. Its access tokens work only through the MCP server.\n\nA client that no user ever connected through is deleted after 24 hours, one no user is still connected through after 30 days; the token endpoint then answers `invalid_client` and the agent registers again. At most 10 registrations an hour per client IP (an IPv6 caller: per /64), and a cap on all registrations together per hour. Only served where agent access is enabled; elsewhere 404 with no body. Responses are not the usual envelope.",
        "operationId": "register_oauth_client",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OAuthClientRegistration"
              },
              "examples": {
                "success": {
                  "summary": "A public client registered (no secret)",
                  "value": {
                    "client_name": "Claude",
                    "redirect_uris": [
                      "https://claude.ai/api/mcp/auth_callback"
                    ],
                    "grant_types": [
                      "authorization_code",
                      "refresh_token"
                    ],
                    "response_types": [
                      "code"
                    ],
                    "token_endpoint_auth_method": "none"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Registered.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`no-store`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthRegisteredClient"
                },
                "examples": {
                  "success": {
                    "summary": "A public client registered (no secret)",
                    "value": {
                      "client_id": "cp_RV0iQ1LU929D23gJ8DkW",
                      "client_name": "Claude",
                      "redirect_uris": [
                        "https://claude.ai/api/mcp/auth_callback"
                      ],
                      "token_endpoint_auth_method": "none",
                      "grant_types": [
                        "authorization_code",
                        "refresh_token"
                      ],
                      "response_types": [
                        "code"
                      ],
                      "client_id_issued_at": 1793364132
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request`: unreadable body, `client_name` over 64 characters or naming an AI vendor whose redirect URIs these are not, no or more than 5 `redirect_uris`, or a redirect URI that is not https, loopback http or a known desktop app scheme. `invalid_client_metadata`: `client_name` is not printable ASCII.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`no-store`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponse"
                },
                "examples": {
                  "invalid_redirect_uri": {
                    "summary": "A plain-HTTP redirect URI (not loopback) is refused",
                    "value": {
                      "error": "invalid_request",
                      "error_description": "redirect URI `http://agent.example/cb` must be https, http on localhost / 127.0.0.1 / [::1], or a known desktop app scheme, without a fragment"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Agent access is not enabled on this server (no body)."
          },
          "429": {
            "description": "`slow_down`: too many registrations from this client IP (IPv6: its /64), or from all callers together this hour; retry after `Retry-After` seconds.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`no-store`."
              },
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds to wait."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponse"
                },
                "examples": {
                  "rate_limited": {
                    "summary": "Too many registrations from one client IP",
                    "value": {
                      "error": "slow_down",
                      "error_description": "too many registrations from this source; retry after the Retry-After delay"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "`temporarily_unavailable`: the store is temporarily unavailable; retry.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`no-store`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponse"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/.well-known/oauth-authorization-server": {
      "get": {
        "tags": [
          "partners"
        ],
        "summary": "OAuth authorization server metadata",
        "description": "RFC 8414 metadata for OAuth clients that discover the server themselves (AI agents connecting through the MCP server): where users consent, the token and registration endpoints, PKCE `S256` only, and the scopes an agent may be granted. No credential needed. Only served where agent access is enabled; elsewhere 404 with no body.",
        "operationId": "get_oauth_server_metadata",
        "responses": {
          "200": {
            "description": "The metadata.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`public, max-age=300`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthServerMetadata"
                },
                "examples": {
                  "success": {
                    "summary": "Where agents register, send users and get tokens",
                    "value": {
                      "issuer": "https://api.test.example",
                      "authorization_endpoint": "https://app.test.example/oauth/consent",
                      "token_endpoint": "https://api.test.example/v1/oauth/token",
                      "registration_endpoint": "https://api.test.example/v1/oauth/register",
                      "response_types_supported": [
                        "code"
                      ],
                      "grant_types_supported": [
                        "authorization_code",
                        "refresh_token"
                      ],
                      "code_challenge_methods_supported": [
                        "S256"
                      ],
                      "token_endpoint_auth_methods_supported": [
                        "none",
                        "client_secret_basic",
                        "client_secret_post"
                      ],
                      "scopes_supported": [
                        "read",
                        "orders",
                        "triggers",
                        "strategies",
                        "strategies_live",
                        "offline_access"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Agent access is not enabled on this server (no body)."
          }
        },
        "security": []
      }
    },
    "/v1/baskets": {
      "get": {
        "tags": [
          "baskets"
        ],
        "summary": "List your baskets",
        "description": "The caller's saved baskets, most recently updated first.",
        "operationId": "list_baskets",
        "responses": {
          "200": {
            "description": "Saved baskets.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_BasketSummary"
                },
                "examples": {
                  "success": {
                    "summary": "Saved baskets, most recently updated first",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "id": "bk_01m4xdf6cg5vt9yk1nmy8nemn9",
                          "name": "Bear call",
                          "leg_count": 2,
                          "updated_at": "2026-10-14T14:36:10.512Z"
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the route's scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: baskets are temporarily unavailable, or off on this server.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "baskets"
        ],
        "summary": "Save a basket",
        "description": "Saves a named basket of 1-20 legs. At most 50 baskets per user.",
        "operationId": "create_basket",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BasketInput"
              },
              "examples": {
                "success": {
                  "summary": "A two-leg bear call spread saved",
                  "value": {
                    "name": "Bear call",
                    "legs": [
                      {
                        "underlying": "NIFTY",
                        "instrument": "option",
                        "expiry": "2026-10-17",
                        "option_type": "CE",
                        "strike": 22500,
                        "side": "BUY",
                        "lots": 4,
                        "order_type": "MARKET"
                      },
                      {
                        "underlying": "NIFTY",
                        "instrument": "option",
                        "expiry": "2026-10-17",
                        "option_type": "CE",
                        "strike": 22400,
                        "side": "SELL",
                        "lots": 4,
                        "order_type": "LIMIT",
                        "price": 112.5
                      }
                    ],
                    "prefs": {
                      "mode": "auto",
                      "timeout_ms": 5000,
                      "partial": "filled_qty"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Saved.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_BasketId"
                },
                "examples": {
                  "success": {
                    "summary": "A two-leg bear call spread saved",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "bk_01m4xdf6chg4r9pswvwqp3y9cq"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json` or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_field": {
                    "summary": "An unknown field is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `owner`, expected one of `name`, `legs`, `prefs`, `strategy`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the route's scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `orders` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` names the input, e.g. `legs[0].lots`; `name` when the 50-basket limit is reached) or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_lots": {
                    "summary": "A leg needs at least one lot",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "lots must be 1-10000",
                        "field": "legs[0].lots"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v1/baskets/{basket_id}": {
      "get": {
        "tags": [
          "baskets"
        ],
        "summary": "Read a basket",
        "operationId": "get_basket",
        "parameters": [
          {
            "name": "basket_id",
            "in": "path",
            "description": "Basket id (`bk_...`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The basket.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Basket"
                },
                "examples": {
                  "success": {
                    "summary": "A saved basket with its legs",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "bk_01m4xdf6cg5vt9yk1nmy8nemn9",
                        "name": "Bear call",
                        "legs": [
                          {
                            "underlying": "NIFTY",
                            "instrument": "option",
                            "expiry": "2026-10-17",
                            "option_type": "CE",
                            "strike": 22500,
                            "side": "BUY",
                            "lots": 4,
                            "order_type": "MARKET",
                            "price": null,
                            "cirrus_token": null,
                            "instrument_token": null
                          },
                          {
                            "underlying": "NIFTY",
                            "instrument": "option",
                            "expiry": "2026-10-17",
                            "option_type": "CE",
                            "strike": 22400,
                            "side": "SELL",
                            "lots": 4,
                            "order_type": "LIMIT",
                            "price": 112.5,
                            "cirrus_token": null,
                            "instrument_token": null
                          }
                        ],
                        "prefs": {
                          "mode": "auto",
                          "timeout_ms": 5000,
                          "partial": "filled_qty"
                        },
                        "updated_at": "2026-10-14T14:36:10.512Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the route's scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`basket_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "basket_not_found": {
                    "summary": "No basket with this id",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "basket_not_found",
                        "message": "no such basket",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: baskets are temporarily unavailable, or the stored basket cannot be read.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "put": {
        "tags": [
          "baskets"
        ],
        "summary": "Replace a basket",
        "description": "Replaces the name, legs and preferences of a saved basket.",
        "operationId": "replace_basket",
        "parameters": [
          {
            "name": "basket_id",
            "in": "path",
            "description": "Basket id (`bk_...`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BasketInput"
              },
              "examples": {
                "success": {
                  "summary": "Renamed, legs unchanged",
                  "value": {
                    "name": "Bear call (weekly)",
                    "legs": [
                      {
                        "underlying": "NIFTY",
                        "instrument": "option",
                        "expiry": "2026-10-17",
                        "option_type": "CE",
                        "strike": 22500,
                        "side": "BUY",
                        "lots": 4,
                        "order_type": "MARKET"
                      },
                      {
                        "underlying": "NIFTY",
                        "instrument": "option",
                        "expiry": "2026-10-17",
                        "option_type": "CE",
                        "strike": 22400,
                        "side": "SELL",
                        "lots": 4,
                        "order_type": "LIMIT",
                        "price": 112.5
                      }
                    ],
                    "prefs": {
                      "mode": "auto",
                      "timeout_ms": 5000,
                      "partial": "filled_qty"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Replaced.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_BasketId"
                },
                "examples": {
                  "success": {
                    "summary": "Renamed, legs unchanged",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "bk_01m4xdf6cg7098z58t00emzhr3"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json` or `invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_field": {
                    "summary": "An unknown field is refused",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "malformed_json",
                        "message": "invalid request body: unknown field `owner`, expected one of `name`, `legs`, `prefs`, `strategy`",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the route's scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `orders` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`basket_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "basket_not_found": {
                    "summary": "No basket with this id",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "basket_not_found",
                        "message": "no such basket",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` names the input) or `idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_price": {
                    "summary": "A limit leg needs a positive price",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "price must be finite and not negative",
                        "field": "legs[1].price"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      },
      "delete": {
        "tags": [
          "baskets"
        ],
        "summary": "Delete a basket",
        "operationId": "delete_basket",
        "parameters": [
          {
            "name": "basket_id",
            "in": "path",
            "description": "Basket id (`bk_...`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional: a new UUID per request (1-128 printable characters). A repeat with the same key gets the first answer back instead of acting again.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted.",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string"
                },
                "description": "`true` when this is the stored answer to an earlier request with the same key."
              }
            }
          },
          "400": {
            "description": "`invalid_idempotency_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_idempotency_key": {
                    "summary": "The Idempotency-Key is not 1-128 printable characters",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_idempotency_key",
                        "message": "Idempotency-Key must be 1-128 printable characters",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the route's scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `orders` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`basket_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "basket_not_found": {
                    "summary": "Already deleted, or never saved",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "basket_not_found",
                        "message": "no such basket",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`request_in_progress`: an earlier request with this key is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "request_in_progress": {
                    "summary": "An earlier request with this Idempotency-Key is still running",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "request_in_progress",
                        "message": "A request with this Idempotency-Key is still being processed",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`idempotency_key_reused`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "The Idempotency-Key was already used for another request",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used with a different request",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "orders"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "orders"
      }
    },
    "/v1/watchlists": {
      "get": {
        "tags": [
          "watchlists"
        ],
        "summary": "List your watchlists",
        "description": "The caller's watchlists, by name: the same lists as the app's market watch.",
        "operationId": "list_watchlists",
        "responses": {
          "200": {
            "description": "Watchlists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_WatchlistSummary"
                },
                "examples": {
                  "success": {
                    "summary": "The user's watchlists, by name",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "id": "6adf47df14d372ca8aa51ea7",
                          "name": "Breakouts",
                          "count": 2,
                          "updated_at": "2026-10-26T12:30:23.476Z"
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the `read` scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: watchlists are temporarily unavailable, or off on this server.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "post": {
        "tags": [
          "watchlists"
        ],
        "summary": "Create a watchlist",
        "description": "Creates a named watchlist of up to 50 NSE / BSE cash equities (instrument tokens). At most 50 watchlists per user.",
        "operationId": "create_watchlist",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WatchlistInput"
              },
              "examples": {
                "success": {
                  "summary": "Two NSE stocks",
                  "value": {
                    "name": "Breakouts",
                    "symbols": [
                      "CT:EX:RELIANCE-EQ",
                      "CT:EX:INFY-EQ"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_WatchlistId"
                },
                "examples": {
                  "success": {
                    "summary": "Two NSE stocks",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "6adf47df14d372ca8aa51ea4"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session or API key (an operator acting as the user, or a partner app); or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the `watchlists` scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `watchlists` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`watchlist_name_taken`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "watchlist_name_taken": {
                    "summary": "The user already has a watchlist with this name",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "watchlist_name_taken",
                        "message": "you already have a watchlist with this name",
                        "field": "name"
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` names the input, e.g. `symbols[2]` for a symbol that is not a listed cash equity; `name` at the 50-watchlist limit).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_equity": {
                    "summary": "An index is not a cash equity",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "NIFTY 50 is not an NSE or BSE cash equity",
                        "field": "symbols[1]"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`, or `instruments_unavailable` while the instrument list has not loaded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "watchlists"
      }
    },
    "/v1/watchlists/{watchlist_id}": {
      "get": {
        "tags": [
          "watchlists"
        ],
        "summary": "Read a watchlist",
        "description": "A watchlist with each member's status today: `tradable` (a stock strategy on this list trades it), `not_allowed` (a cash equity automated strategies may not trade on this server), `not_equity` (an index or contract added from the market watch) or `not_listed` (not in today's instrument list).",
        "operationId": "get_watchlist",
        "parameters": [
          {
            "name": "watchlist_id",
            "in": "path",
            "description": "Watchlist id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The watchlist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Watchlist"
                },
                "examples": {
                  "success": {
                    "summary": "Each member with its status today",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "6adf47df14d372ca8aa51ea7",
                        "name": "Breakouts",
                        "symbols": [
                          {
                            "cirrus_token": "CT:EX:RELIANCE-EQ",
                            "tradingsymbol": "RELIANCE-EQ",
                            "stock": "RELIANCE",
                            "exchange": "NSE",
                            "name": "Reliance Industries",
                            "status": "not_allowed",
                            "instrument_token": "CT:EX:RELIANCE-EQ"
                          },
                          {
                            "cirrus_token": "CT:EX:INFY-EQ",
                            "tradingsymbol": "INFY-EQ",
                            "stock": "INFY",
                            "exchange": "NSE",
                            "name": "Infosys",
                            "status": "not_allowed",
                            "instrument_token": "CT:EX:INFY-EQ"
                          }
                        ],
                        "tradable": 0,
                        "updated_at": "2026-10-26T12:30:23.476Z"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the `read` scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `read` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`watchlist_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "watchlist_not_found": {
                    "summary": "No watchlist with this id",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "watchlist_not_found",
                        "message": "no such watchlist",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`, or `instruments_unavailable` while the instrument list has not loaded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "partner_oauth": [
              "read"
            ]
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      },
      "put": {
        "tags": [
          "watchlists"
        ],
        "summary": "Rename a watchlist or replace its members",
        "description": "Sets the name and, when `symbols` is given, the members (kept members stay in place, new ones are added at the end). Running stock strategies on this list pick the change up at their next entry: a stock taken out waits (`watchlist_removed`), its open trade keeps every exit. A list a running live strategy trades needs `strategies_live` on an API key or partner token too (403 `live_not_enabled`).",
        "operationId": "update_watchlist",
        "parameters": [
          {
            "name": "watchlist_id",
            "in": "path",
            "description": "Watchlist id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WatchlistInput"
              },
              "examples": {
                "success": {
                  "summary": "Renamed, INFY added",
                  "value": {
                    "name": "Breakouts (large caps)",
                    "symbols": [
                      "CT:EX:RELIANCE-EQ",
                      "CT:EX:INFY-EQ"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_WatchlistId"
                },
                "examples": {
                  "success": {
                    "summary": "Renamed, INFY added",
                    "value": {
                      "status": "success",
                      "data": {
                        "id": "6adf47df14d372ca8aa51ea6"
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`malformed_json`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session or API key (an operator acting as the user, or a partner app); `live_not_enabled`: a list a running live strategy trades, from an API key without `strategies_live`; or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the `watchlists` scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `watchlists` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`watchlist_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "watchlist_not_found": {
                    "summary": "No watchlist with this id",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "watchlist_not_found",
                        "message": "no such watchlist",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "`watchlist_name_taken`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field` names the input).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_listed": {
                    "summary": "A symbol not in today's instrument list",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "CT:EX:GONE-EQ is not in today's instrument list",
                        "field": "symbols[0]"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`, or `instruments_unavailable` while the instrument list has not loaded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "watchlists"
      },
      "delete": {
        "tags": [
          "watchlists"
        ],
        "summary": "Delete a watchlist",
        "description": "Deletes the watchlist, its members and notes. Running stock strategies on it stop starting new trades (`watchlist_deleted`); open trades keep every exit. A list a running live strategy trades needs `strategies_live` on an API key or partner token too (403 `live_not_enabled`).",
        "operationId": "delete_watchlist",
        "parameters": [
          {
            "name": "watchlist_id",
            "in": "path",
            "description": "Watchlist id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No credential",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "unauthorized",
                        "message": "Missing access token",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "`own_session_required`: not the account holder's own session or API key (an operator acting as the user, or a partner app); `live_not_enabled`: a list a running live strategy trades, from an API key without `strategies_live`; or `forbidden` (see the standard 403).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_scope": {
                    "summary": "An API key without the `watchlists` scope",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "forbidden",
                        "message": "This credential lacks the `watchlists` scope",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "`watchlist_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "watchlist_not_found": {
                    "summary": "Already deleted, or never made",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "watchlist_not_found",
                        "message": "no such watchlist",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "watchlists"
      }
    },
    "/v1/shared": {
      "get": {
        "tags": [
          "shared"
        ],
        "summary": "List portfolios shared with you",
        "description": "The active shares other users granted to the caller: who, what (`scopes`) and which accounts. Use `owner_username` with the other shared routes.",
        "operationId": "list_shared_portfolios",
        "responses": {
          "200": {
            "description": "Incoming shares.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_Vec_SharedGrant"
                },
                "examples": {
                  "success": {
                    "summary": "One owner shares everything",
                    "value": {
                      "status": "success",
                      "data": [
                        {
                          "owner_username": "owner-01M3PGPS0YZSQCHVHW944RD3CK",
                          "owner_name": "Asha Owner",
                          "scopes": [
                            "login",
                            "funds",
                            "positions",
                            "holdings",
                            "open_orders",
                            "order_history"
                          ],
                          "account_scope": "all"
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: shared data (or the owner's accounts) is temporarily unavailable, or sharing is off on this server.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unavailable": {
                    "summary": "Sharing is off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Data sharing is not available right now.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/shared/consolidated": {
      "get": {
        "tags": [
          "shared"
        ],
        "summary": "Every shared account on one screen",
        "description": "One card per owner and shared account (balances, P&L, counts, and login status when `login` is shared), plus every shared position with its owner. Each number needs its scope; a problem reading one owner only blanks that owner's numbers.",
        "operationId": "get_consolidated_shared_portfolio",
        "responses": {
          "200": {
            "description": "Owners and positions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SharedConsolidated"
                },
                "examples": {
                  "success": {
                    "summary": "One owner, two shared accounts (one without data yet)",
                    "value": {
                      "status": "success",
                      "data": {
                        "owners": [
                          {
                            "owner_username": "owner-01M3PGPS0YZSQCHVHW944RD3CK",
                            "owner_name": "Asha Owner",
                            "scopes": [
                              "login",
                              "funds",
                              "positions",
                              "holdings",
                              "open_orders",
                              "order_history"
                            ],
                            "account_scope": "all",
                            "accounts": [
                              {
                                "client_id": "O1",
                                "has_login": true,
                                "has_funds": true,
                                "has_positions": true,
                                "opening_balance": 100000,
                                "usable_balance": 80000,
                                "utilisation": 20000,
                                "pnl": 120.5,
                                "positions_count": 1,
                                "holdings_count": 1,
                                "updated_at": {
                                  "positions": "2026-10-14T09:17:41.800064Z",
                                  "margins": "2026-10-14T09:17:41.801539Z",
                                  "holdings": "2026-10-14T09:17:41.800912Z"
                                },
                                "missing": {},
                                "open_orders_count": 1,
                                "failed_orders_count": 0,
                                "orders_updated_at": "2026-10-14T09:17:41.802298Z",
                                "broker": "paper",
                                "account_tag": "main",
                                "last_login_at": "1790683341",
                                "logged_in_today": true
                              },
                              {
                                "client_id": "O2",
                                "has_login": true,
                                "has_funds": true,
                                "has_positions": true,
                                "opening_balance": null,
                                "usable_balance": null,
                                "utilisation": null,
                                "pnl": null,
                                "positions_count": 0,
                                "holdings_count": 0,
                                "updated_at": {
                                  "positions": null,
                                  "margins": null,
                                  "holdings": null
                                },
                                "missing": {
                                  "positions": {
                                    "code": "no_session",
                                    "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                                  },
                                  "margins": {
                                    "code": "no_session",
                                    "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                                  },
                                  "holdings": {
                                    "code": "no_session",
                                    "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                                  }
                                },
                                "open_orders_count": null,
                                "failed_orders_count": null,
                                "orders_updated_at": null,
                                "broker": "paper",
                                "account_tag": null,
                                "last_login_at": null,
                                "logged_in_today": false
                              }
                            ]
                          }
                        ],
                        "positions": [
                          {
                            "account": "O1",
                            "cirrus_token": "CT:TEST:RELIANCE",
                            "tradingsymbol": "RELIANCE-EQ",
                            "product": "MIS",
                            "net_qty": 5,
                            "buy_qty": 5,
                            "sell_qty": 0,
                            "buy_value": 12500,
                            "sell_value": 0,
                            "average_price": 2500,
                            "buy_average_price": 2500,
                            "sell_average_price": 0,
                            "pnl": 120.5,
                            "lot_size": 1,
                            "exchange": "NSE",
                            "instrument_type": "EQUITY",
                            "symbol": "RELIANCE",
                            "expiry": "",
                            "strike": 0,
                            "option_type": "",
                            "ltp": 2500,
                            "prev_close": 2490,
                            "owner_username": "owner-01M3PGPS0YZSQCHVHW944RD3CK",
                            "owner_name": "Asha Owner",
                            "instrument_token": "CT:TEST:RELIANCE"
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: shared data (or the owner's accounts) is temporarily unavailable, or sharing is off on this server.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unavailable": {
                    "summary": "Sharing is off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Data sharing is not available right now.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/shared/consolidated/refresh": {
      "post": {
        "tags": [
          "shared"
        ],
        "summary": "Refresh every shared portfolio",
        "description": "Asks for fresh data for every owner sharing with the caller (at most one refresh per owner every 10 seconds, by anyone; failures for one owner are skipped).",
        "operationId": "refresh_consolidated_shared_portfolio",
        "responses": {
          "202": {
            "description": "Refreshes asked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SharedConsolidatedRefresh"
                },
                "examples": {
                  "success": {
                    "summary": "Every owner refreshed",
                    "value": {
                      "status": "success",
                      "data": {
                        "owners": 1,
                        "dispatched": 1
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: shared data (or the owner's accounts) is temporarily unavailable, or sharing is off on this server.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unavailable": {
                    "summary": "Sharing is off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Data sharing is not available right now.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/shared/consolidated/{view}": {
      "get": {
        "tags": [
          "shared"
        ],
        "summary": "One view of every shared account",
        "description": "One kind of data from every account shared with the caller, across owners: the rows are exactly those of `GET /v1/shared/{owner}/{view}`, one entry per account tagged with its owner. Accounts without data are under `missing`; owners who do not share this data (`not_shared`) or whose data could not be read right now (`unavailable`) are under `skipped_owners`. A problem with one owner never fails the response.",
        "operationId": "get_consolidated_shared_view",
        "parameters": [
          {
            "name": "view",
            "in": "path",
            "description": "What to read: `positions`, `holdings`, `margins` (needs `funds`), `open_orders`, `order_history`.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The views of `GET /v1/shared/consolidated/{view}`.",
              "enum": [
                "positions",
                "holdings",
                "margins",
                "open_orders",
                "order_history"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Every shared account's data of that view.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SharedConsolidatedView"
                },
                "examples": {
                  "positions": {
                    "summary": "Every shared account's positions; the account without data is under missing",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "owner_username": "owner-01M4WV81FTX36BK617X9JFYPQ3",
                            "owner_name": "Asha Owner",
                            "account": "O1",
                            "updated_at": "2026-10-14T09:17:41.800064Z",
                            "data": [
                              {
                                "account": "O1",
                                "cirrus_token": "CT:TEST:RELIANCE",
                                "tradingsymbol": "RELIANCE-EQ",
                                "product": "MIS",
                                "net_qty": 5,
                                "buy_qty": 5,
                                "sell_qty": 0,
                                "buy_value": 12500,
                                "sell_value": 0,
                                "average_price": 2500,
                                "buy_average_price": 2500,
                                "sell_average_price": 0,
                                "pnl": 120.5,
                                "lot_size": 1,
                                "exchange": "NSE",
                                "instrument_type": "EQUITY",
                                "symbol": "RELIANCE",
                                "expiry": "",
                                "strike": 0,
                                "option_type": "",
                                "ltp": 2500,
                                "prev_close": 2490,
                                "instrument_token": "CT:TEST:RELIANCE"
                              }
                            ]
                          }
                        ],
                        "missing": [
                          {
                            "owner_username": "owner-01M4WV81FTX36BK617X9JFYPQ3",
                            "owner_name": "Asha Owner",
                            "account": "O2",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          }
                        ],
                        "skipped_owners": []
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "description": "`invalid_request` (`field`: `view`): not one of the views.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_view": {
                    "summary": "Not one of the views (`accounts` is per owner only)",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "view must be one of positions, holdings, margins, open_orders, order_history",
                        "field": "view"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: shared data is temporarily unavailable, or sharing is off on this server.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unavailable": {
                    "summary": "Sharing is off on this server",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "service_unavailable",
                        "message": "Data sharing is not available right now.",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/shared/{owner}/refresh": {
      "post": {
        "tags": [
          "shared"
        ],
        "summary": "Refresh a shared portfolio",
        "description": "Asks for fresh data from the broker for the owner's shared accounts. At most one refresh per owner every 10 seconds, by anyone: within that window nothing is asked and `requested` is `null`. The data arrives in the views moments later.",
        "operationId": "refresh_shared_portfolio",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "The owner's username (`owner_username` from `GET /v1/shared`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Refresh asked (or skipped: see `requested`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SharedRefresh"
                },
                "examples": {
                  "success": {
                    "summary": "Both shared accounts asked to refresh",
                    "value": {
                      "status": "success",
                      "data": {
                        "requested": 2
                      },
                      "error": null
                    }
                  },
                  "throttled": {
                    "summary": "Refreshed moments ago: nothing asked",
                    "value": {
                      "status": "success",
                      "data": {
                        "requested": null
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`not_shared`: that user shares nothing (or not this data) with the caller; `oms_not_enabled`: that user is not served by this deployment; `forbidden`: a partner token, or a credential without `read`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_shared": {
                    "summary": "That user shares nothing with the caller",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "not_shared",
                        "message": "Not shared with you",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: shared data (or the owner's accounts) is temporarily unavailable, or sharing is off on this server.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/shared/{owner}/{view}": {
      "get": {
        "tags": [
          "shared"
        ],
        "summary": "Read one view of a shared portfolio",
        "description": "One kind of data from the owner's shared accounts, read from the same live snapshots as the owner's own portfolio and limited to the accounts the share covers. Each view needs its scope: `accounts` -> `login`, `positions`, `holdings`, `margins` -> `funds`, `open_orders`, `order_history`. `accounts` returns `SharedAccounts`; the others return `SharedPortfolio` (accounts without data yet under `missing`). Credentials never appear.",
        "operationId": "get_shared_view",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "The owner's username (`owner_username` from `GET /v1/shared`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "path",
            "description": "What to read: `accounts` (needs `login`), `positions`, `holdings`, `margins` (needs `funds`), `open_orders`, `order_history`.",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The data a shared view returns (`GET /v1/shared/{owner}/{view}`).",
              "enum": [
                "accounts",
                "positions",
                "holdings",
                "margins",
                "open_orders",
                "order_history"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The view's data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success_SharedViewData"
                },
                "examples": {
                  "accounts": {
                    "summary": "The shared accounts",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "client_id": "O1",
                            "broker": "paper",
                            "account_tag": "main",
                            "last_login_at": "1790683341",
                            "logged_in_today": true
                          },
                          {
                            "client_id": "O2",
                            "broker": "paper",
                            "account_tag": null,
                            "last_login_at": null,
                            "logged_in_today": false
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "holdings": {
                    "summary": "Holdings",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "O1",
                            "updated_at": "2026-09-29T12:02:21.916874Z",
                            "data": [
                              {
                                "account": "O1",
                                "cirrus_token": "CT:TEST:RELIANCE",
                                "tradingsymbol": "RELIANCE-EQ",
                                "product": "DELIVERY",
                                "quantity": 2,
                                "average_price": 2400,
                                "invested_amount": 4800,
                                "pnl": 200,
                                "pnl_percent": 4.17,
                                "lot_size": 1,
                                "exchange": "NSE",
                                "instrument_type": "EQUITY",
                                "symbol": "RELIANCE",
                                "expiry": "",
                                "strike": 0,
                                "option_type": "",
                                "ltp": 2500,
                                "prev_close": 2490,
                                "instrument_token": "CT:TEST:RELIANCE"
                              }
                            ]
                          }
                        ],
                        "missing": [
                          {
                            "account": "O2",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "margins": {
                    "summary": "Funds (one object per account)",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "O1",
                            "updated_at": "2026-09-29T12:02:21.918037Z",
                            "data": {
                              "account": "O1",
                              "opening_balance": 100000,
                              "available": 80000,
                              "utilised": 20000
                            }
                          }
                        ],
                        "missing": [
                          {
                            "account": "O2",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "open_orders": {
                    "summary": "Today's orders not yet final",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "O1",
                            "updated_at": "2026-09-29T12:02:21.918596Z",
                            "data": [
                              {
                                "cirrus_tag": "01M3PGPS2Y3SZDBE6XPE2YYTJ2",
                                "broker_tag": null,
                                "order_id": "PAPER-7",
                                "parent_tag": null,
                                "username": "owner-01M3PGPS1MDWS54TM40MNT7JP5",
                                "account": "O1",
                                "broker": "paper",
                                "cirrus_token": "CT:TEST:RELIANCE",
                                "tradingsymbol": "RELIANCE-EQ",
                                "side": "BUY",
                                "order_type": "LIMIT",
                                "product": "MIS",
                                "quantity": 5,
                                "price": 2500,
                                "trigger_price": null,
                                "state": "OPEN",
                                "filled_qty": 0,
                                "average_price": null,
                                "status_message": null,
                                "broker_updated_at": "2026-09-29T12:02:21.918545Z",
                                "created_at": "2026-09-29T12:02:21.918545Z",
                                "status_history": [
                                  {
                                    "from": "SUBMITTED",
                                    "to": "OPEN",
                                    "at": "2026-09-29T12:02:21.918545Z",
                                    "message": null
                                  }
                                ],
                                "lot_size": 1,
                                "exchange": "NSE",
                                "instrument_type": "EQUITY",
                                "symbol": "RELIANCE",
                                "expiry": "",
                                "strike": 0,
                                "option_type": "",
                                "ltp": 2500,
                                "prev_close": 2490,
                                "instrument_token": "CT:TEST:RELIANCE",
                                "order_tag": "01M3PGPS2Y3SZDBE6XPE2YYTJ2"
                              }
                            ]
                          }
                        ],
                        "missing": [
                          {
                            "account": "O2",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "order_history": {
                    "summary": "Today's final orders",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "O1",
                            "updated_at": "2026-09-29T12:02:21.918596Z",
                            "data": [
                              {
                                "cirrus_tag": "01M3PGPS2YJ9SYSJD0P10Z0VT8",
                                "broker_tag": null,
                                "order_id": "PAPER-6",
                                "parent_tag": null,
                                "username": "owner-01M3PGPS1MDWS54TM40MNT7JP5",
                                "account": "O1",
                                "broker": "paper",
                                "cirrus_token": "CT:TEST:RELIANCE",
                                "tradingsymbol": "RELIANCE-EQ",
                                "side": "BUY",
                                "order_type": "LIMIT",
                                "product": "MIS",
                                "quantity": 5,
                                "price": 2500,
                                "trigger_price": null,
                                "state": "FILLED",
                                "filled_qty": 5,
                                "average_price": 2500,
                                "status_message": null,
                                "broker_updated_at": "2026-09-29T12:02:21.918596Z",
                                "created_at": "2026-09-29T12:02:21.918596Z",
                                "status_history": [
                                  {
                                    "from": "SUBMITTED",
                                    "to": "FILLED",
                                    "at": "2026-09-29T12:02:21.918596Z",
                                    "message": null
                                  }
                                ],
                                "lot_size": 1,
                                "exchange": "NSE",
                                "instrument_type": "EQUITY",
                                "symbol": "RELIANCE",
                                "expiry": "",
                                "strike": 0,
                                "option_type": "",
                                "ltp": 2500,
                                "prev_close": 2490,
                                "instrument_token": "CT:TEST:RELIANCE",
                                "order_tag": "01M3PGPS2YJ9SYSJD0P10Z0VT8"
                              }
                            ]
                          }
                        ],
                        "missing": [
                          {
                            "account": "O2",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          }
                        ]
                      },
                      "error": null
                    }
                  },
                  "positions": {
                    "summary": "Positions; the account without data is under missing",
                    "value": {
                      "status": "success",
                      "data": {
                        "accounts": [
                          {
                            "account": "O1",
                            "updated_at": "2026-09-29T12:02:21.916159Z",
                            "data": [
                              {
                                "account": "O1",
                                "cirrus_token": "CT:TEST:RELIANCE",
                                "tradingsymbol": "RELIANCE-EQ",
                                "product": "MIS",
                                "net_qty": 5,
                                "buy_qty": 5,
                                "sell_qty": 0,
                                "buy_value": 12500,
                                "sell_value": 0,
                                "average_price": 2500,
                                "buy_average_price": 2500,
                                "sell_average_price": 0,
                                "pnl": 120.5,
                                "lot_size": 1,
                                "exchange": "NSE",
                                "instrument_type": "EQUITY",
                                "symbol": "RELIANCE",
                                "expiry": "",
                                "strike": 0,
                                "option_type": "",
                                "ltp": 2500,
                                "prev_close": 2490,
                                "instrument_token": "CT:TEST:RELIANCE"
                              }
                            ]
                          }
                        ],
                        "missing": [
                          {
                            "account": "O2",
                            "code": "no_session",
                            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
                          }
                        ]
                      },
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`not_shared`: that user shares nothing (or not this data) with the caller; `oms_not_enabled`: that user is not served by this deployment; `forbidden`: a partner token, or a credential without `read`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_shared": {
                    "summary": "That user shares nothing with the caller",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "not_shared",
                        "message": "Not shared with you",
                        "field": null
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "`invalid_request` (`field`: `view`): not one of the views.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unknown_view": {
                    "summary": "Not one of the views",
                    "value": {
                      "status": "error",
                      "data": null,
                      "error": {
                        "code": "invalid_request",
                        "message": "view must be one of accounts, positions, holdings, margins, open_orders, order_history",
                        "field": "view"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "`service_unavailable`: shared data (or the owner's accounts) is temporarily unavailable, or sharing is off on this server.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          },
          {
            "app_session": []
          }
        ],
        "x-required-scope": "read"
      }
    },
    "/v1/openapi.json": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "API description",
        "description": "This document: an OpenAPI 3.1 description of every public route, the stream protocol and the webhook payloads. No credential needed. Cached for five minutes; send `If-None-Match` with the last `ETag` to revalidate.",
        "operationId": "get_openapi",
        "parameters": [
          {
            "name": "If-None-Match",
            "in": "header",
            "description": "An `ETag` from an earlier response.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The OpenAPI document.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "`public, max-age=300`."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Changes whenever the document changes."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "304": {
            "description": "Not modified: the `If-None-Match` ETag is current.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "The current ETag."
              }
            }
          }
        },
        "security": []
      }
    }
  },
  "tags": [
    {
      "name": "orders",
      "description": "Place, modify and cancel orders (one order across many accounts), bracket and cover orders, margin estimates and position conversion."
    },
    {
      "name": "gtt",
      "description": "Good-till-triggered orders held by the broker."
    },
    {
      "name": "triggers",
      "description": "Stop-loss, target and trailing protection evaluated on every tick, exiting at market when hit."
    },
    {
      "name": "portfolio",
      "description": "Order book, positions, holdings, trades and funds, from live per-account snapshots."
    },
    {
      "name": "strategies",
      "description": "Positions and P&L per strategy across the user's accounts, from the per-strategy ledger."
    },
    {
      "name": "automated_strategies",
      "description": "Automated strategies: definitions with immutable versions, the portable strategy document (JSON / YAML, published JSON Schema), validation, dry-run, import and export, and deployments that run a version on paper (forward test) or live accounts."
    },
    {
      "name": "accounts",
      "description": "The user's linked broker accounts, their session and live-update health."
    },
    {
      "name": "instruments",
      "description": "Instrument search, details and the full instrument list."
    },
    {
      "name": "user",
      "description": "The signed-in user."
    },
    {
      "name": "stream",
      "description": "WebSocket stream of order, portfolio and activity changes."
    },
    {
      "name": "activity",
      "description": "The activity log: every order action, fill, rejection, trigger and access change, in plain English."
    },
    {
      "name": "webhooks",
      "description": "Outbound webhooks: signed HTTPS deliveries of order, trade, position and account events."
    },
    {
      "name": "notifications",
      "description": "Notifications in plain English on the user's own Telegram, in the app and to their webhooks: channels, routing per event type and per strategy or trigger, and the app inbox."
    },
    {
      "name": "signal_urls",
      "description": "Signal URLs: secret URLs that turn alerts from charting and screener tools into orders."
    },
    {
      "name": "api_keys",
      "description": "The user's API keys."
    },
    {
      "name": "partners",
      "description": "Partner apps and OAuth 2.0 (authorization code with PKCE)."
    },
    {
      "name": "baskets",
      "description": "Named multi-leg baskets saved by the user."
    },
    {
      "name": "watchlists",
      "description": "The user's stock watchlists (the app's market watch lists); a stock strategy can run on one."
    },
    {
      "name": "shared",
      "description": "Portfolios other users shared with the caller."
    },
    {
      "name": "meta",
      "description": "This description."
    },
    {
      "name": "app_session_only",
      "description": "Available only to the signed-in app session; API keys and partner tokens get 403."
    }
  ],
  "components": {
    "schemas": {
      "AccountHealth": {
        "type": "object",
        "description": "What the account's live worker last reported; any field may be null\n(older workers, partial writes).",
        "required": [
          "stream",
          "polls",
          "last_book_read_at",
          "open_orders",
          "last_error_kind",
          "last_error_message",
          "last_error_at"
        ],
        "properties": {
          "stream": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's live order-update stream: `up`, `down` or `none` (the\nbroker pushes nothing for this account)."
          },
          "polls": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "`true` while the order book is polled."
          },
          "last_book_read_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the order book was last read from the broker."
          },
          "open_orders": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Open orders at that read.",
            "minimum": 0
          },
          "last_error_kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "Kind of the last failed broker call."
          },
          "last_error_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "What that call's failure means, in words safe to show the user\n(e.g. the broker's rejection reason); never request details."
          },
          "last_error_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When that call failed."
          }
        }
      },
      "AccountMarginTotal": {
        "type": "object",
        "description": "Margin one account needs for all of its orders in the request.",
        "required": [
          "account",
          "total_required",
          "source",
          "stale",
          "flags",
          "message"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "total_required": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Margin the account's orders add together: the sum of their\nfigures; when they hedge each other (futures and options of one\nunderlying, or of a pair the exchange gives credit for), that sum\nless the estimated hedge benefit, never below the hedged estimate.\nNull when any of the account's orders has no figure (never a\npartial sum; `message` says which)."
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MarginSource",
                "description": "`broker` when the total is the sum of broker figures only,\n`estimate` when it carries a hedge credit or includes an estimated\norder; null when there is no total."
              },
              {
                "type": "null"
              }
            ]
          },
          "stale": {
            "type": "boolean",
            "description": "The estimate used exchange data that is not today's, or that the\nexchange data load refused."
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Why the estimate may be low (open list, as on each result)."
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why there is no total (which orders have no figure)."
          }
        }
      },
      "AccountMissingField": {
        "type": "object",
        "description": "A field the broker account lacks.",
        "required": [
          "field",
          "label",
          "required"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "snake_case id, e.g. `api_secret`."
          },
          "label": {
            "type": "string",
            "description": "As shown in the app, e.g. `API Secret`."
          },
          "required": {
            "type": "boolean",
            "description": "`true`: the account cannot trade without it; `false`: one feature\nis off."
          }
        }
      },
      "AccountReadiness": {
        "type": "string",
        "description": "Whether the account can trade now: `ready`, `login_required` (log in to\nthe broker again), `setup_incomplete` (a required field is missing, see\n`missing`) or `unsupported` (broker not supported for trading).",
        "enum": [
          "ready",
          "login_required",
          "setup_incomplete",
          "unsupported"
        ]
      },
      "AccountResult": {
        "type": "object",
        "description": "What one account did.",
        "required": [
          "account",
          "broker",
          "status",
          "order_ids",
          "message",
          "broker_message",
          "duration_ms"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "broker": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/AccountStatus"
          },
          "order_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Plain-English reason, e.g. \"Zerodha rejected it: not enough funds\"."
          },
          "broker_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's own text, unchanged."
          },
          "duration_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "route": {
            "type": [
              "string",
              "null"
            ],
            "description": "How the broker call was sent: `direct` or `static_ip`."
          },
          "static_ip": {
            "type": [
              "string",
              "null"
            ],
            "description": "The account's static IP when used."
          },
          "proxy_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Latest connect time to that static-IP proxy, in milliseconds.",
            "minimum": 0
          }
        }
      },
      "AccountStatus": {
        "type": "string",
        "description": "What happened in one account: `placed` (accepted by the broker and\nworking), `done` (completed), `rejected` (refused by the broker or\nexchange), `failed` (could not be sent, or did not complete) or\n`unknown` (no answer in time; the broker may or may not have it).",
        "enum": [
          "placed",
          "done",
          "rejected",
          "failed",
          "unknown"
        ]
      },
      "AccountUpdates": {
        "type": "string",
        "description": "How order updates arrive right now: `stream` (the broker's live\nstream), `postback` (the broker calls back) or `polling` (the order\nbook is read every few seconds).",
        "enum": [
          "stream",
          "postback",
          "polling"
        ]
      },
      "AccountView": {
        "type": "object",
        "description": "One linked broker account and whether it can trade. Never a\ncredential.",
        "required": [
          "account",
          "broker",
          "broker_name",
          "tag",
          "multiplier",
          "supported",
          "status",
          "missing",
          "updates",
          "static_ip",
          "last_login_at",
          "session_expires_at",
          "seat_assigned",
          "last_update_at",
          "protection",
          "warnings"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Account id (the broker's client code), as used in an order's\n`accounts` and the `account` filters."
          },
          "broker": {
            "type": "string",
            "description": "Broker id (`zerodha`, `upstox`, `paper`, ...)."
          },
          "broker_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Broker display name; null for an unknown broker."
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "The user's own label for the account."
          },
          "multiplier": {
            "type": "number",
            "format": "double",
            "description": "Quantity multiplier applied when an order is placed in this account."
          },
          "supported": {
            "type": "boolean",
            "description": "Whether the broker is supported for trading."
          },
          "status": {
            "$ref": "#/components/schemas/AccountReadiness"
          },
          "missing": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountMissingField"
            },
            "description": "Fields the account lacks (empty when complete)."
          },
          "updates": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountUpdates",
                "description": "Null for an unsupported broker."
              },
              {
                "type": "null"
              }
            ]
          },
          "static_ip": {
            "type": [
              "string",
              "null"
            ],
            "description": "The account's static IP as the broker sees it (what the user\nregisters): an IPv6 seat's `whitelist_ip`, else `ip`. Null when none\nis assigned."
          },
          "last_login_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Last broker login."
          },
          "session_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the broker session expires; null when there is no active\nsession (always null for paper accounts, which need none)."
          },
          "seat_assigned": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the account has a trading seat assigned (null when unknown)."
          },
          "last_update_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the order book was last read from the broker."
          },
          "protection": {
            "$ref": "#/components/schemas/ProtectionSupportView"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What needs fixing on the account although it may be `ready`, as\nsnake_case codes (empty when nothing). `static_ip_not_registered`:\nthe broker refused an order because no static IP is registered for\nthe account's API app; register `static_ip` at the broker (cleared\nby the account's next accepted order). More codes may be added:\nshow an unknown one as is."
          }
        }
      },
      "ActivityAgent": {
        "type": "object",
        "description": "The AI agent behind an MCP call, as it identified itself.",
        "required": [
          "name",
          "verified"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The agent's own name, e.g. \"Claude\"."
          },
          "version": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its version, when it said."
          },
          "verified": {
            "type": "boolean",
            "description": "Whether the name was verified (otherwise it is self-reported)."
          }
        }
      },
      "ActivityCategory": {
        "type": "string",
        "description": "Filter group of a record, derived from its `kind`: `orders`,\n`protection`, `signals`, `account`, `access` or `strategies`.",
        "enum": [
          "orders",
          "protection",
          "signals",
          "account",
          "access",
          "strategies"
        ]
      },
      "ActivityDependencyOutcome": {
        "type": "string",
        "description": "How a dependent order's wait for its parent ended: `filled` (the\nparent filled; this order was sent), `partial` (sent for the parent's\nfilled share, `depends_on_partial: filled_qty`), `failed` (the parent\nended unfilled or was not placed) or `timeout` (the wait's deadline\npassed). `failed` and `timeout` reject the order with\n`dependency_failed`.",
        "enum": [
          "filled",
          "partial",
          "failed",
          "timeout"
        ]
      },
      "ActivityDependsOn": {
        "type": "object",
        "description": "The order a dependent (`depends_on`) order waited for, and how that\nwait ended. Across accounts, the least complete one is reported\n(`failed`, then `timeout`, then `partial`, then `filled`).",
        "required": [
          "order_ref",
          "tradingsymbol",
          "side",
          "waited_ms",
          "outcome"
        ],
        "properties": {
          "order_ref": {
            "type": "string",
            "description": "`id` of the parent order's activity record (same request)."
          },
          "tradingsymbol": {
            "type": "string"
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "waited_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Longest wait for the parent in any account; `null` when the\nparent was never placed, so there was nothing to wait for.",
            "minimum": 0
          },
          "outcome": {
            "$ref": "#/components/schemas/ActivityDependencyOutcome"
          }
        },
        "example": {
          "order_ref": "01K7Q2W8N4X5Y6Z7A8B9C0D1E2",
          "tradingsymbol": "NIFTY25OCT72000PE",
          "side": "BUY",
          "waited_ms": 603,
          "outcome": "filled"
        }
      },
      "ActivityInstrument": {
        "type": "object",
        "required": [
          "instrument_token",
          "tradingsymbol",
          "exchange"
        ],
        "properties": {
          "instrument_token": {
            "type": "string",
            "description": "Instrument id (also returned as `instrument_token`)."
          },
          "tradingsymbol": {
            "type": "string"
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "ActivityKind": {
        "type": "string",
        "description": "What happened. Serialized snake_case (`order_filled`, `gtt_create`...).",
        "enum": [
          "place",
          "bracket",
          "modify",
          "cancel",
          "convert",
          "order_filled",
          "order_partially_filled",
          "order_rejected",
          "order_cancelled_by_broker",
          "external_order",
          "order_unknown",
          "gtt_create",
          "gtt_modify",
          "gtt_delete",
          "gtt_triggered",
          "trigger_create",
          "trigger_modify",
          "trigger_delete",
          "trigger_hit",
          "trigger_exit",
          "protection_armed",
          "protection_failed",
          "signal",
          "session_expired",
          "relogin_detected",
          "live_updates_unavailable",
          "live_updates_restored",
          "portfolio_refresh",
          "account_setup_incomplete",
          "api_key_created",
          "api_key_revoked",
          "partner_connected",
          "partner_revoked",
          "partner_app_disabled",
          "partner_app_secret_rotated",
          "connection_limits_changed",
          "signal_url_issued",
          "signal_url_revoked",
          "signal_url_rotated",
          "webhook_created",
          "webhook_updated",
          "webhook_deleted",
          "webhook_secret_rotated",
          "webhook_disabled",
          "strategy_created",
          "strategy_updated",
          "strategy_archived",
          "strategy_version_saved",
          "deployment_started",
          "deployment_paused",
          "deployment_resumed",
          "deployment_stopped",
          "deployment_went_live",
          "deployment_exit_now",
          "strategies_stop_all",
          "backtest_submitted",
          "risk_limits_changed",
          "basket_saved",
          "basket_deleted"
        ]
      },
      "ActivityOutcome": {
        "type": "string",
        "description": "`ok` (every account succeeded), `partial` or `failed` (none did).",
        "enum": [
          "ok",
          "partial",
          "failed"
        ]
      },
      "ActivityPageSource": {
        "type": "string",
        "description": "Where a page was read from: `hot` (the live store) or `archive` (the\nday's archive, for older days).",
        "enum": [
          "hot",
          "archive"
        ]
      },
      "ActivityRecord": {
        "type": "object",
        "description": "One activity-log record: something that happened to the user's\naccounts, in plain English, with the per-account results.",
        "required": [
          "id",
          "username",
          "at",
          "kind",
          "category",
          "source",
          "request_id",
          "instrument",
          "side",
          "order_type",
          "product",
          "quantity",
          "price",
          "trigger_price",
          "summary",
          "message",
          "outcome",
          "duration_ms",
          "accounts"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "ULID (sorts by creation time)."
          },
          "username": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When the action started. For a dependent order (`depends_on`):\nwhen its wait for the parent ended and it was sent (or refused)."
          },
          "kind": {
            "$ref": "#/components/schemas/ActivityKind"
          },
          "category": {
            "$ref": "#/components/schemas/ActivityCategory"
          },
          "source": {
            "$ref": "#/components/schemas/ActivitySource"
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The `x-request-id` of the API call that started it, if any."
          },
          "instrument": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ActivityInstrument"
              },
              {
                "type": "null"
              }
            ]
          },
          "side": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Side"
              },
              {
                "type": "null"
              }
            ]
          },
          "order_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`MARKET`, `LIMIT`, `SL` or `SL_M`."
          },
          "product": {
            "type": [
              "string",
              "null"
            ],
            "description": "`MIS`, `CARRYFORWARD`, `DELIVERY` or `MTF`."
          },
          "quantity": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "trigger_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "order_tag": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrderTag",
                "description": "The order this record is about, when it is about one order (a\nfill, a rejection, protection armed / failed for an entry)."
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "type": "string"
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Plain reason for records without a per-account result (an ignored\nsignal, a lost session, protection that failed...)."
          },
          "outcome": {
            "$ref": "#/components/schemas/ActivityOutcome"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "description": "How long the action took. For a dependent order: from its send\nto the brokers' answer (the wait for its parent is not counted).",
            "minimum": 0
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountResult"
            }
          },
          "depends_on": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ActivityDependsOn",
                "description": "Only on records of a dependent order (`depends_on`)."
              },
              {
                "type": "null"
              }
            ]
          },
          "timeline": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/TimelineEntry"
            },
            "description": "Only on detail responses and in the archive."
          }
        }
      },
      "ActivitySource": {
        "type": "object",
        "description": "Who or what started an activity.",
        "required": [
          "type",
          "name"
        ],
        "properties": {
          "type": {
            "$ref": "#/components/schemas/ActivitySourceType"
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "API key name, partner app name, \"TradingView: <strategy>\",\n\"Stop-loss\" / \"Target\" / \"Trailing SL\", broker name."
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The partner connection that acted (`partner` sources only)."
          },
          "via": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ActivityVia",
                "description": "The channel the request came in through (`app`, `api` or `mcp`);\nabsent on records made before it was recorded."
              },
              {
                "type": "null"
              }
            ]
          },
          "agent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ActivityAgent",
                "description": "The AI agent, for `via: mcp`."
              },
              {
                "type": "null"
              }
            ]
          },
          "tool": {
            "type": [
              "string",
              "null"
            ],
            "description": "The MCP tool the agent called, for `via: mcp`."
          }
        }
      },
      "ActivitySourceType": {
        "type": "string",
        "description": "Who or what started it: `app` (signed-in app session), `api_key`,\n`partner`, `signal` (a signal URL), `trigger` (a stop-loss / target\ntrigger), `broker` (the broker or exchange) or `system` (housekeeping).",
        "enum": [
          "app",
          "api_key",
          "partner",
          "signal",
          "trigger",
          "broker",
          "system"
        ]
      },
      "ActivityVia": {
        "type": "string",
        "description": "The channel a request came in through: `app` (signed-in app session),\n`api` (an API key or partner token) or `mcp` (an AI agent through an\nMCP connection).",
        "enum": [
          "app",
          "api",
          "mcp"
        ]
      },
      "AppPushChannelStatus": {
        "type": "object",
        "required": [
          "healthy",
          "stream_topic"
        ],
        "properties": {
          "healthy": {
            "type": "boolean",
            "description": "Always true: the app inbox (`GET /v1/notifications`) keeps every\nnotice for 30 days."
          },
          "stream_topic": {
            "type": "string",
            "description": "Subscribe to this `/v1/stream` topic for live notices."
          }
        }
      },
      "AutoAccountInput": {
        "type": "object",
        "required": [
          "account"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "multiplier": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "0.1 to 10 in steps of 0.1 (default 1)."
          }
        },
        "additionalProperties": false
      },
      "AutoAccountView": {
        "type": "object",
        "required": [
          "account",
          "multiplier"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "multiplier": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AutoBindingsInput": {
        "type": "object",
        "properties": {
          "signal_endpoint_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Signal URL bound to a `webhook@1` source."
          },
          "notify_webhook_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Webhook bound to a `webhook@1` notifier."
          }
        },
        "additionalProperties": false
      },
      "AutoBreaker": {
        "type": "object",
        "description": "The safety pause (circuit breaker).",
        "required": [
          "detector",
          "evidence",
          "at",
          "trips_today"
        ],
        "properties": {
          "detector": {
            "type": "string",
            "description": "`order_rate`, `entry_rate`, `refusals`, `loss_velocity`, ..."
          },
          "evidence": {
            "type": "string",
            "description": "What it saw, in words and numbers."
          },
          "at": {
            "type": "integer",
            "format": "int64",
            "description": "Epoch ms."
          },
          "trips_today": {
            "type": "integer",
            "format": "int32",
            "description": "Trips today (two lock resume until the next trading day).",
            "minimum": 0
          }
        }
      },
      "AutoCloneInput": {
        "type": "object",
        "description": "`POST /v2/strategies/{id}/clone`.",
        "properties": {
          "version": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The version to copy (default: the draft).",
            "minimum": 0
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Name of the copy (default: `Copy of <name>`)."
          }
        },
        "additionalProperties": false
      },
      "AutoConditionValue": {
        "type": "object",
        "description": "A value a condition reads, against what it needs.",
        "required": [
          "label",
          "expr",
          "condition",
          "status"
        ],
        "properties": {
          "label": {
            "type": "string",
            "description": "`RSI(14) · NIFTY 50 · 5m`."
          },
          "expr": {
            "type": "string",
            "description": "As written (`u.rsi(14, '5m')`)."
          },
          "condition": {
            "type": "string",
            "description": "`entry` or `exit`."
          },
          "status": {
            "type": "string",
            "description": "`warming`, `ready`, `fallback`."
          },
          "value": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The forming candle's value, else the last closed one."
          },
          "op": {
            "type": [
              "string",
              "null"
            ],
            "description": "`<`, `>=`, `crosses_above`, ..."
          },
          "threshold": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "distance": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "How far the value is from the threshold."
          }
        }
      },
      "AutoCreditEntry": {
        "type": "object",
        "description": "One change of your credits.",
        "required": [
          "at",
          "delta",
          "balance_after",
          "kind",
          "note"
        ],
        "properties": {
          "at": {
            "type": "string"
          },
          "delta": {
            "type": "integer",
            "format": "int64",
            "description": "Credits added (positive) or spent (negative)."
          },
          "balance_after": {
            "type": "integer",
            "format": "int64"
          },
          "kind": {
            "$ref": "#/components/schemas/AutoCreditKind"
          },
          "listing_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": "string"
          }
        }
      },
      "AutoCreditKind": {
        "type": "string",
        "enum": [
          "grant",
          "purchase",
          "sale",
          "unknown"
        ]
      },
      "AutoCyclePhase": {
        "type": "string",
        "description": "Cycle phase (§5), projected from engine events.",
        "enum": [
          "waiting",
          "armed",
          "entering",
          "open",
          "managing",
          "adjusting",
          "exiting",
          "cooldown",
          "finished",
          "unknown"
        ]
      },
      "AutoCyclePnlView": {
        "type": "object",
        "required": [
          "realized",
          "unrealized"
        ],
        "properties": {
          "realized": {
            "type": "number",
            "format": "double"
          },
          "unrealized": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AutoCycleView": {
        "type": "object",
        "description": "One cycle of one account.",
        "required": [
          "account",
          "day",
          "n",
          "phase",
          "legs",
          "pnl"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "day": {
            "type": "string"
          },
          "n": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "phase": {
            "$ref": "#/components/schemas/AutoCyclePhase"
          },
          "legs": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "exit_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "pnl": {
            "$ref": "#/components/schemas/AutoCyclePnlView"
          },
          "opened_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "closed_at": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AutoDecision": {
        "type": "string",
        "description": "What the strategy would do right now.",
        "enum": [
          "would_wait",
          "would_enter",
          "would_skip",
          "cannot_decide",
          "invalid"
        ]
      },
      "AutoDeployInput": {
        "type": "object",
        "description": "`POST /v2/strategies/{id}/deployments`.",
        "required": [
          "mode",
          "accounts"
        ],
        "properties": {
          "version": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The version to run (default: the latest, saving the draft as a new\nversion first when it changed).",
            "minimum": 0
          },
          "mode": {
            "$ref": "#/components/schemas/AutoModeInput"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoAccountInput"
            },
            "description": "1 to 4 accounts; all paper (forward test) or all live."
          },
          "start_on": {
            "type": [
              "string",
              "null"
            ],
            "description": "First trading day (`YYYY-MM-DD`)."
          },
          "end_on": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last trading day (`YYYY-MM-DD`)."
          },
          "bindings": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoBindingsInput"
              },
              {
                "type": "null"
              }
            ]
          },
          "acknowledge": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Warning codes the user acknowledged (`unlimited_loss`)."
          }
        },
        "additionalProperties": false
      },
      "AutoDeployment": {
        "type": "object",
        "description": "A deployment: one version on 1 to 4 accounts, paper or live.",
        "required": [
          "id",
          "strategy_id",
          "version",
          "mode",
          "status",
          "strategy_tag",
          "accounts",
          "units",
          "acknowledged",
          "compiled_hash",
          "engine_connected",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "strategy_id": {
            "type": "string"
          },
          "strategy_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The strategy's name when it was deployed (absent on deployments made\nbefore names were kept)."
          },
          "version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "mode": {
            "$ref": "#/components/schemas/AutoMode"
          },
          "status": {
            "$ref": "#/components/schemas/AutoDeploymentStatus",
            "description": "`active`, `paused`, `error` or `stopped` (`unknown`: unreadable,\ntreated as needing attention)."
          },
          "status_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "strategy_tag": {
            "type": "string",
            "description": "Stamped on every order (`auto.` + 12 characters of the id)."
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoAccountView"
            }
          },
          "units": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoUnitView"
            }
          },
          "universe": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoUniverse",
                "description": "A watchlist deployment's universe (`spec.stock.watchlist_id`);\nabsent otherwise."
              },
              {
                "type": "null"
              }
            ]
          },
          "start_on": {
            "type": [
              "string",
              "null"
            ]
          },
          "end_on": {
            "type": [
              "string",
              "null"
            ]
          },
          "acknowledged": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "compiled_hash": {
            "type": "string"
          },
          "last_intent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoIntentView"
              },
              {
                "type": "null"
              }
            ]
          },
          "engine_connected": {
            "type": "boolean",
            "description": "Whether intents reach the strategy engine yet."
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "stopped_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "pnl": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoPnl",
                "description": "Today's P&L of its orders (from the strategy ledgers, by\n`strategy_tag`; `GET /v2/deployments/{id}` and the strategy's\ndeployment list only); absent when the ledgers cannot be read just\nnow."
              },
              {
                "type": "null"
              }
            ]
          },
          "safety_pauses": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/AutoSafetyPause"
            },
            "description": "Accounts whose safety pause (circuit breaker) has tripped, with\nwhat it saw (`GET /v2/deployments/{id}` and the strategy's\ndeployment list only); empty when none has. Absent when the\ndeployment is stopped or the engine is not connected or did not\nanswer."
          }
        }
      },
      "AutoDeploymentCounts": {
        "type": "object",
        "description": "Deployments of a strategy by status.",
        "required": [
          "active",
          "paused",
          "error",
          "stopped"
        ],
        "properties": {
          "active": {
            "type": "integer",
            "minimum": 0
          },
          "paused": {
            "type": "integer",
            "minimum": 0
          },
          "error": {
            "type": "integer",
            "minimum": 0
          },
          "stopped": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AutoDeploymentStatus": {
        "type": "string",
        "description": "Stored deployment and unit status (§3.2).",
        "enum": [
          "active",
          "paused",
          "error",
          "stopped",
          "unknown"
        ]
      },
      "AutoDisplayStatus": {
        "type": "string",
        "description": "The strategy's display status, derived from its deployments (§3.2).",
        "enum": [
          "draft",
          "active",
          "paused",
          "stopped",
          "error"
        ]
      },
      "AutoDocumentInput": {
        "type": "object",
        "description": "A strategy document to check or save: the whole portable document, or\na definition (`spec`) with its name. A YAML document may also be sent\nas the raw body with `Content-Type: application/yaml`.",
        "required": [
          "document"
        ],
        "properties": {
          "document": {
            "description": "The portable document: an object, or its JSON or YAML text\n(`schema_version`, `kind`, `metadata`, `spec`)."
          },
          "definition": {
            "type": [
              "object",
              "null"
            ],
            "description": "Instead of `document`: the definition (`spec`) alone."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "With `definition`: the strategy's name (at most 60 characters)."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "With `definition`."
          },
          "tags": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "With `definition`."
          },
          "revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Update only: the `revision` last read; a draft changed since is\nrefused (409 `strategy_busy`) rather than overwritten.",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "AutoDryRunInput": {
        "type": "object",
        "description": "`POST /v2/strategies/dry-run`: a document (as for validate), or a saved\nstrategy version.",
        "required": [
          "document"
        ],
        "properties": {
          "document": {},
          "definition": {
            "type": [
              "object",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "strategy_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Instead of a document: one of the caller's strategies."
          },
          "version": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "With `strategy_id` (default: the draft).",
            "minimum": 0
          },
          "account": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account to size and check against."
          },
          "at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Check the entry window and days as at this time (RFC 3339; default\nnow). Contracts are always picked from live prices."
          }
        },
        "additionalProperties": false
      },
      "AutoForkedFromView": {
        "type": "object",
        "required": [
          "strategy_id",
          "version"
        ],
        "properties": {
          "strategy_id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "AutoGalleryBadge": {
        "type": "string",
        "description": "Whose results the performance is (decision 2), shown as a badge.",
        "enum": [
          "paper",
          "live",
          "unknown"
        ]
      },
      "AutoGalleryBadgeEligibility": {
        "type": "object",
        "description": "One badge's standing.",
        "required": [
          "badge",
          "finished_cycles",
          "eligible"
        ],
        "properties": {
          "badge": {
            "$ref": "#/components/schemas/AutoGalleryBadge"
          },
          "finished_cycles": {
            "type": "integer",
            "format": "int32",
            "description": "Finished trades of this version in your own runs of that mode.",
            "minimum": 0
          },
          "eligible": {
            "type": "boolean",
            "description": "It may be listed with this badge now (as far as trades go)."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why not, in plain English; null when eligible."
          }
        }
      },
      "AutoGalleryListing": {
        "type": "object",
        "description": "A listing as anyone signed in sees it. Never the author's username,\naccounts, capital, rupee amounts or quantities.",
        "required": [
          "listing_id",
          "name",
          "description",
          "tags",
          "underlying",
          "summary",
          "author",
          "badge",
          "label",
          "performance",
          "price_credits",
          "effective_price",
          "is_free",
          "price_reason",
          "non_refundable",
          "copies",
          "listed_at",
          "can_copy",
          "mine"
        ],
        "properties": {
          "listing_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "underlying": {
            "type": "string"
          },
          "summary": {
            "type": "string",
            "description": "The strategy in plain English."
          },
          "author": {
            "type": "string",
            "description": "The author's chosen display name."
          },
          "badge": {
            "$ref": "#/components/schemas/AutoGalleryBadge"
          },
          "label": {
            "type": "string",
            "description": "\"Past results on paper (simulated); not advice.\""
          },
          "performance": {
            "$ref": "#/components/schemas/AutoGalleryPerformance"
          },
          "price_credits": {
            "type": "integer",
            "format": "int64",
            "description": "What it costs you now (0: free); the same as `effective_price`.",
            "minimum": 0
          },
          "effective_price": {
            "type": "integer",
            "format": "int64",
            "description": "What it costs you now: 0 while paid templates are off, during a\n\"make all free\" promotion, or when staff made it free.",
            "minimum": 0
          },
          "is_free": {
            "type": "boolean"
          },
          "price_reason": {
            "type": "string",
            "description": "Why: `paid_disabled`, `promotion`, `admin_free`, `unpriced` or\n`priced`."
          },
          "non_refundable": {
            "type": "boolean",
            "description": "True when it costs something: purchases are non-refundable."
          },
          "copies": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "listed_at": {
            "type": "string"
          },
          "can_copy": {
            "type": "boolean",
            "description": "You may copy it now (free, bought, or yours)."
          },
          "mine": {
            "type": "boolean",
            "description": "It is yours."
          },
          "document": {
            "type": [
              "object",
              "null"
            ],
            "description": "The version's document (detail only, when you may copy it)."
          }
        }
      },
      "AutoGalleryPerformance": {
        "type": "object",
        "description": "Published performance as shown: percent only.",
        "required": [
          "return_pct",
          "max_drawdown_pct",
          "win_rate_pct",
          "trades",
          "since",
          "until"
        ],
        "properties": {
          "return_pct": {
            "type": "number",
            "format": "double",
            "description": "Total return, % of the capital it ran with."
          },
          "max_drawdown_pct": {
            "type": "number",
            "format": "double",
            "description": "Largest fall from a peak, %."
          },
          "win_rate_pct": {
            "type": "number",
            "format": "double",
            "description": "Trades with a profit, %."
          },
          "trades": {
            "type": "integer",
            "format": "int32",
            "description": "Finished trades counted.",
            "minimum": 0
          },
          "since": {
            "type": "string",
            "description": "First and last day counted (`YYYY-MM-DD`)."
          },
          "until": {
            "type": "string"
          }
        }
      },
      "AutoGalleryPublishInput": {
        "type": "object",
        "description": "`POST /v2/strategies/{id}/gallery`.",
        "required": [
          "display_name",
          "badge",
          "capital"
        ],
        "properties": {
          "display_name": {
            "type": "string",
            "description": "The name shown as the author (3–40 letters, digits, spaces, `.`,\n`_`, `-`; never your username or email)."
          },
          "badge": {
            "$ref": "#/components/schemas/AutoGalleryBadge",
            "description": "Whose results to publish: your `paper` or your `live` runs of this\nversion (shown as a badge)."
          },
          "capital": {
            "type": "number",
            "format": "double",
            "description": "The capital (₹) you ran it with: every published percent is of\nthis. Seen by you and the reviewers only."
          },
          "price_credits": {
            "type": "integer",
            "format": "int64",
            "description": "Credits to copy it (0 or absent: free). Only while paid templates\nare on, and within the tenant's limits (`GET /v2/gallery/pricing`).",
            "minimum": 0
          },
          "version": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The saved version (default: the newest).",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "AutoGalleryReceipt": {
        "type": "object",
        "description": "A purchase as its buyer sees it.",
        "required": [
          "receipt_id",
          "listing_id",
          "name",
          "author",
          "charged_credits",
          "bought_at",
          "non_refundable"
        ],
        "properties": {
          "receipt_id": {
            "type": "string",
            "description": "The charge id, also on the wallet's transaction."
          },
          "listing_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "author": {
            "type": "string",
            "description": "The author's display name."
          },
          "charged_credits": {
            "type": "integer",
            "format": "int64",
            "description": "Credits paid.",
            "minimum": 0
          },
          "strategy_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your copy made with the purchase."
          },
          "bought_at": {
            "type": "string"
          },
          "non_refundable": {
            "type": "boolean",
            "description": "Always true: purchases are non-refundable."
          }
        }
      },
      "AutoGalleryTemplateEarnings": {
        "type": "object",
        "description": "One of your templates' sales.",
        "required": [
          "listing_id",
          "name",
          "sales",
          "credits_earned"
        ],
        "properties": {
          "listing_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "sales": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "credits_earned": {
            "type": "integer",
            "format": "int64",
            "description": "Your share, in credits.",
            "minimum": 0
          }
        }
      },
      "AutoGoLiveInput": {
        "type": "object",
        "description": "`POST /v2/deployments/{id}/go-live`: the same version on live accounts.",
        "required": [
          "accounts"
        ],
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoAccountInput"
            }
          },
          "acknowledge": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "keep_paper": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Keep the forward test running alongside (default true)."
          }
        },
        "additionalProperties": false
      },
      "AutoImportFrom": {
        "type": "object",
        "description": "Where an import comes from.",
        "properties": {
          "strategy_id": {
            "type": "string",
            "description": "One of the caller's own strategies, or (sharing on) one shared\nwith the caller by name."
          },
          "version": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Default: its latest version (or, for your own, its draft when none\nis saved). A shared strategy forks saved versions only.",
            "minimum": 0
          },
          "link_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "A share link's token instead of `strategy_id` (sharing on): forks\nthe version the link shows."
          }
        },
        "additionalProperties": false
      },
      "AutoImportInput": {
        "type": "object",
        "description": "`POST /v2/strategies/import`: a pasted or uploaded document, or a copy\nof an existing version. Always creates the caller's own draft; never\ndeploys.",
        "properties": {
          "document": {
            "description": "The document: an object, or its JSON or YAML text (or `from`)."
          },
          "from": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoImportFrom"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "AutoImportResult": {
        "type": "object",
        "description": "The draft an import created, with what checking it found.",
        "required": [
          "strategy",
          "validation"
        ],
        "properties": {
          "strategy": {
            "$ref": "#/components/schemas/AutoStrategy"
          },
          "validation": {
            "$ref": "#/components/schemas/AutoStrategyValidation"
          }
        }
      },
      "AutoIntentAction": {
        "type": "string",
        "description": "What the user last asked of a deployment.",
        "enum": [
          "deploy",
          "pause",
          "resume",
          "stop",
          "exit_now",
          "unknown"
        ]
      },
      "AutoIntentView": {
        "type": "object",
        "required": [
          "action",
          "exit_now",
          "at",
          "delivered"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/AutoIntentAction"
          },
          "exit_now": {
            "type": "boolean"
          },
          "at": {
            "type": "string"
          },
          "delivered": {
            "type": "boolean",
            "description": "Whether the engine took it (false: saved, not sent yet)."
          }
        }
      },
      "AutoJourneyEntry": {
        "type": "object",
        "description": "One step of a deployment's journey (`GET /v2/deployments/{id}/journey`,\nand the cycle detail's `journey`).",
        "required": [
          "id",
          "at",
          "account",
          "kind",
          "what_happened",
          "what_we_did",
          "what_you_should_do"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Opaque, stable."
          },
          "at": {
            "type": "integer",
            "format": "int64",
            "description": "Epoch ms."
          },
          "account": {
            "type": "string"
          },
          "day": {
            "type": [
              "string",
              "null"
            ],
            "description": "Trading day of the cycle (`YYYY-MM-DD`), when the step belongs to one."
          },
          "cycle": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Cycle number that day (0: before the first).",
            "minimum": 0
          },
          "kind": {
            "type": "string",
            "description": "What happened (`armed`, `entered`, `exit_sent`, `cycle_closed`,\n`circuit_breaker`, ...; `api` for your own requests, `refused` for a\nrequest the engine refused; other values may appear)."
          },
          "what_happened": {
            "type": "string"
          },
          "what_we_did": {
            "type": "string"
          },
          "what_you_should_do": {
            "type": "string",
            "description": "Empty when nothing is needed."
          },
          "broker_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's own words, when a broker answered."
          }
        }
      },
      "AutoLiveLeg": {
        "type": "object",
        "description": "One open leg.",
        "required": [
          "leg_id",
          "symbol",
          "side",
          "qty",
          "avg_price"
        ],
        "properties": {
          "leg_id": {
            "type": "string"
          },
          "symbol": {
            "type": "string",
            "description": "The contract (instrument token)."
          },
          "side": {
            "type": "string",
            "description": "`buy` or `sell`."
          },
          "qty": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "avg_price": {
            "type": "number",
            "format": "double"
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Realized plus open (₹)."
          },
          "stop": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "target": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "iv_pct": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Implied volatility from `ltp`, in percent (options only; absent\nwhen it does not solve)."
          },
          "greeks": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StrategyGreeks",
                "description": "Of the whole leg (`qty` units); absent without an IV."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "AutoLiveTrade": {
        "type": "object",
        "description": "One open trade of a strategy that holds several at once.",
        "required": [
          "trade",
          "cycle",
          "day",
          "phase",
          "legs"
        ],
        "properties": {
          "trade": {
            "type": "string",
            "description": "`{day}:{cycle}`: the trade's id."
          },
          "cycle": {
            "type": "integer",
            "format": "int32",
            "description": "Its cycle number on `day` (as in the journey and the cycles list).",
            "minimum": 0
          },
          "day": {
            "type": "string",
            "description": "The trading day it opened (`YYYY-MM-DD`, IST)."
          },
          "phase": {
            "type": "string",
            "description": "`entering`, `managing`, `adjusting`, `exiting`, ..."
          },
          "pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Trade P&L (₹); null while a price is stale."
          },
          "floor": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Its combined stop floor (₹), once raised."
          },
          "entered_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "When it entered (epoch ms)."
          },
          "exit_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it is closing, once it is."
          },
          "legs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoLiveLeg"
            }
          }
        }
      },
      "AutoMarginEstimate": {
        "type": "object",
        "description": "A rough margin figure for the legs, before any broker is asked.",
        "required": [
          "amount",
          "method",
          "note"
        ],
        "properties": {
          "amount": {
            "type": "number",
            "format": "double",
            "description": "Rupees."
          },
          "method": {
            "$ref": "#/components/schemas/AutoMarginMethod"
          },
          "note": {
            "type": "string",
            "description": "How it was worked out, in plain English."
          }
        }
      },
      "AutoMarginMethod": {
        "type": "string",
        "description": "What a margin estimate is based on.",
        "enum": [
          "defined_risk",
          "contract_value"
        ]
      },
      "AutoMode": {
        "type": "string",
        "description": "Paper (forward test on the Paper account) or live money.",
        "enum": [
          "paper",
          "live",
          "unknown"
        ]
      },
      "AutoModeInput": {
        "type": "string",
        "enum": [
          "paper",
          "live"
        ]
      },
      "AutoPnl": {
        "type": "object",
        "description": "P&L today (IST trading day), no charges.",
        "required": [
          "trading_day",
          "realized",
          "unrealized",
          "total",
          "ltp_stale"
        ],
        "properties": {
          "trading_day": {
            "type": "string",
            "description": "`YYYY-MM-DD` (IST)."
          },
          "realized": {
            "type": "number",
            "format": "double",
            "description": "Booked today (₹)."
          },
          "unrealized": {
            "type": "number",
            "format": "double",
            "description": "Open positions at our latest prices (₹); positions without a price\ncount as 0 (see `ltp_stale`)."
          },
          "total": {
            "type": "number",
            "format": "double",
            "description": "`realized + unrealized` (₹)."
          },
          "ltp_stale": {
            "type": "boolean",
            "description": "An open position's price is not current or missing: `unrealized`\nmay be behind."
          }
        }
      },
      "AutoPnlPoint": {
        "type": "object",
        "required": [
          "at",
          "pnl"
        ],
        "properties": {
          "at": {
            "type": "integer",
            "format": "int64",
            "description": "Epoch ms."
          },
          "pnl": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AutoResolvedLegPreview": {
        "type": "object",
        "description": "A contract the strategy would trade now.",
        "required": [
          "leg_id",
          "symbol",
          "side",
          "lots",
          "qty"
        ],
        "properties": {
          "leg_id": {
            "type": "string"
          },
          "symbol": {
            "type": "string",
            "description": "`EXCHANGE:SYMBOL`."
          },
          "side": {
            "type": "string"
          },
          "lots": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "qty": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "strike": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Premium (or price) seen."
          },
          "iv": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "delta": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          }
        }
      },
      "AutoResumeInput": {
        "type": "object",
        "description": "Optional body of `resume`.",
        "properties": {
          "acknowledged": {
            "type": "boolean",
            "description": "Required (true) when the deployment was paused for safety (the\ncircuit breaker tripped): you have looked at what happened."
          }
        },
        "additionalProperties": false
      },
      "AutoRiskLimitsInput": {
        "type": "object",
        "description": "`PUT /v2/strategies/risk-limits`.",
        "properties": {
          "max_daily_loss": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Today's loss across every strategy (₹, realised plus open) at which\nno new trades start. `null` removes it; left out keeps it.",
            "minimum": 1
          },
          "max_open_exposure": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Open exposure across every strategy (₹) at which no new trades\nstart: per trade, the most it can lose where that is bounded\n(spreads, bought options), else the broker's margin, else the entry\nvalue. `null` removes it; left out keeps it.",
            "minimum": 1
          },
          "close_on_breach": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Also close every open trade of your strategies when the daily loss\nlimit is reached (off by default; needs `max_daily_loss`). Left out\nkeeps it."
          }
        },
        "additionalProperties": false
      },
      "AutoRiskToday": {
        "type": "object",
        "description": "Today's P&L of every automated strategy (no charges).",
        "required": [
          "trading_day",
          "pnl",
          "ltp_stale",
          "daily_loss_reached"
        ],
        "properties": {
          "trading_day": {
            "type": "string",
            "description": "`YYYY-MM-DD` (IST)."
          },
          "pnl": {
            "type": "number",
            "format": "double",
            "description": "Realised plus open at our latest prices (₹)."
          },
          "ltp_stale": {
            "type": "boolean",
            "description": "An open position's price is not current: `pnl` may be behind (the\nengine then waits rather than guess)."
          },
          "daily_loss_reached": {
            "type": "boolean",
            "description": "`pnl` is at or below minus `max_daily_loss`: no new trades today."
          }
        }
      },
      "AutoSafetyPause": {
        "type": "object",
        "description": "One account's tripped breaker.",
        "required": [
          "account",
          "detector",
          "evidence",
          "at",
          "trips_today"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "detector": {
            "type": "string",
            "description": "`order_rate`, `entry_rate`, `refusals`, `loss_velocity`, ..."
          },
          "evidence": {
            "type": "string",
            "description": "What it saw, in words and numbers."
          },
          "at": {
            "type": "integer",
            "format": "int64",
            "description": "Epoch ms."
          },
          "trips_today": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "locked_until": {
            "type": [
              "string",
              "null"
            ],
            "description": "After the second trip today: the trading day (`YYYY-MM-DD`) resume\nis allowed again; null while resume is allowed."
          }
        }
      },
      "AutoSaveVersionInput": {
        "type": "object",
        "description": "`POST /v2/strategies/{id}/versions` (optional body).",
        "properties": {
          "revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "The draft `revision` the user saw; refused (409) when the draft\nchanged since.",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "AutoShareLink": {
        "type": "object",
        "required": [
          "created_at"
        ],
        "properties": {
          "token": {
            "type": [
              "string",
              "null"
            ],
            "description": "The token, only in the answer that created it: keep it, it is not\nshown again. Open it with `GET /v2/shared/{token}`."
          },
          "created_at": {
            "type": "string"
          }
        }
      },
      "AutoShareLinkAction": {
        "type": "string",
        "enum": [
          "create",
          "revoke"
        ]
      },
      "AutoSharingInput": {
        "type": "object",
        "description": "`PUT /v2/strategies/{id}/sharing`.",
        "required": [
          "visibility"
        ],
        "properties": {
          "visibility": {
            "$ref": "#/components/schemas/AutoVisibility",
            "description": "`private`, `users` or `link` (`public`, the gallery, comes later)."
          },
          "shared_with": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Usernames who may view and fork (for `users`; at most 50)."
          },
          "link": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoShareLinkAction",
                "description": "`create` a new link (the old one stops working) or `revoke` it."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "AutoSignalAction": {
        "type": "string",
        "enum": [
          "enter",
          "exit",
          "exit_legs"
        ]
      },
      "AutoSignalInput": {
        "type": "object",
        "description": "`POST /v2/deployments/{id}/signals` (manual and API sources).",
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/AutoSignalAction"
          },
          "hints": {
            "type": [
              "object",
              "null"
            ],
            "description": "Leg or quantity hints the strategy allows."
          },
          "at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the signal was made (RFC 3339); too old is refused."
          }
        },
        "additionalProperties": false
      },
      "AutoStockCheck": {
        "type": "object",
        "description": "One check, in words.",
        "required": [
          "state"
        ],
        "properties": {
          "state": {
            "$ref": "#/components/schemas/AutoStockCheckState"
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The engine's waiting code when not `clear` (`fno_ban`,\n`fno_ban_unknown`, `ex_date`, `corporate_actions_unknown`,\n`circuit`, `circuit_unknown`); null when clear."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why, in plain English; null when clear."
          }
        }
      },
      "AutoStockCheckState": {
        "type": "string",
        "description": "The outcome of one check.",
        "enum": [
          "clear",
          "blocked",
          "unknown"
        ]
      },
      "AutoStockCircuit": {
        "type": "object",
        "description": "The circuit check with the band it read.",
        "required": [
          "state"
        ],
        "properties": {
          "state": {
            "$ref": "#/components/schemas/AutoStockCheckState"
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "`circuit` or `circuit_unknown` when not `clear`; null when clear."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why, in plain English; null when clear."
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Latest price; null when no fresh quote."
          },
          "lower_circuit": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "upper_circuit": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          }
        }
      },
      "AutoStockStatus": {
        "type": "object",
        "description": "One stock's checks today.",
        "required": [
          "name",
          "new_entries",
          "fno_ban",
          "ex_date",
          "corporate_actions",
          "circuit"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "As asked, upper case."
          },
          "new_entries": {
            "$ref": "#/components/schemas/AutoStockCheckState",
            "description": "Worst of the checks: `blocked` when any blocks, else `unknown`\nwhen any is not known, else `clear`. The ban applies to options\nand futures, the circuit band to shares, the ex-date to both."
          },
          "fno_ban": {
            "$ref": "#/components/schemas/AutoStockCheck"
          },
          "ex_date": {
            "$ref": "#/components/schemas/AutoStockCheck"
          },
          "corporate_actions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Today's corporate actions of the stock (empty when none or not\nknown)."
          },
          "circuit": {
            "$ref": "#/components/schemas/AutoStockCircuit"
          }
        }
      },
      "AutoStopAllInput": {
        "type": "object",
        "description": "`POST /v2/strategies/stop-all`.",
        "properties": {
          "exit_now": {
            "type": "boolean",
            "description": "Also close every strategy trade now (positions of `auto.*`\nstrategies only), mains first, hedges last."
          }
        },
        "additionalProperties": false
      },
      "AutoStopInput": {
        "type": "object",
        "description": "`POST /v2/deployments/{id}/stop`.",
        "properties": {
          "exit_now": {
            "type": "boolean",
            "description": "Also close the open trades now, mains first and hedges last."
          }
        },
        "additionalProperties": false
      },
      "AutoStrategy": {
        "type": "object",
        "description": "A strategy with its draft.",
        "required": [
          "id",
          "name",
          "description",
          "tags",
          "display_status",
          "latest_version",
          "revision",
          "visibility",
          "archived",
          "deployments",
          "summary",
          "deployable",
          "blockers",
          "warnings",
          "schema_version",
          "draft",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "display_status": {
            "$ref": "#/components/schemas/AutoDisplayStatus"
          },
          "latest_version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "description": "Send it back on update to refuse overwriting a newer draft.",
            "minimum": 0
          },
          "visibility": {
            "$ref": "#/components/schemas/AutoVisibility",
            "description": "`private`, or (sharing on) `users` / `link`."
          },
          "forked_from": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoForkedFromView"
              },
              {
                "type": "null"
              }
            ]
          },
          "archived": {
            "type": "boolean"
          },
          "deployments": {
            "$ref": "#/components/schemas/AutoDeploymentCounts"
          },
          "summary": {
            "type": "string",
            "description": "The draft in plain English."
          },
          "deployable": {
            "type": "boolean",
            "description": "The draft has no blockers."
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoStrategyProblem"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoStrategyProblem"
            }
          },
          "schema_version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "draft": {
            "type": "object",
            "description": "The draft document, normalized (defaults written out)."
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "update_available": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoUpdateAvailable",
                "description": "On a fork whose source (still shared with you) has a newer saved\nversion. Your draft and deployments never change on their own."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "AutoStrategyProblem": {
        "type": "object",
        "description": "One problem with a document, per field, in plain words.",
        "required": [
          "field",
          "label",
          "message",
          "code",
          "needs_ack"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "Document path, e.g. `spec.legs.items[1].strike.delta`."
          },
          "label": {
            "type": "string",
            "description": "Where in the wizard, e.g. `Leg 2 · Strike`."
          },
          "message": {
            "type": "string",
            "description": "What is wrong, e.g. `delta must be between 0.05 and 0.5 (found 0.8).`."
          },
          "code": {
            "type": "string",
            "description": "Stable code (`unknown_field`, `out_of_range`, `not_available_yet`, ...)."
          },
          "needs_ack": {
            "type": "boolean",
            "description": "A warning that must be acknowledged (by `code`) to deploy."
          }
        }
      },
      "AutoStrategyValidation": {
        "type": "object",
        "description": "What checking a document found.",
        "required": [
          "ok",
          "deployable",
          "schema_version",
          "errors",
          "blockers",
          "warnings",
          "needs_ack",
          "components"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "No errors: the document can be saved."
          },
          "deployable": {
            "type": "boolean",
            "description": "No errors and no blockers: a version of it can be deployed."
          },
          "schema_version": {
            "type": "integer",
            "format": "int32",
            "description": "Format of the checked document (after migration).",
            "minimum": 0
          },
          "migrated_from": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The format it was written in, when older (it was migrated).",
            "minimum": 0
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoStrategyProblem"
            },
            "description": "Refused: fix these to save."
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoStrategyProblem"
            },
            "description": "Saved as a draft, not deployable until resolved."
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoStrategyProblem"
            }
          },
          "needs_ack": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Warning codes to acknowledge at deploy (`unlimited_loss`)."
          },
          "summary": {
            "type": [
              "string",
              "null"
            ],
            "description": "The strategy in plain English."
          },
          "compiled_hash": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hash of the compiled spec (same for any way of writing the same\nstrategy)."
          },
          "components": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "`name@major` of every component used."
          },
          "warm_up": {
            "type": [
              "object",
              "null"
            ],
            "description": "Indicator warm-up (from the engine; null until it is connected)."
          }
        }
      },
      "AutoUnitAnswerView": {
        "type": "object",
        "required": [
          "account"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "accepted": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "null: not known yet (queued)."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AutoUnitLive": {
        "type": "object",
        "description": "Live state of one unit (spec §6.4 `auto_values`).",
        "required": [
          "account",
          "phase",
          "now",
          "values"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "stock": {
            "type": [
              "string",
              "null"
            ],
            "description": "A watchlist deployment: the stock this unit trades; absent\notherwise."
          },
          "phase": {
            "type": "string",
            "description": "Cycle phase (`waiting`, `armed`, ...), or `unknown`."
          },
          "now": {
            "type": "string",
            "description": "What it is doing now, in plain words."
          },
          "values": {
            "type": "object",
            "description": "Indicator values, legs, greeks and P&L as the engine reports them."
          },
          "unit": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoUnitNumbers",
                "description": "The engine's numbers, typed (absent when the engine did not\nanswer or is not connected)."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "AutoUnitNumbers": {
        "type": "object",
        "description": "One unit's live numbers from the engine.",
        "required": [
          "state",
          "cycle",
          "day_pnl",
          "trades_today",
          "legs",
          "conditions",
          "pnl_series"
        ],
        "properties": {
          "state": {
            "type": "string",
            "description": "Engine state (`armed`, `paused`, `done`, ...)."
          },
          "cycle": {
            "type": "integer",
            "format": "int32",
            "description": "Cycle number today (0 before the first).",
            "minimum": 0
          },
          "pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Open trade P&L (₹); null when no trade is open or a price is stale."
          },
          "day_pnl": {
            "type": "number",
            "format": "double",
            "description": "Realized P&L today (₹)."
          },
          "trades_today": {
            "type": "integer",
            "format": "int32",
            "description": "Trades started today.",
            "minimum": 0
          },
          "floor": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Combined stop floor (₹), once raised."
          },
          "legs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoLiveLeg"
            }
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoConditionValue"
            },
            "description": "Values the conditions read now."
          },
          "pnl_series": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoPnlPoint"
            },
            "description": "The open trade's P&L samples, oldest first."
          },
          "breaker": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoBreaker",
                "description": "The safety pause, when tripped."
              },
              {
                "type": "null"
              }
            ]
          },
          "blocked": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why new entries are blocked, when they are."
          },
          "greeks": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StrategyGreeks",
                "description": "Net greeks of the open legs (`delta`: the net delta), from their\nlast prices and the underlying's (Black-Scholes, as\n`GET /v1/strategies/{name}`); absent with `analytics_note` when\nthey cannot be computed, or when no leg is open."
              },
              {
                "type": "null"
              }
            ]
          },
          "analytics_note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why `greeks` (or a leg's `iv_pct`) is missing, in plain English."
          },
          "trades": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoLiveTrade"
            },
            "description": "Each open trade, when the strategy holds several at once\n(`max_open_trades` above 1; absent otherwise). `legs` and `pnl`\nare then every open trade's together."
          }
        }
      },
      "AutoUnitView": {
        "type": "object",
        "required": [
          "account",
          "unit_id",
          "status"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "unit_id": {
            "type": "string",
            "description": "The engine trigger running this account."
          },
          "status": {
            "$ref": "#/components/schemas/AutoDeploymentStatus"
          },
          "status_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "stock": {
            "type": [
              "string",
              "null"
            ],
            "description": "A watchlist deployment: the stock this unit trades (`RELIANCE`);\nabsent otherwise."
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ],
            "description": "With `stock`: its exchange (`NSE`, `BSE`)."
          }
        }
      },
      "AutoUniverse": {
        "type": "object",
        "description": "A watchlist deployment's universe as resolved at deploy: one unit per\n(account, stock); each unit checks its stock against the watchlist\nagain before every new trade (waiting codes `watchlist_*`).",
        "required": [
          "watchlist_id",
          "stocks",
          "skipped"
        ],
        "properties": {
          "watchlist_id": {
            "type": "string"
          },
          "stocks": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Stocks with a unit (`NAME`)."
          },
          "skipped": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutoUniverseSkipped"
            },
            "description": "Members that got no unit."
          }
        }
      },
      "AutoUniverseSkipped": {
        "type": "object",
        "description": "A watchlist member that got no unit at deploy, and why.",
        "required": [
          "instrument_token",
          "reason"
        ],
        "properties": {
          "instrument_token": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The stock's symbol when the instrument list knows it."
          },
          "reason": {
            "type": "string",
            "description": "`not_listed` (not in the instrument list), `not_equity` (not an NSE\n/ BSE cash equity) or `not_allowed` (not on the list of stocks\nautomated strategies may trade); other values may be added."
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "AutoUpdateAvailable": {
        "type": "object",
        "description": "On a fork: the source has a newer saved version the caller may see.",
        "required": [
          "version",
          "forked_version",
          "message"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "format": "int32",
            "description": "The source's newest saved version.",
            "minimum": 0
          },
          "forked_version": {
            "type": "integer",
            "format": "int32",
            "description": "The fork's pinned version.",
            "minimum": 0
          },
          "message": {
            "type": "string",
            "description": "`A newer version (v4) from @prat… is available.`"
          }
        }
      },
      "AutoValidateInput": {
        "type": "object",
        "description": "`POST /v2/strategies/validate`: a document as for create, and\noptionally where it will be deployed (account rules come back as\nwarnings, in the words the deploy refuses with).",
        "required": [
          "document"
        ],
        "properties": {
          "document": {
            "description": "The portable document: an object, or its JSON or YAML text."
          },
          "definition": {
            "type": [
              "object",
              "null"
            ],
            "description": "Instead of `document`: the definition (`spec`) alone."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "With `definition`."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "With `definition`."
          },
          "tags": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "With `definition`."
          },
          "revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Ignored (accepted as for update).",
            "minimum": 0
          },
          "mode": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoModeInput",
                "description": "Deploy mode to check against (default `paper`)."
              },
              {
                "type": "null"
              }
            ]
          },
          "accounts": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/AutoAccountInput"
            },
            "description": "Accounts to check against (as for deploy); none: account rules are\nleft for the deploy."
          }
        },
        "additionalProperties": false
      },
      "AutoVisibility": {
        "type": "string",
        "description": "Who may see a strategy (§24.1). Only `private` is writable in phase A.",
        "enum": [
          "private",
          "users",
          "link",
          "public",
          "unknown"
        ]
      },
      "BacktestBand": {
        "type": "object",
        "description": "5–95 % band of final equity from a bootstrap of daily returns.",
        "required": [
          "p5",
          "p50",
          "p95"
        ],
        "properties": {
          "p5": {
            "type": "number",
            "format": "double"
          },
          "p50": {
            "type": "number",
            "format": "double"
          },
          "p95": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "BacktestChargesPreset": {
        "type": "string",
        "description": "Which charges a backtest applies.",
        "enum": [
          "india",
          "zero"
        ]
      },
      "BacktestCosts": {
        "type": "object",
        "description": "Costs a backtest applies.",
        "properties": {
          "charges": {
            "$ref": "#/components/schemas/BacktestChargesPreset"
          },
          "slippage_bps": {
            "type": "number",
            "format": "double",
            "description": "Against every fill (basis points)."
          },
          "spread_proxy_bps": {
            "type": "number",
            "format": "double",
            "description": "Spread assumed for a series without bid / ask (basis points)."
          }
        }
      },
      "BacktestCostsInput": {
        "type": "object",
        "description": "Costs to apply; defaults: Indian charges, 2 bps slippage.",
        "properties": {
          "charges": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BacktestChargesPreset"
              },
              {
                "type": "null"
              }
            ]
          },
          "slippage_bps": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Slippage against every fill, basis points (0 to 200)."
          }
        },
        "additionalProperties": false
      },
      "BacktestCounts": {
        "type": "object",
        "description": "Result rows stored with a finished job.",
        "required": [
          "trades",
          "cycles"
        ],
        "properties": {
          "trades": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "cycles": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "BacktestCycleRow": {
        "type": "object",
        "description": "One cycle and its journey.",
        "required": [
          "n",
          "day",
          "cycle",
          "charges",
          "steps"
        ],
        "properties": {
          "n": {
            "type": "integer",
            "format": "int32",
            "description": "1-based, in time order.",
            "minimum": 0
          },
          "day": {
            "type": "string"
          },
          "cycle": {
            "type": "integer",
            "format": "int32",
            "description": "The cycle number of its day.",
            "minimum": 0
          },
          "opened_at_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "closed_at_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "exit_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Net of charges; absent while the cycle never filled."
          },
          "charges": {
            "type": "number",
            "format": "double"
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BacktestCycleStep"
            }
          }
        }
      },
      "BacktestCycleStep": {
        "type": "object",
        "description": "One engine step of a cycle (its journey).",
        "required": [
          "at_ms",
          "code",
          "phase",
          "text"
        ],
        "properties": {
          "at_ms": {
            "type": "integer",
            "format": "int64"
          },
          "code": {
            "type": "string"
          },
          "phase": {
            "type": "string"
          },
          "text": {
            "type": "string",
            "description": "One plain-English sentence."
          }
        }
      },
      "BacktestEquityPoint": {
        "type": "object",
        "description": "Equity at one day's close.",
        "required": [
          "day",
          "equity",
          "pnl",
          "drawdown"
        ],
        "properties": {
          "day": {
            "type": "string"
          },
          "equity": {
            "type": "number",
            "format": "double"
          },
          "pnl": {
            "type": "number",
            "format": "double"
          },
          "drawdown": {
            "type": "number",
            "format": "double",
            "description": "Below the running peak (₹, positive)."
          }
        }
      },
      "BacktestInput": {
        "type": "object",
        "description": "Start a backtest of a saved version.",
        "required": [
          "strategy_id",
          "from",
          "to"
        ],
        "properties": {
          "strategy_id": {
            "type": "string"
          },
          "version": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The version to test; the latest saved one when absent.",
            "minimum": 0
          },
          "from": {
            "type": "string",
            "description": "First day (`YYYY-MM-DD`, IST).",
            "example": "2026-07-01"
          },
          "to": {
            "type": "string",
            "description": "Last day, inclusive; before today. `from` to `to` covers at most\n1098 days (3 years), both included.",
            "example": "2026-09-30"
          },
          "capital": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Virtual capital (₹); default 5,00,000."
          },
          "costs": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BacktestCostsInput"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "BacktestLabels": {
        "type": "object",
        "description": "How the result must be read.",
        "required": [
          "estimated",
          "text",
          "notes"
        ],
        "properties": {
          "estimated": {
            "type": "boolean",
            "description": "Some price was modelled, not traded."
          },
          "text": {
            "type": "string",
            "description": "The sentence shown with every result."
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Further plain-English caveats."
          }
        }
      },
      "BacktestMetrics": {
        "type": "object",
        "description": "Performance metrics from ferro over daily equity (absent when the run\nhas fewer than two days, or a value is undefined).",
        "properties": {
          "total_return": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "cagr": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "annualized_vol": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "sharpe": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "sortino": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "calmar": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "max_drawdown": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Fraction (0.08 = 8 %), from daily closes."
          },
          "profit_factor": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          }
        }
      },
      "BacktestProgress": {
        "type": "object",
        "description": "Days replayed so far.",
        "required": [
          "done",
          "total"
        ],
        "properties": {
          "done": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "BacktestPurpose": {
        "type": "string",
        "description": "What a fill was for.",
        "enum": [
          "entry",
          "exit"
        ]
      },
      "BacktestSourceRow": {
        "type": "object",
        "description": "Where one series came from.",
        "required": [
          "series",
          "symbol",
          "source",
          "estimated"
        ],
        "properties": {
          "series": {
            "type": "string",
            "description": "`underlying`, `vix`, `options`, `futures` or a watched name."
          },
          "symbol": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "The history source id, or `estimator`."
          },
          "estimated": {
            "type": "boolean"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "BacktestStatus": {
        "type": "string",
        "description": "Where a backtest is.",
        "enum": [
          "queued",
          "running",
          "done",
          "failed",
          "cancelled",
          "unknown"
        ]
      },
      "BacktestSummary": {
        "type": "object",
        "description": "The headline numbers.",
        "required": [
          "capital",
          "final_equity",
          "net_pnl",
          "charges",
          "cycles",
          "trades",
          "wins",
          "losses",
          "max_drawdown",
          "max_drawdown_pct",
          "days",
          "days_traded"
        ],
        "properties": {
          "capital": {
            "type": "number",
            "format": "double"
          },
          "final_equity": {
            "type": "number",
            "format": "double"
          },
          "net_pnl": {
            "type": "number",
            "format": "double",
            "description": "After charges."
          },
          "charges": {
            "type": "number",
            "format": "double"
          },
          "cycles": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "trades": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "wins": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "losses": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "win_rate": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Winning cycles over closed cycles (0 to 1); absent with none."
          },
          "best_cycle": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "worst_cycle": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "avg_cycle": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "max_drawdown": {
            "type": "number",
            "format": "double",
            "description": "Worst fall from a peak of equity, minute by minute (₹, positive)."
          },
          "max_drawdown_pct": {
            "type": "number",
            "format": "double",
            "description": "The same as a fraction of that peak."
          },
          "days": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "days_traded": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "metrics": {
            "$ref": "#/components/schemas/BacktestMetrics"
          },
          "band": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BacktestBand"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "BacktestTradeRow": {
        "type": "object",
        "description": "One simulated fill.",
        "required": [
          "n",
          "day",
          "cycle",
          "leg_id",
          "symbol",
          "side",
          "qty",
          "price",
          "charges",
          "at_ms",
          "purpose",
          "estimated"
        ],
        "properties": {
          "n": {
            "type": "integer",
            "format": "int32",
            "description": "1-based, in time order.",
            "minimum": 0
          },
          "day": {
            "type": "string"
          },
          "cycle": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "leg_id": {
            "type": "string"
          },
          "symbol": {
            "type": "string"
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "qty": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "price": {
            "type": "number",
            "format": "double"
          },
          "charges": {
            "type": "number",
            "format": "double"
          },
          "at_ms": {
            "type": "integer",
            "format": "int64"
          },
          "purpose": {
            "$ref": "#/components/schemas/BacktestPurpose"
          },
          "estimated": {
            "type": "boolean",
            "description": "The price is modelled (no history of this contract)."
          }
        }
      },
      "BasketInput": {
        "type": "object",
        "description": "Create / replace request body.",
        "required": [
          "name",
          "legs"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name, 1-60 characters after trimming."
          },
          "legs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BasketLeg"
            },
            "description": "Legs, 1-20."
          },
          "prefs": {
            "description": "Free-form client preferences, at most 2048 serialized bytes."
          },
          "strategy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Strategy to place this basket's orders under (send it as each\norder's `strategy` on `POST /v1/orders`): at most 64 letters,\ndigits, `_`, `.`, `:` or `-`.",
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_.:-]{1,64}$"
          }
        },
        "additionalProperties": false
      },
      "BasketLeg": {
        "type": "object",
        "description": "One saved order leg.",
        "required": [
          "underlying",
          "instrument",
          "side",
          "lots",
          "order_type"
        ],
        "properties": {
          "underlying": {
            "type": "string",
            "description": "Underlying symbol, e.g. `NIFTY`."
          },
          "instrument": {
            "$ref": "#/components/schemas/LegInstrument",
            "description": "Instrument kind."
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "description": "Expiry date (`YYYY-MM-DD`); required for options and futures."
          },
          "option_type": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OptionKind",
                "description": "`CE` or `PE`; required for options."
              },
              {
                "type": "null"
              }
            ]
          },
          "strike": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Strike price; required (positive, finite) for options."
          },
          "side": {
            "$ref": "#/components/schemas/Side",
            "description": "Buy or sell."
          },
          "lots": {
            "type": "integer",
            "format": "int32",
            "description": "Number of lots, at least 1.",
            "minimum": 0
          },
          "order_type": {
            "$ref": "#/components/schemas/OrderType",
            "description": "Order type."
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Limit / trigger price, when the order type needs one."
          },
          "instrument_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "Resolved instrument token, if known."
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "BracketOrderKind": {
        "type": "string",
        "description": "`BO` (bracket: entry + stop-loss + target) or `CO` (cover: entry +\nstop-loss).",
        "enum": [
          "BO",
          "CO"
        ]
      },
      "BracketRequest": {
        "type": "object",
        "description": "A bracket or cover order in one account. Legs are absolute prices on\nthe tick grid, on the right side of the entry (the limit price, or LTP\nfor a market entry): a BUY needs stop-loss < entry < target, a SELL the\nreverse.",
        "required": [
          "account",
          "instrument_token",
          "kind",
          "side",
          "order_type",
          "product",
          "quantity",
          "stop_loss"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Account id (see `/v1/accounts`)."
          },
          "instrument_token": {
            "type": "string",
            "description": "Instrument id (see `/v1/instruments`)."
          },
          "kind": {
            "$ref": "#/components/schemas/BracketOrderKind"
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "order_type": {
            "$ref": "#/components/schemas/OrderType",
            "description": "Entry order type: `LIMIT` or `MARKET`."
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units, or lots when `qty_is_in_lot`. Units round down to whole lots; under one lot is refused.",
            "minimum": 0
          },
          "qty_is_in_lot": {
            "type": "boolean",
            "description": "`quantity` counts lots, not units."
          },
          "price": {
            "type": "number",
            "format": "double",
            "description": "Entry limit price (`LIMIT`); 0 or absent for `MARKET`."
          },
          "stop_loss": {
            "type": "number",
            "format": "double",
            "description": "Stop-loss price."
          },
          "target": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Target price: required for `BO`, not allowed for `CO`."
          },
          "trailing_stop_loss": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Trailing stop-loss step, in points (on the tick grid)."
          },
          "client_tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the entry (1-64 letters, digits, `_`, `.`,\n`:` or `-`), echoed in the answer and kept on the order:\n`GET /v1/orders/{client_tag}` finds it."
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "Chase": {
        "type": "object",
        "description": "Chase settings on a protected market order (MARKET, or LIMIT at 0,\nwith `market_protection` on). While the order is OPEN or PARTIALLY\nFILLED at the broker, every `every_ms` its limit is re-priced the way\nmarket protection priced it (a band past the best ask for a BUY, the\nbest bid for a SELL, the last price when that side is unknown), only\never further toward the market (up for a BUY, down for a SELL), with\nthe full original quantity. It stops when the order fills, is\ncancelled or rejected, when you modify or cancel it yourself, after\n`attempts` re-prices, or when the next limit would be more than\n`max_slippage_pct` past the first one; then `on_give_up` applies.\nA missing or stale quote, or the account's order rate limit, skips\nthat re-price (it still counts). Each re-price and the stop are in the\nactivity log (with the limits sent, never market prices).",
        "properties": {
          "every_ms": {
            "type": "integer",
            "format": "int64",
            "description": "Milliseconds between re-prices (200-5000, default 500).",
            "default": 500,
            "maximum": 5000,
            "minimum": 200
          },
          "attempts": {
            "type": "integer",
            "format": "int32",
            "description": "Most re-prices (1-10, default 3).",
            "default": 3,
            "maximum": 10,
            "minimum": 1
          },
          "max_slippage_pct": {
            "type": "number",
            "format": "double",
            "description": "Furthest the limit may move from the first limit sent, in percent\n(above 0, at most 20, default 5).",
            "default": 5,
            "maximum": 20
          },
          "on_give_up": {
            "$ref": "#/components/schemas/OnGiveUp",
            "description": "`rest` (default) leaves the order at its last limit; `cancel`\ncancels it."
          }
        },
        "additionalProperties": false
      },
      "ChaseOutcome": {
        "type": "string",
        "description": "`running` (still re-pricing), `filled`, `gave_up` (stopped at its\nattempts or slippage bound and left resting, or its cancel failed),\n`cancelled` (stopped and cancelled as asked) or `stopped` (the order\nwas changed, cancelled or rejected outside the chase).",
        "enum": [
          "running",
          "filled",
          "gave_up",
          "cancelled",
          "stopped"
        ]
      },
      "ChasePlan": {
        "type": "object",
        "description": "A chase as the engine runs it: the settings and the protected limit\nthe order was first sent with.",
        "required": [
          "every_ms",
          "attempts",
          "max_slippage_pct",
          "on_give_up",
          "first_price"
        ],
        "properties": {
          "every_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "attempts": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "max_slippage_pct": {
            "type": "number",
            "format": "double"
          },
          "on_give_up": {
            "$ref": "#/components/schemas/OnGiveUp"
          },
          "first_price": {
            "type": "number",
            "format": "double",
            "description": "The limit the order was first sent with."
          }
        }
      },
      "ChaseProgress": {
        "type": "object",
        "description": "How far a chase got: re-price attempts used and how it ended.",
        "required": [
          "steps",
          "outcome"
        ],
        "properties": {
          "steps": {
            "type": "integer",
            "format": "int32",
            "description": "Re-price attempts used so far (of the plan's `attempts`).",
            "minimum": 0
          },
          "outcome": {
            "$ref": "#/components/schemas/ChaseOutcome"
          }
        }
      },
      "ConditionCheckOn": {
        "type": "string",
        "description": "How often the condition is checked.",
        "enum": [
          "close",
          "tick"
        ]
      },
      "ConditionPlace": {
        "type": "string",
        "description": "Which part of the strategy the condition belongs to.",
        "enum": [
          "entry",
          "exit"
        ]
      },
      "ConditionUnderlying": {
        "type": "object",
        "description": "The underlying as the document's `spec.underlying` names it.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "`NIFTY`, `BANKNIFTY`, `RELIANCE`, ..."
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ],
            "description": "`NFO` (default), `BFO`, `NSE`, `BSE`."
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "What `u` watches: `spot` (default: the index or stock) or `future`\n(the nearest future)."
          }
        },
        "additionalProperties": false
      },
      "ConditionValue": {
        "type": "object",
        "description": "One indicator value the condition reads.",
        "required": [
          "expr",
          "label",
          "text",
          "value",
          "closed",
          "live",
          "ready",
          "warm_bars_left",
          "compare"
        ],
        "properties": {
          "expr": {
            "type": "string",
            "description": "As written: `u.rsi(14, '15m')`."
          },
          "label": {
            "type": "string",
            "description": "`RSI(14) · NIFTY 50 · 15m`."
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "description": "`RSI(14,15m) = 62.3`; null while it is not known."
          },
          "value": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The value the condition reads now: the last closed candle's\n(`on: close`) or the forming candle's (`on: tick`)."
          },
          "closed": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The last closed candle's value."
          },
          "live": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The forming candle's value (null outside market hours)."
          },
          "ready": {
            "type": "boolean",
            "description": "Enough candles for the value to match a chart."
          },
          "warm_bars_left": {
            "type": "integer",
            "format": "int32",
            "description": "Closed candles still needed.",
            "minimum": 0
          },
          "compare": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TriggerV2IndicatorCompare",
                "description": "How far it is from the condition's level, when it compares with a\nnumber."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ConditionValuesInput": {
        "type": "object",
        "description": "A builder condition to read now.",
        "required": [
          "when",
          "underlying"
        ],
        "properties": {
          "when": {
            "type": "string",
            "description": "The condition as the document writes it: `u.rsi(14, '15m') > 60`,\n`crosses_above(u.ema(9, '5m'), u.ema(21, '5m'))`."
          },
          "on": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ConditionCheckOn",
                "description": "`close` or `tick`; absent: `close` when it reads an indicator, else\n`tick` (as the document's default)."
              },
              {
                "type": "null"
              }
            ]
          },
          "place": {
            "$ref": "#/components/schemas/ConditionPlace"
          },
          "underlying": {
            "$ref": "#/components/schemas/ConditionUnderlying"
          },
          "watch": {
            "type": "object",
            "description": "Other watched names and their document symbols\n(`{\"bank\": \"NSE_INDEX:NIFTY BANK\"}`, `@future(NIFTY, 0)`); `u` may\noverride the underlying's default."
          }
        },
        "additionalProperties": false
      },
      "ConnectionLimits": {
        "type": "object",
        "description": "What an `mcp`-audience partner connection may do on top of its scopes\n(spec §6.5). Stored on the connection; set on the consent screen.",
        "required": [
          "trading",
          "accounts"
        ],
        "properties": {
          "trading": {
            "type": "boolean",
            "description": "`false`: a read-only connection."
          },
          "accounts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Accounts it may trade or deploy on (none until the user picks)."
          },
          "paper_only": {
            "type": "boolean",
            "description": "Act only on paper-broker accounts (orders, GTT, triggers and\ndeployments alike)."
          },
          "max_order_value": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Largest order value, in whole rupees.",
            "minimum": 0
          },
          "max_orders_per_day": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Orders it may place per IST trading day.",
            "minimum": 0
          },
          "live_strategies": {
            "type": "boolean",
            "description": "May deploy live / go live (needs `paper_only` off)."
          },
          "max_deployments": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Most of the user's active deployments it may have started.",
            "minimum": 0
          }
        }
      },
      "ConvertRequest": {
        "type": "object",
        "description": "Move (part of) an open position to another product.",
        "required": [
          "account",
          "instrument_token",
          "side",
          "quantity",
          "from",
          "to"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Account id holding the position."
          },
          "instrument_token": {
            "type": "string",
            "description": "Instrument id of the position."
          },
          "side": {
            "$ref": "#/components/schemas/Side",
            "description": "Side of the open position (BUY for long, SELL for short)."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units to convert (greater than 0).",
            "minimum": 0
          },
          "from": {
            "$ref": "#/components/schemas/Product",
            "description": "The position's current product."
          },
          "to": {
            "$ref": "#/components/schemas/Product",
            "description": "The product to move it to (different from `from`)."
          },
          "overnight": {
            "type": "boolean",
            "description": "The position was carried from a previous session (not opened\ntoday)."
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "CreateTriggerV2Request": {
        "type": "object",
        "description": "A new v2 trigger. Its id is made by the server.",
        "required": [
          "account",
          "kind",
          "spec"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Account id (see `/v1/accounts`)."
          },
          "kind": {
            "$ref": "#/components/schemas/TriggerV2Kind"
          },
          "strategy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Strategy the trigger belongs to (risk limits at strategy level)."
          },
          "legs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2LegRequest"
            }
          },
          "spec": {
            "type": "object",
            "description": "Kind-specific rules, conditions written in the CEL subset\n(`ltp <= 120 && bid_qty > ask_qty`). Checked before anything is\nsent: an unknown field or a condition that does not compile is a 422."
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ],
            "description": "RFC 3339; the trigger expires then."
          },
          "watch": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2WatchRequest"
            },
            "description": "Instruments the conditions read but the trigger never trades (at\nmost 3), for indicator conditions: `[{\"name\": \"nifty\", \"symbol\":\n\"<instrument token>\"}]` lets a condition say `nifty.rsi(14, '5m')`\nor `nifty.ltp`. Names are `[a-z][a-z0-9_]{0,15}`, not a variable or\nfunction name. Each counts toward the distinct-instrument limit.\nFixed at create (a change keeps them). Refused (`422`) while\nindicator conditions are not available."
          },
          "route": {
            "$ref": "#/components/schemas/RequestedRoute",
            "description": "Where a `bracket` protecting a held position lives. `auto`\n(default) puts a simple protection (one leg already held, a plain\nprice stop-loss and / or target, nothing else) at the broker with\nthe rules of `POST /v1/triggers`: a broker GTT for a positional\nproduct where the broker has GTTs (a one-leg-GTT broker holds the\nstop-loss, a server-side trigger the target), a broker stop-loss\norder for an intraday (`MIS`) position where the broker's stop\norders are proven; anything else is a v2 trigger the server\nevaluates. `trigger` always makes the v2 trigger (the earlier\nbehaviour). `gtt` / `stop_order` ask for that route and are refused\n(422) where `auto` would not take it; `bracket` / `cover` are refused."
          },
          "group": {
            "type": [
              "string",
              "null"
            ],
            "description": "A label of your own (1-64 characters), returned on reads and\nfilterable on list (`?group=`): triggers made as one set (several\ntargets as separate triggers) show as one. Free-form; nothing else\nreads it."
          }
        },
        "additionalProperties": false
      },
      "DependsOnPartial": {
        "type": "string",
        "description": "What a dependent order does when its parent filled only part of its\nquantity by the end of the wait.",
        "enum": [
          "reject",
          "filled_qty"
        ]
      },
      "ErrorBody": {
        "type": "object",
        "description": "What went wrong.",
        "required": [
          "code",
          "message",
          "field"
        ],
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation; may change, never parse it."
          },
          "field": {
            "type": [
              "string",
              "null"
            ],
            "description": "The offending input, e.g. `orders[0].price`; null when the error is\nnot about one field."
          },
          "retry_after_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Rate limits (`rate_limited`): milliseconds until a retry may\nsucceed (also sent as the `Retry-After` header, in seconds). Absent\non other errors.",
            "minimum": 0
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why a refusal with a general `code` happened. `connection_limits`:\na `forbidden` from the limits the user set on this app's connection\n(accounts, paper only, order value, orders a day, strategies); the\ncredential is fine, only this action is refused. Absent on other\nerrors; more values may be added."
          }
        }
      },
      "ErrorCode": {
        "type": "string",
        "description": "Stable error code: branch on this, never on the message.\n\n| code | HTTP status | meaning |\n|---|---|---|\n| `malformed_json` | 400 | The body is not JSON, or does not fit the request shape (unknown or missing fields, wrong types). |\n| `invalid_query` | 400 | The query string does not fit the route's parameters. |\n| `bad_request` | 400 | The request could not be read before reaching the route (e.g. an unreadable path segment); `message` says what. |\n| `idempotency_key_required` | 400 | The `Idempotency-Key` header is missing (use a new UUID per order request). |\n| `invalid_idempotency_key` | 400 | The `Idempotency-Key` header is not 1-128 printable characters. |\n| `unauthorized` | 401 | No credential, or the credential is invalid, expired or revoked. |\n| `forbidden` | 403 | The credential may not use this route (missing scope, app-session-only route, IP not allowed). |\n| `own_session_required` | 403 | Credentials can only be created from the user's own signed-in session. |\n| `live_not_enabled` | 403 | Live deployments need the `strategies_live` scope and a broker open for live automated strategies. |\n| `oms_not_enabled` | 403 | Order management is not enabled for this user. |\n| `not_shared` | 403 | That user has not shared this data with the caller. |\n| `account_not_found` | 404 | No linked broker account with this id for the caller. |\n| `instrument_not_found` | 404 | No instrument with this token (unknown or expired). |\n| `basket_not_found` | 404 | No saved basket with this id for the caller. |\n| `watchlist_not_found` | 404 | No watchlist with this id for the caller. |\n| `trigger_not_found` | 404 | No trigger with this id for the caller. |\n| `gone` | 410 | The route has been retired (after its `Sunset` date); `message` names its replacement. |\n| `api_key_not_found` | 404 | No API key with this id for the caller. |\n| `connection_not_found` | 404 | No connected partner app with this client id. |\n| `unknown_app` | 404 | Unknown or disabled partner app. |\n| `endpoint_not_found` | 404 | No signal URL with this id (or this secret) for the caller. |\n| `webhook_not_found` | 404 | No webhook with this id for the caller. |\n| `telegram_not_linked` | 404 | Telegram is not connected for the caller; start a link first. |\n| `activity_not_found` | 404 | No activity record with this id for the caller. |\n| `strategy_not_found` | 404 | No automated strategy with this id for the caller. |\n| `version_not_found` | 404 | No such version of the strategy. |\n| `shared_not_found` | 404 | Nothing is shared with the caller here: the share was stopped or the link revoked, or it never existed. |\n| `listing_not_found` | 404 | No such gallery listing for the caller: withdrawn, taken down, not approved yet (and not theirs), or it never existed. |\n| `deployment_not_found` | 404 | No deployment with this id for the caller. |\n| `backtest_not_found` | 404 | No backtest with this id for the caller (results are kept 30 days). |\n| `schema_not_found` | 404 | No such strategy document format on this server. |\n| `order_not_found` | 404 | No order with this id (broker order id or `order_tag`) in the caller's order book today. |\n| `request_in_progress` | 409 | A request with this `Idempotency-Key` is still being processed. |\n| `trigger_busy` | 409 | The trigger changed while it was being updated; retry. |\n| `trigger_fired` | 409 | The trigger already fired; its exit is being handled. |\n| `broker_held` | 409 | The protection is held by the broker; change the broker order instead. |\n| `watchlist_name_taken` | 409 | The caller already has a watchlist with this name. |\n| `webhook_limit_reached` | 409 | The webhook limit is reached; delete one first. |\n| `conflict` | 409 | A partner app's webhook was changed at the same time as this request; retry. |\n| `already_flat` | 409 | There is no open position to exit for this account, instrument and product. |\n| `stale_quote` | 422 | This order cannot be sent at market: there is no price for the instrument at all (a price that is not recent is used: the order goes out as a LIMIT protected from it), or the best bid / ask is too far from the last traded price (a thin book); the message says which. Place a LIMIT order instead. Nothing was sent to the broker. |\n| `bracket_position` | 409 | The position is held by a bracket / cover order: exit it with `DELETE /v1/orders/bracket/{order_id}`, which squares it off at the broker. Nothing was placed. |\n| `position_protected` | 409 | The order is a (partly) filled bracket / cover entry: cancelling it would cancel the live stop-loss / target legs of its position. Send `legs=true` to do it anyway. |\n| `order_not_open` | 409 | The order is already finished (filled, cancelled or rejected), so there is nothing to modify or cancel. Nothing was sent to the broker. |\n| `ambiguous_order` | 409 | The id names orders in more than one account (or several orders); `message` lists the accounts. Add `account=` to choose one. |\n| `strategy_busy` | 409 | The strategy changed since it was read (or is archived); read it again and retry. |\n| `strategy_in_use` | 409 | The strategy has a deployment that is not stopped; stop it first. |\n| `deployment_finished` | 409 | The deployment is stopped; deploy the strategy again to run it. |\n| `deployment_limit_reached` | 409 | The most deployments that may run at once are running; stop one first. |\n| `backtest_limit_reached` | 409 | The most backtests that may be queued or running at once, or started today, are reached. |\n| `backtest_finished` | 409 | The backtest has already finished (done, failed or cancelled); nothing to cancel. |\n| `no_saved_version` | 409 | A strategy is shared as a saved version, never its draft: save a version first. |\n| `not_enough_cycles` | 409 | A gallery listing needs at least 20 finished trades of the version in the author's runs with the chosen badge. |\n| `listing_pending` | 409 | A listing of this strategy is already waiting for review; withdraw it first. |\n| `purchase_required` | 409 | A paid gallery template must be bought before it is copied. |\n| `insufficient_credits` | 409 | Not enough platform credits for this purchase; nothing was charged. |\n| `purchase_failed` | 409 | A gallery purchase did not complete and nothing was charged; retry with a new Idempotency-Key. |\n| `purchase_in_progress` | 409 | A gallery purchase with this Idempotency-Key is still being made; retry with the same key. |\n| `not_flat` | 409 | A signal strategy's mode can change only when flat: a position held by the signal strategy, or an open trade on the deployment, must close first. Nothing was changed. |\n| `payload_too_large` | 413 | The request body is larger than the server accepts; send less (e.g. fewer orders per request). |\n| `invalid_request` | 422 | The request is well-formed but not valid; `field` names the input. |\n| `invalid_document` | 422 | The strategy document has problems; `message` lists each (where in the wizard, what is wrong) and `field` names the first. |\n| `not_deployable` | 422 | The strategy version cannot be deployed yet (a component or option not released, or an underlying not open); `message` says why. |\n| `acknowledgement_required` | 422 | A warning must be acknowledged to deploy (e.g. `unlimited_loss`): add its code to `acknowledge`. |\n| `idempotency_key_reused` | 422 | This `Idempotency-Key` was already used with a different request. |\n| `partial_lot_position` | 422 | The open position (less exits already working) is not a whole number of lots, so it cannot be fully exited through this route; `message` says how much remains. |\n| `not_supported_by_broker` | 422 | The account's broker does not offer this (e.g. margin calculation, GTT listing, or GTT on BFO / intraday at Pocketful). |\n| `gtt_refused` | 422 | The broker refused the GTT protecting a position and `rules.fallback` is `reject`: nothing was created. |\n| `archive_day_too_large` | 422 | That day's archived activity is too large to serve at once. |\n| `invalid_client` | 422 | OAuth: unknown partner app, or wrong client credentials. |\n| `invalid_grant` | 422 | OAuth: the authorization code or refresh token is invalid, used or expired. |\n| `invalid_client_metadata` | 400 | OAuth client registration: a client metadata value is not accepted (e.g. a `client_name` that is not printable ASCII). |\n| `unsupported_grant_type` | 400 | OAuth token endpoint: `grant_type` is missing or not supported. |\n| `slow_down` | 429 | OAuth token endpoint: too many failed attempts from this source; retry after `Retry-After`. |\n| `invalid_scope` | 422 | OAuth: a requested scope is unknown or not allowed for the app. |\n| `invalid_target` | 422 | OAuth (RFC 8707): `resource` is the MCP server, which only clients registered with `POST /v1/oauth/register` may connect through. |\n| `temporarily_unavailable` | 503 | OAuth: the authorization server is temporarily unavailable. |\n| `rate_limited` | 429 | 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). |\n| `broker_refused` | 502 | The broker refused the change. |\n| `broker_outcome_unknown` | 504 | The broker did not answer in time: it may or may not have applied the change. Check before retrying. |\n| `service_unavailable` | 503 | A dependency is temporarily unavailable, or the feature is off on this server; retry later. |\n| `credits_unavailable` | 503 | Platform credits can't be reached right now; nothing was charged. Retry. |\n| `instruments_unavailable` | 503 | The instrument master is not loaded yet; retry shortly. |\n| `trigger_worker_down` | 503 | No trigger exit worker is running; nothing was created. |\n| `webhooks_disabled` | 503 | Webhooks are not enabled on this server. |\n| `notifications_disabled` | 503 | Notifications are not enabled on this server. |\n| `unavailable` | 503 | Stream only: live updates are unavailable; reconnect. |",
        "enum": [
          "malformed_json",
          "invalid_query",
          "bad_request",
          "idempotency_key_required",
          "invalid_idempotency_key",
          "unauthorized",
          "forbidden",
          "own_session_required",
          "live_not_enabled",
          "oms_not_enabled",
          "not_shared",
          "account_not_found",
          "instrument_not_found",
          "basket_not_found",
          "watchlist_not_found",
          "trigger_not_found",
          "gone",
          "api_key_not_found",
          "connection_not_found",
          "unknown_app",
          "endpoint_not_found",
          "webhook_not_found",
          "telegram_not_linked",
          "activity_not_found",
          "strategy_not_found",
          "version_not_found",
          "shared_not_found",
          "listing_not_found",
          "deployment_not_found",
          "backtest_not_found",
          "schema_not_found",
          "order_not_found",
          "request_in_progress",
          "trigger_busy",
          "trigger_fired",
          "broker_held",
          "watchlist_name_taken",
          "webhook_limit_reached",
          "conflict",
          "already_flat",
          "stale_quote",
          "bracket_position",
          "position_protected",
          "order_not_open",
          "ambiguous_order",
          "strategy_busy",
          "strategy_in_use",
          "deployment_finished",
          "deployment_limit_reached",
          "backtest_limit_reached",
          "backtest_finished",
          "no_saved_version",
          "not_enough_cycles",
          "listing_pending",
          "purchase_required",
          "insufficient_credits",
          "purchase_failed",
          "purchase_in_progress",
          "not_flat",
          "payload_too_large",
          "invalid_request",
          "invalid_document",
          "not_deployable",
          "acknowledgement_required",
          "idempotency_key_reused",
          "partial_lot_position",
          "not_supported_by_broker",
          "gtt_refused",
          "archive_day_too_large",
          "invalid_client",
          "invalid_grant",
          "invalid_client_metadata",
          "unsupported_grant_type",
          "slow_down",
          "invalid_scope",
          "invalid_target",
          "temporarily_unavailable",
          "rate_limited",
          "broker_refused",
          "broker_outcome_unknown",
          "service_unavailable",
          "credits_unavailable",
          "instruments_unavailable",
          "trigger_worker_down",
          "webhooks_disabled",
          "notifications_disabled",
          "unavailable"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "description": "Failed request: `data` is null; `error.code` is stable to branch on,\n`error.message` is for people.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/ErrorStatus"
          },
          "data": {
            "type": "null"
          },
          "error": {
            "$ref": "#/components/schemas/ErrorBody"
          }
        }
      },
      "ErrorStatus": {
        "type": "string",
        "description": "Always `error`.",
        "enum": [
          "error"
        ]
      },
      "ExitRequest": {
        "type": "object",
        "description": "The position to close.",
        "required": [
          "account",
          "instrument_token",
          "product"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Account id holding the position."
          },
          "instrument_token": {
            "type": "string",
            "description": "Instrument id of the position."
          },
          "product": {
            "$ref": "#/components/schemas/Product",
            "description": "The position's product."
          },
          "market_protection": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Market protection on the exit order (default `true`): it is sent as\na LIMIT a small band past the last traded price instead of a bare\nMARKET. On an illiquid contract that last trade may be stale, so the\nprotected LIMIT can rest unfilled in the order book; send `false` to\nexit at MARKET."
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "Fallback": {
        "type": "string",
        "description": "What to do when the broker refuses the native protection (bracket /\ncover order): `trigger` (default) places the order plainly, protected\nby a server-side trigger; `reject` refuses the order with the broker's\nreason instead. For a GTT refused once the entry filled, `reject` means\nno server-side trigger either: the fill is reported unprotected. For a\nGTT protecting an existing position (`POST /v1/triggers`), `reject`\ncreates nothing (422 `gtt_refused`).",
        "enum": [
          "trigger",
          "reject"
        ]
      },
      "Gtt": {
        "type": "object",
        "description": "A GTT at the broker, in one shape for every broker (includes GTTs made\noutside this API, e.g. in the broker's own app).",
        "required": [
          "trigger_id",
          "status",
          "instrument_token",
          "tradingsymbol",
          "exchange",
          "side",
          "product",
          "quantity",
          "last_price",
          "legs",
          "created_at",
          "updated_at",
          "expires_at"
        ],
        "properties": {
          "trigger_id": {
            "type": "string",
            "description": "The broker's GTT id."
          },
          "status": {
            "type": "string",
            "description": "Broker status, lower-case (`active`, `triggered`, `cancelled`, ...)."
          },
          "instrument_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "Instrument id; null when the broker's instrument is not known here."
          },
          "tradingsymbol": {
            "type": "string"
          },
          "exchange": {
            "type": "string"
          },
          "side": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Side",
                "description": "Side of the order(s) a trigger places."
              },
              {
                "type": "null"
              }
            ]
          },
          "product": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Product"
              },
              {
                "type": "null"
              }
            ]
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units.",
            "minimum": 0
          },
          "last_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "LTP when the GTT was created / last modified."
          },
          "legs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GttLevel"
            },
            "description": "One leg (single) or two (stop-loss first, then target)."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "GttLegInput": {
        "type": "object",
        "description": "One GTT leg: the price that fires it and the order's limit price.",
        "required": [
          "trigger"
        ],
        "properties": {
          "trigger": {
            "type": "number",
            "format": "double",
            "description": "Price that fires the leg (on the tick grid)."
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Limit price of the order placed; defaults to the trigger."
          }
        },
        "additionalProperties": false
      },
      "GttLevel": {
        "type": "object",
        "description": "One leg of a GTT at the broker.",
        "required": [
          "trigger",
          "price"
        ],
        "properties": {
          "trigger": {
            "type": "number",
            "format": "double",
            "description": "Price that fires the leg."
          },
          "price": {
            "type": "number",
            "format": "double",
            "description": "Limit price of the order it places."
          }
        }
      },
      "GttRequest": {
        "type": "object",
        "description": "A GTT in one account: a stop-loss, a target, or both (one\ncancels the other). With both, a SELL's stop-loss sits below LTP and\nits target above (reversed for BUY); a single leg may be either side\nbut not at LTP.",
        "required": [
          "account",
          "instrument_token",
          "side",
          "product",
          "quantity"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Account id (see `/v1/accounts`)."
          },
          "instrument_token": {
            "type": "string",
            "description": "Instrument id (see `/v1/instruments`)."
          },
          "side": {
            "$ref": "#/components/schemas/Side",
            "description": "Side of the order a trigger places (SELL to protect a long)."
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units, or lots when `qty_is_in_lot`. Units round down to whole lots; under one lot is refused.",
            "minimum": 0
          },
          "qty_is_in_lot": {
            "type": "boolean",
            "description": "`quantity` counts lots, not units."
          },
          "stop_loss": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/GttLegInput"
              },
              {
                "type": "null"
              }
            ]
          },
          "target": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/GttLegInput"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "HoldingRow": {
        "type": "object",
        "description": "One holding row (enriched).",
        "required": [
          "account",
          "instrument_token",
          "tradingsymbol",
          "product",
          "quantity",
          "average_price",
          "invested_amount",
          "pnl",
          "pnl_percent"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "instrument_token": {
            "type": "string"
          },
          "tradingsymbol": {
            "type": "string"
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "average_price": {
            "type": "number",
            "format": "double"
          },
          "invested_amount": {
            "type": "number",
            "format": "double"
          },
          "pnl": {
            "type": "number",
            "format": "double"
          },
          "pnl_percent": {
            "type": "number",
            "format": "double"
          },
          "t1_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Part of the holding bought but not yet delivered (T+1); absent when\nthe broker does not report it.",
            "minimum": 0
          },
          "pledged_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Part of the holding pledged as collateral; absent when the broker\ndoes not report it.",
            "minimum": 0
          },
          "lot_size": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Contract lot size (added when the instrument is known).",
            "minimum": 0
          },
          "broker_tradingsymbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's own spelling of the symbol, only when it differs\nfrom `tradingsymbol` (which always comes from the instrument\nlist)."
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exchange as the instrument list gives it (`NSE`, `BSE`, `MCX`,\n...): index options and futures are listed under the cash\nexchange (`NSE` for NIFTY, `BSE` for SENSEX), so match on what\n`GET /v1/instruments` returns, not on `NFO` / `BFO`."
          },
          "instrument_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Instrument type (`EQ`, `FUTIDX`, `OPTIDX`, `OPTSTK`, ...)."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Underlying symbol (the trading symbol for equities)."
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "description": "Expiry date (`YYYY-MM-DD`); empty for non-derivatives."
          },
          "strike": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Strike price; `0` for non-options."
          },
          "option_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`CE` / `PE`; empty for non-options."
          },
          "sector": {
            "type": [
              "string",
              "null"
            ],
            "description": "Industry sector; absent when the instrument list has none."
          },
          "isin": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISIN; absent when the instrument list has none."
          },
          "indices": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Index memberships (e.g. `NIFTY`, `NIFTY100`); absent when\nnone."
          },
          "instrument_missing": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Present (`true`) only when the instrument is not known; the\ninstrument fields above are then absent."
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Last traded price (added when a quote is available)."
          },
          "prev_close": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Previous close (`0` when unknown), sent with `ltp`."
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "InstrumentRow": {
        "type": "object",
        "description": "One instrument, as in the instrument list (a field the source lacks is\nnull).",
        "required": [
          "instrument_token",
          "exchange",
          "instrument",
          "exchange_token",
          "lot_size",
          "expiry",
          "strike",
          "option_type",
          "tick_size",
          "underlying_symbol",
          "isin",
          "freeze_qty",
          "name",
          "tradingsymbol",
          "sector",
          "indices"
        ],
        "properties": {
          "instrument_token": {
            "type": "string",
            "description": "Instrument id: what orders, triggers and every row call\n`instrument_token`."
          },
          "exchange": {
            "type": "string",
            "description": "Exchange as the instrument list gives it, upper case (`NSE`, `BSE`,\n`MCX`, ...). Index options and futures are listed under the cash\nexchange (`NSE` for NIFTY, `BSE` for SENSEX options); filter by the\nvalue returned here."
          },
          "instrument": {
            "type": [
              "string",
              "null"
            ],
            "description": "Instrument type (`EQUITY`, `INDEX`, `FUTIDX`, `OPTIDX`, `OPTSTK`, ...)."
          },
          "exchange_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "The exchange's own token for the instrument."
          },
          "lot_size": {
            "type": "integer",
            "format": "int64",
            "description": "Contract lot size; `0` for indices (not tradable).",
            "minimum": 0
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "description": "Expiry date (`YYYY-MM-DD`); null for non-derivatives."
          },
          "strike": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Strike price; null for non-options."
          },
          "option_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`CE` / `PE`; null for non-options."
          },
          "tick_size": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Smallest price step."
          },
          "underlying_symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Underlying symbol (derivatives), or the stock's own symbol."
          },
          "isin": {
            "type": [
              "string",
              "null"
            ]
          },
          "freeze_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Exchange freeze quantity: larger orders are split into slices.",
            "minimum": 0
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company or instrument name."
          },
          "tradingsymbol": {
            "type": "string",
            "description": "Trading symbol, as the exchange lists it."
          },
          "sector": {
            "type": [
              "string",
              "null"
            ]
          },
          "indices": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Index memberships (e.g. `NIFTY 50`); empty when none."
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "IssueSignalUrlRequest": {
        "type": "object",
        "description": "A new signal URL for one of the user's strategies.",
        "required": [
          "kind",
          "strategy_id"
        ],
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/SignalProvider",
            "description": "The provider that will call the URL."
          },
          "strategy_id": {
            "type": "string",
            "description": "The strategy's id: 1-64 letters, digits, `-` or `_`."
          }
        },
        "additionalProperties": false
      },
      "LegInstrument": {
        "type": "string",
        "description": "Kind of instrument a leg trades.",
        "enum": [
          "option",
          "future",
          "stock"
        ]
      },
      "LegRole": {
        "type": "string",
        "enum": [
          "stop_loss",
          "target",
          "square_off"
        ]
      },
      "MarginRow": {
        "type": "object",
        "description": "Funds of one account (a single object, not a list).",
        "required": [
          "account",
          "opening_balance",
          "available",
          "utilised"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "opening_balance": {
            "type": "number",
            "format": "double"
          },
          "available": {
            "type": "number",
            "format": "double"
          },
          "utilised": {
            "type": "number",
            "format": "double",
            "description": "Share of the opening balance in use, as a percent (0-100)."
          },
          "used": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Margin in use, in rupees; absent when the broker does not report it."
          },
          "payin": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Funds added today, in rupees; absent when not reported."
          },
          "payout": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Funds withdrawn today, in rupees; absent when not reported."
          },
          "collateral": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Collateral (pledged holdings) margin, in rupees; absent when not\nreported."
          },
          "realised_pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Booked P&L for the day, in rupees; absent when not reported."
          }
        },
        "additionalProperties": false
      },
      "MarginSource": {
        "type": "string",
        "description": "Where a margin figure comes from.",
        "enum": [
          "broker",
          "estimate"
        ]
      },
      "MissingCode": {
        "type": "string",
        "description": "Why an account has no data, as a stable code.",
        "enum": [
          "no_session",
          "not_supported",
          "stale"
        ]
      },
      "ModifyBracketRequest": {
        "type": "object",
        "description": "Changes to a bracket or cover order; absent fields stay as they are.\nA bracket's legs change together (`stop_loss` and `target`); a cover\nhas no target.",
        "required": [
          "account",
          "instrument_token",
          "kind",
          "side",
          "entry_price"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Account id the order is in."
          },
          "instrument_token": {
            "type": "string",
            "description": "Instrument id of the order."
          },
          "kind": {
            "$ref": "#/components/schemas/BracketOrderKind"
          },
          "side": {
            "$ref": "#/components/schemas/Side",
            "description": "Side of the entry."
          },
          "entry_price": {
            "type": "number",
            "format": "double",
            "description": "Entry price the legs are measured from."
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "New entry limit price."
          },
          "quantity": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "New quantity, in units.",
            "minimum": 0
          },
          "stop_loss": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "New stop-loss price."
          },
          "target": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "New target price (`BO` only)."
          },
          "trailing_stop_loss": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "New trailing stop-loss step, in points."
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "ModifyOrderRequest": {
        "type": "object",
        "description": "The order as it should be now (the full order, not a patch).",
        "required": [
          "account",
          "instrument_token",
          "side",
          "order_type",
          "product",
          "quantity"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Account id the order is in (see `/v1/accounts`)."
          },
          "instrument_token": {
            "type": "string",
            "description": "Instrument id of the order."
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "order_type": {
            "$ref": "#/components/schemas/OrderType"
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units, or lots when `qty_is_in_lot`. Units round down to whole lots; under one lot is refused.",
            "minimum": 0
          },
          "qty_is_in_lot": {
            "type": "boolean",
            "description": "`quantity` counts lots, not units."
          },
          "price": {
            "type": "number",
            "format": "double",
            "description": "Limit price (`LIMIT`, `SL`); 0 or absent for market orders."
          },
          "trigger_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Trigger price for `SL` / `SL_M`."
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "ModifyTriggerV2Request": {
        "type": "object",
        "description": "New rules for a v2 trigger. The engine applies what its current state\nallows (a stop-loss is never loosened).",
        "required": [
          "spec"
        ],
        "properties": {
          "spec": {
            "type": "object",
            "description": "The whole new spec (same shape as on create)."
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ],
            "description": "New expiry (RFC 3339); unchanged when absent; `null` removes it\n(the trigger then lives until it ends)."
          },
          "route": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RequestedRoute",
                "description": "Where the protection lives (`route` of the trigger). The route is\nchosen at create: the current one (or `auto`) is accepted and\nchanges nothing; any other is refused (422 `route`) with how to\nmove it."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "NewApiKey": {
        "type": "object",
        "description": "A new API key. At most 10 keys may be active at once.",
        "required": [
          "name",
          "scopes"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "A label for the key, 1-64 characters (trimmed)."
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Scope"
            },
            "description": "What the key may do; at least one."
          },
          "ip_allowlist": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IP addresses (v4 or v6) the key may be used from, at most 20;\nempty or absent = any."
          }
        },
        "additionalProperties": false
      },
      "NewPartnerApp": {
        "type": "object",
        "description": "A partner app to register.",
        "required": [
          "name",
          "redirect_uris",
          "scopes"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Name shown to users on the consent screen (1-80 characters)."
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "1-10 redirect URIs, matched exactly (no prefixes, no wildcards):\n`https://`, or `http://localhost` / `http://127.0.0.1` for\ndevelopment; no fragment, at most 512 characters."
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Scope"
            },
            "description": "The most a user can grant the app (at least one)."
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "HTTPS URL of the app's logo."
          }
        },
        "additionalProperties": false
      },
      "NewWebhook": {
        "type": "object",
        "description": "A new webhook. A user may have at most 5.",
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "description": "The receiver: an `https://` URL on a public host (private, loopback\nand link-local addresses are refused)."
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            },
            "description": "Events to send, at least one: `order_update`, `trade`,\n`account_alert`, `positions` (`ping` cannot be subscribed to)."
          },
          "accounts": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Only these of the user's accounts (non-empty, the user's own); leave\nout or null for every account, including ones added later."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "A note for the owner, at most 200 characters."
          },
          "trigger_updates": {
            "type": "boolean",
            "description": "`true` also sends `trigger_update` (a v2 trigger of the user\nchanged; see the document's `webhooks` section). Off unless set\n(also later with `PATCH`)."
          }
        },
        "additionalProperties": false
      },
      "Notification": {
        "type": "object",
        "description": "One notification.",
        "required": [
          "id",
          "event",
          "severity",
          "title",
          "what_happened",
          "what_we_did",
          "what_you_should_do",
          "account",
          "strategy",
          "trigger_id",
          "origin",
          "at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable id (`ntf_` + 24 hex): the same on every redelivery, so\nde-duplicate on it."
          },
          "event": {
            "$ref": "#/components/schemas/NotificationEvent"
          },
          "severity": {
            "$ref": "#/components/schemas/NotificationSeverity"
          },
          "title": {
            "type": "string",
            "description": "One line, sentence case."
          },
          "what_happened": {
            "type": "string",
            "description": "What happened, in plain English."
          },
          "what_we_did": {
            "type": [
              "string",
              "null"
            ],
            "description": "What was done about it (null when nothing needed doing)."
          },
          "what_you_should_do": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the user should do (null when nothing)."
          },
          "account": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker account it is about."
          },
          "strategy": {
            "type": [
              "string",
              "null"
            ],
            "description": "The strategy it is about."
          },
          "trigger_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The v2 trigger it is about."
          },
          "deployment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The automated-strategy deployment it is about (open it at\n`GET /v2/deployments/{deployment_id}`). Added later: absent on\nolder notices."
          },
          "cycle": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationCycle",
                "description": "The deployment's run (cycle) it is about. Added later: absent on\nolder notices and when it is about no single run."
              },
              {
                "type": "null"
              }
            ]
          },
          "subtype": {
            "type": [
              "string",
              "null"
            ],
            "description": "A finer kind within `event`, when there is one (other values may\nappear; ignore unknown ones): `strategy_adjusted` (a strategy\nadjusted its open trade; `event` `strategy_entered`),\n`risk_target` (a risk limit's profit target fired: `event`\n`trigger_fired`, or `risk_breached` for a last target that exits\neverything), `risk_trail` (a risk limit's profit trail armed or\nmoved up; `event` `trigger_fired`). Added later: absent otherwise."
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationSource",
                "description": "Why it happened (see `NotificationSource`). Added later: absent on\nolder notices and when unknown."
              },
              {
                "type": "null"
              }
            ]
          },
          "order": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationOrder",
                "description": "The order it is about (see `NotificationOrder`). Added later:\nabsent on older notices and when it is about no single order."
              },
              {
                "type": "null"
              }
            ]
          },
          "account_tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "The account's name in the app (its tag), when it has one. Added\nlater: absent on older notices."
          },
          "realized_pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Realised profit (positive) or loss (negative) in rupees of the\nposition or leg an exit closed, only when it is known from its\nfills. Added later: absent otherwise."
          },
          "thread": {
            "type": [
              "string",
              "null"
            ],
            "description": "Groups notices about one thing (an order and its protection and\nexits, a trigger, a strategy run): the same value on each. Opaque\n(`order:…`, `trigger:…`, `cycle:…`). Added later: absent on older\nnotices and on account-level ones."
          },
          "origin": {
            "$ref": "#/components/schemas/NotificationOrigin"
          },
          "at": {
            "type": "string",
            "description": "When it happened; RFC 3339, India time."
          }
        }
      },
      "NotificationBrokenReason": {
        "type": "string",
        "description": "Why a channel stopped working for a user.",
        "enum": [
          "blocked_by_user",
          "chat_not_found"
        ]
      },
      "NotificationChannelPreference": {
        "type": "object",
        "description": "One channel's preference as stored and as sent. Unknown fields and\nevent names are kept out of the way (a newer pod may have written\nthem), never refused.",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Off: this channel gets nothing (the app still gets mandatory events)."
          },
          "events": {
            "type": "object",
            "description": "Event type (`trigger_fired`, ...) -> on / off. A missing event\nfollows its default (`GET /v1/notifications/events`).",
            "additionalProperties": {
              "type": "boolean"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "scope": {
            "$ref": "#/components/schemas/NotificationScope"
          },
          "webhook_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "`webhook` only: the webhook ids to send to; null = every enabled\nwebhook of the user."
          }
        }
      },
      "NotificationCycle": {
        "type": "object",
        "description": "The strategy run a notice is about: open it at\n`GET /v2/deployments/{deployment_id}/cycles/{day}/{n}`.",
        "required": [
          "day",
          "n"
        ],
        "properties": {
          "day": {
            "type": "string",
            "description": "Trading day, `YYYY-MM-DD`."
          },
          "n": {
            "type": "integer",
            "format": "int32",
            "description": "The run's number that day (1 = the first).",
            "minimum": 0
          }
        }
      },
      "NotificationEvent": {
        "type": "string",
        "description": "An event type a user can route. Stored in preferences (Mongo) and sent\nin notices: values are only ever added (readers first).",
        "enum": [
          "trigger_fired",
          "trigger_refused",
          "trigger_ended",
          "exit_placed",
          "exit_filled",
          "exit_refused",
          "order_filled",
          "order_rejected",
          "order_unconfirmed",
          "protection_failed",
          "entry_failed",
          "strategy_entered",
          "strategy_exited",
          "risk_breached",
          "session_expired",
          "live_updates",
          "account_setup",
          "webhook_disabled",
          "daily_summary",
          "channel_broken",
          "strategy_armed",
          "strategy_refused",
          "strategy_safety_pause",
          "strategy_kill_switch",
          "strategy_error"
        ]
      },
      "NotificationEventGroup": {
        "type": "string",
        "description": "Filter group shown in the app.",
        "enum": [
          "triggers",
          "orders",
          "strategies",
          "errors",
          "account",
          "summary"
        ]
      },
      "NotificationOrder": {
        "type": "object",
        "description": "The order a notice is about, as far as it is known.",
        "required": [
          "symbol"
        ],
        "properties": {
          "symbol": {
            "type": "string",
            "description": "Trading symbol (`RELIANCE-EQ`, `NIFTY27OCT202622500PE`)."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The instrument's name as people read it (`RELIANCE`,\n`NIFTY 27 Oct 22500 PE`), from the instrument master."
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ]
          },
          "side": {
            "type": [
              "string",
              "null"
            ],
            "description": "`BUY` or `SELL`."
          },
          "product": {
            "type": [
              "string",
              "null"
            ],
            "description": "`MIS`, `CARRYFORWARD`, `DELIVERY` or `MTF`."
          },
          "order_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`MARKET`, `LIMIT`, `SL` or `SL_M`."
          },
          "quantity": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Ordered quantity.",
            "minimum": 0
          },
          "filled_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Filled so far.",
            "minimum": 0
          },
          "average_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Average fill price."
          }
        }
      },
      "NotificationOrigin": {
        "type": "object",
        "description": "Where a notice came from (for support; never needed to read it).",
        "required": [
          "kind",
          "id"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "description": "`trigger_update`, `activity` or `anomaly` (other values may appear)."
          },
          "id": {
            "type": "string",
            "description": "The source record's id (a trigger update's `event_id`, an activity\nrecord's `id`)."
          }
        }
      },
      "NotificationPreferencesUpdate": {
        "type": "object",
        "description": "`PUT /v1/notifications/preferences`: every channel optional (a missing\none goes back to its defaults).",
        "properties": {
          "telegram": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChannelPreference"
              },
              {
                "type": "null"
              }
            ]
          },
          "app_push": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChannelPreference"
              },
              {
                "type": "null"
              }
            ]
          },
          "webhook": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChannelPreference"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "NotificationPrompt": {
        "type": "object",
        "required": [
          "kind",
          "severity",
          "message"
        ],
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/NotificationPromptKind"
          },
          "severity": {
            "$ref": "#/components/schemas/NotificationSeverity"
          },
          "message": {
            "type": "string",
            "description": "Plain words to show as is."
          }
        }
      },
      "NotificationPromptKind": {
        "type": "string",
        "description": "Something the app should show the user.",
        "enum": [
          "connect_telegram",
          "telegram_broken",
          "webhook_failing"
        ]
      },
      "NotificationScope": {
        "type": "object",
        "properties": {
          "mode": {
            "$ref": "#/components/schemas/NotificationScopeMode"
          },
          "strategies": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Strategy names (`selected` only)."
          },
          "triggers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "v2 trigger ids (`selected` only)."
          }
        }
      },
      "NotificationScopeMode": {
        "type": "string",
        "description": "Which notices a channel gets.",
        "enum": [
          "all",
          "selected"
        ]
      },
      "NotificationSeverity": {
        "type": "string",
        "description": "How much a notice needs the user.",
        "enum": [
          "info",
          "warning",
          "critical"
        ]
      },
      "NotificationSource": {
        "type": "object",
        "description": "Why a notice happened: what started it (a strategy, a trigger, a\nsignal URL, a manual order...) and the part it played.",
        "required": [
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "description": "`strategy`, `trigger`, `protection`, `risk_limit`, `signal`,\n`manual`, `api` or `partner` (other values may appear)."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its name, when it has one (the strategy's name, the signal URL's\n\"TradingView: my-url\", the API key's or partner app's name, the\ntrigger's kind)."
          },
          "role": {
            "type": [
              "string",
              "null"
            ],
            "description": "The part this notice plays: `entry`, `exit`, `stop_loss`,\n`trailing_stop`, `target`, `alert`, `adjustment` (other values may\nappear)."
          },
          "rung": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "For a ladder target: which one (1 = the first).",
            "minimum": 0
          },
          "rungs": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "For a ladder target: how many there are, when known.",
            "minimum": 0
          }
        }
      },
      "NotificationWebhookStatus": {
        "type": "object",
        "description": "One of the user's webhooks, as a notification channel.",
        "required": [
          "id",
          "host",
          "enabled",
          "healthy",
          "selected",
          "disabled_reason"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "host": {
            "type": "string",
            "description": "The receiver's host (never the path or query)."
          },
          "enabled": {
            "type": "boolean"
          },
          "healthy": {
            "type": "boolean",
            "description": "Enabled and its last delivery succeeded."
          },
          "selected": {
            "type": "boolean",
            "description": "Picked in the webhook channel's preference."
          },
          "disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "OAuthClientRegistration": {
        "type": "object",
        "description": "A client registration request (RFC 7591 §2). Other client metadata is\naccepted and ignored.",
        "properties": {
          "client_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Name shown to the user on the consent screen (printable ASCII, at\nmost 64 characters); unverified. A known AI vendor's name is refused\nunless every redirect URI other than loopback http or a known\ndesktop app scheme is that vendor's."
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "1-5 redirect URIs: `https://` (any host), `http://localhost`,\n`http://127.0.0.1` or `http://[::1]` on any port (the port is\nignored when matching), or a known desktop app scheme. No fragment,\nat most 512 characters each."
          },
          "grant_types": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Ignored: the client is registered for `authorization_code` and\n`refresh_token`."
          },
          "response_types": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Ignored: the client is registered for `code`."
          },
          "token_endpoint_auth_method": {
            "type": [
              "string",
              "null"
            ],
            "description": "Ignored: the client is public (`none`)."
          }
        }
      },
      "OAuthErrorCode": {
        "type": "string",
        "description": "Token endpoint error codes (RFC 6749 section 5.2) and their status:\n`invalid_request` (400), `invalid_grant` (400), `invalid_client` (401),\n`temporarily_unavailable` (503), `unsupported_grant_type` (400),\n`slow_down` (429, with `Retry-After`).",
        "enum": [
          "invalid_request",
          "invalid_grant",
          "invalid_client",
          "temporarily_unavailable",
          "unsupported_grant_type",
          "slow_down"
        ]
      },
      "OAuthErrorResponse": {
        "type": "object",
        "description": "Token endpoint error (RFC 6749 section 5.2). Not the usual envelope.",
        "required": [
          "error",
          "error_description"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/OAuthErrorCode"
          },
          "error_description": {
            "type": "string",
            "description": "Human-readable explanation; may change, never parse it."
          }
        }
      },
      "OAuthGrantType": {
        "type": "string",
        "description": "Supported `grant_type` values; any other is refused with\n`invalid_request`.",
        "enum": [
          "authorization_code",
          "refresh_token"
        ]
      },
      "OAuthRegisteredClient": {
        "type": "object",
        "description": "The registered client (RFC 7591 §3.2.1). No `client_secret`: the client\nis public.",
        "required": [
          "client_id",
          "client_name",
          "redirect_uris",
          "token_endpoint_auth_method",
          "grant_types",
          "response_types",
          "client_id_issued_at"
        ],
        "properties": {
          "client_id": {
            "type": "string",
            "description": "OAuth client id (`cp_...`)."
          },
          "client_name": {
            "type": "string"
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "token_endpoint_auth_method": {
            "type": "string",
            "description": "Always `none`: send `client_id` (and the PKCE verifier) to the token\nendpoint, no secret.",
            "example": "none"
          },
          "grant_types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Always `authorization_code` and `refresh_token`."
          },
          "response_types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Always `code`."
          },
          "client_id_issued_at": {
            "type": "integer",
            "format": "int64",
            "description": "Unix time (seconds) of the registration."
          }
        }
      },
      "OAuthServerMetadata": {
        "type": "object",
        "description": "Authorization server metadata (RFC 8414 §2).",
        "required": [
          "issuer",
          "authorization_endpoint",
          "token_endpoint",
          "registration_endpoint",
          "response_types_supported",
          "grant_types_supported",
          "code_challenge_methods_supported",
          "token_endpoint_auth_methods_supported",
          "scopes_supported"
        ],
        "properties": {
          "issuer": {
            "type": "string",
            "description": "This server's issuer URL."
          },
          "authorization_endpoint": {
            "type": "string",
            "description": "The consent page users approve an app on."
          },
          "token_endpoint": {
            "type": "string",
            "description": "`POST /v1/oauth/token` on this server."
          },
          "registration_endpoint": {
            "type": "string",
            "description": "`POST /v1/oauth/register` on this server."
          },
          "response_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Always `code`."
          },
          "grant_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "`authorization_code` and `refresh_token`."
          },
          "code_challenge_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Always `S256` (plain PKCE is refused)."
          },
          "token_endpoint_auth_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "`none` (dynamically registered, public clients), `client_secret_basic`\nand `client_secret_post` (registered partner apps)."
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Scopes an agent may be granted here, then `offline_access`: MCP\nclients ask for refresh tokens with it only when it is listed. It\ngrants nothing; every connection gets a refresh token anyway."
          }
        }
      },
      "OAuthTokenRequest": {
        "type": "object",
        "description": "Token request (RFC 6749 sections 4.1.3 and 6), form-encoded or JSON.\nWhich fields are needed depends on `grant_type`:\n- `authorization_code`: `code`, `redirect_uri`, `code_verifier`\n- `refresh_token`: `refresh_token`\n\nClient authentication: `client_id` + `client_secret` here, or HTTP\nBasic (`Authorization: Basic base64(client_id:client_secret)`), which\nwins when both are sent; a dynamically registered (public) client sends\n`client_id` only. Unknown fields are ignored.",
        "required": [
          "grant_type"
        ],
        "properties": {
          "grant_type": {
            "$ref": "#/components/schemas/OAuthGrantType",
            "description": "`authorization_code` or `refresh_token`; missing or anything else is\n`unsupported_grant_type`."
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "`authorization_code`: the code from the redirect (`oc_...`)."
          },
          "redirect_uri": {
            "type": [
              "string",
              "null"
            ],
            "description": "`authorization_code`: the same `redirect_uri` the code was issued for."
          },
          "code_verifier": {
            "type": [
              "string",
              "null"
            ],
            "description": "`authorization_code`: the PKCE verifier (43-128 characters of\n`A-Z a-z 0-9 - . _ ~`) whose S256 challenge was sent to authorize."
          },
          "refresh_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "`refresh_token`: the latest refresh token (`pr_...`)."
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The app's client id (unless sent with HTTP Basic)."
          },
          "client_secret": {
            "type": [
              "string",
              "null"
            ],
            "description": "The app's client secret (unless sent with HTTP Basic). Left out by a\ndynamically registered client (`token_endpoint_auth_method: none`)."
          },
          "resource": {
            "type": [
              "string",
              "null"
            ],
            "description": "RFC 8707 resource (optional): when sent, it must be the one the\nuser authorized (the MCP server URL), else `invalid_grant`."
          }
        }
      },
      "OAuthTokenResponse": {
        "type": "object",
        "description": "Token response (RFC 6749 section 5.1): a new access token and a new\nrefresh token. Not wrapped in the usual response envelope.",
        "required": [
          "access_token",
          "token_type",
          "expires_in",
          "refresh_token",
          "scope"
        ],
        "properties": {
          "access_token": {
            "type": "string",
            "description": "Access token (`pa_...`); send it as `Authorization: Bearer <access_token>`."
          },
          "token_type": {
            "type": "string",
            "description": "Always `Bearer`.",
            "example": "Bearer"
          },
          "expires_in": {
            "type": "integer",
            "format": "int64",
            "description": "Seconds until the access token expires (86400: one day).",
            "minimum": 0
          },
          "refresh_token": {
            "type": "string",
            "description": "Refresh token (`pr_...`), valid for 90 days and single use: every\nrefresh returns a new one. Presenting a used refresh token again\nrevokes the whole connection."
          },
          "scope": {
            "type": "string",
            "description": "Granted scopes, space separated (OAuth convention), e.g. `read orders`."
          }
        }
      },
      "OnGiveUp": {
        "type": "string",
        "description": "What happens to a still-open order when the chase ends unfilled.",
        "enum": [
          "rest",
          "cancel"
        ]
      },
      "OptionKind": {
        "type": "string",
        "description": "Option right.",
        "enum": [
          "CE",
          "PE"
        ]
      },
      "OrderData": {
        "type": "object",
        "description": "An order as it is delivered live: the tracked order plus instrument\ndetails and live prices (added when the instrument is known).\n\n`instrument_token` and `order_tag` are also sent under their legacy\nnames, always with the same value; read the primary names.",
        "required": [
          "order_tag",
          "username",
          "account",
          "broker",
          "instrument_token",
          "tradingsymbol",
          "side",
          "order_type",
          "product",
          "quantity",
          "price",
          "state",
          "filled_qty",
          "created_at",
          "status_history"
        ],
        "properties": {
          "order_tag": {
            "type": "string",
            "description": "The order's id, chosen when it was placed (a ULID)."
          },
          "broker_tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tag as sent to the broker (format depends on the broker)."
          },
          "order_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Broker-assigned order id; `null` until the broker acknowledges."
          },
          "parent_tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "`order_tag` of the order this one belongs to (a protective leg's\nentry), if any."
          },
          "username": {
            "type": "string"
          },
          "account": {
            "type": "string"
          },
          "broker": {
            "type": "string",
            "description": "Broker id (`zerodha`, `upstox`, ...)."
          },
          "instrument_token": {
            "type": "string",
            "description": "Instrument id."
          },
          "tradingsymbol": {
            "type": "string"
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "order_type": {
            "$ref": "#/components/schemas/OrderType"
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "price": {
            "type": "number",
            "format": "double",
            "description": "Limit price; `0` for market orders."
          },
          "trigger_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "state": {
            "$ref": "#/components/schemas/OrderState"
          },
          "filled_qty": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "average_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "status_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's latest status text (rejection reason, ...)."
          },
          "broker_updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Broker time of the last update applied."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "status_history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusChange"
            },
            "description": "Every state change so far, oldest first."
          },
          "client_tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "The caller's own reference, as given in `client_tag` when the order\nwas placed; absent when none was given (or for orders placed\nelsewhere, e.g. in the broker's own app)."
          },
          "partner_client_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client id of the partner app that placed the order; absent for\norders placed any other way."
          },
          "chase": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ChasePlan",
                "description": "The order's `chase` settings and the limit it was first sent with;\nabsent when it asked for none."
              },
              {
                "type": "null"
              }
            ]
          },
          "leg_role": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LegRole",
                "description": "For an exit leg of a bracket / cover order: `stop_loss`, `target`\nor the broker's `square_off` (its entry is `parent_tag`); absent\nfor every other order."
              },
              {
                "type": "null"
              }
            ]
          },
          "chase_progress": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ChaseProgress",
                "description": "How far the order's `chase` got (attempts used, how it ended);\nabsent before its first re-price attempt."
              },
              {
                "type": "null"
              }
            ]
          },
          "strategy": {
            "type": [
              "string",
              "null"
            ],
            "description": "The strategy of the v2 trigger that placed the order; absent for\nevery other order."
          },
          "split_from": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SplitFrom",
                "description": "When the broker split a placed order into several orders (its\nfreeze-quantity cap, e.g. Pocketful at 500 units or Zerodha's\nautoslice) and lists only those: each is its own order (its own\n`order_id`, quantity and fills) and this names the order as placed.\nThe first part keeps the placed `order_tag`. Change or cancel each\npart by its own `order_id`; the placed id still cancels every open\npart, or changes their price / trigger (not their quantity). Absent\nfor every other order."
              },
              {
                "type": "null"
              }
            ]
          },
          "lot_size": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Contract lot size (added when the instrument is known).",
            "minimum": 0
          },
          "broker_tradingsymbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's own spelling of the symbol, only when it differs\nfrom `tradingsymbol` (which always comes from the instrument\nlist)."
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exchange as the instrument list gives it (`NSE`, `BSE`, `MCX`,\n...): index options and futures are listed under the cash\nexchange (`NSE` for NIFTY, `BSE` for SENSEX), so match on what\n`GET /v1/instruments` returns, not on `NFO` / `BFO`."
          },
          "instrument_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Instrument type (`EQ`, `FUTIDX`, `OPTIDX`, `OPTSTK`, ...)."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Underlying symbol (the trading symbol for equities)."
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "description": "Expiry date (`YYYY-MM-DD`); empty for non-derivatives."
          },
          "strike": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Strike price; `0` for non-options."
          },
          "option_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`CE` / `PE`; empty for non-options."
          },
          "sector": {
            "type": [
              "string",
              "null"
            ],
            "description": "Industry sector; absent when the instrument list has none."
          },
          "isin": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISIN; absent when the instrument list has none."
          },
          "indices": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Index memberships (e.g. `NIFTY`, `NIFTY100`); absent when\nnone."
          },
          "instrument_missing": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Present (`true`) only when the instrument is not known; the\ninstrument fields above are then absent."
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Last traded price (added when a quote is available)."
          },
          "prev_close": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Previous close (`0` when unknown), sent with `ltp`."
          },
          "cirrus_token": {
            "type": "string",
            "description": "Instrument id.",
            "deprecated": true
          },
          "cirrus_tag": {
            "type": "string",
            "description": "The order's id, chosen when it was placed (a ULID).",
            "deprecated": true
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token",
          "cirrus_tag": "order_tag"
        }
      },
      "OrderInput": {
        "type": "object",
        "description": "One order, to place in each of `accounts`.",
        "required": [
          "instrument_token",
          "side",
          "order_type",
          "product",
          "quantity",
          "accounts"
        ],
        "properties": {
          "instrument_token": {
            "type": "string",
            "description": "Instrument id, e.g. `CT:1:2885:RELIANCE-EQ` (see `/v1/instruments`)."
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "order_type": {
            "$ref": "#/components/schemas/OrderType"
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units, or lots when `qty_is_in_lot`. Units round down to whole lots; under one lot is refused.",
            "minimum": 0
          },
          "qty_is_in_lot": {
            "type": "boolean",
            "description": "`quantity` counts lots, not units."
          },
          "price": {
            "type": "number",
            "format": "double",
            "description": "Limit price (`LIMIT`, `SL`); 0 or absent for market orders."
          },
          "trigger_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Trigger price for `SL` / `SL_M`."
          },
          "accounts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Account ids to place this order in (see `/v1/accounts`).",
            "minItems": 1
          },
          "protection": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Rules",
                "description": "Stop-loss / target / trail armed once this order fills (as a broker\nbracket / cover / GTT order when the broker supports it, otherwise a\nserver-side trigger)."
              },
              {
                "type": "null"
              }
            ]
          },
          "market_protection": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Market protection (default `true`): MARKET and LIMIT at 0 go out as\na LIMIT a small band past the last price, SL-M as SL a band past its\ntrigger. `false` sends them as they are (LIMIT at 0 as MARKET)."
          },
          "client_tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for this order, echoed on each of its results:\nat most 64 letters, digits, `_`, `.`, `:` or `-`.",
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_.:-]{1,64}$"
          },
          "strategy": {
            "type": [
              "string",
              "null"
            ],
            "description": "The strategy this order belongs to, stored on the order and used to\ngroup positions and P&L in `GET /v1/strategies`: at most 64\nletters, digits, `_`, `.`, `:` or `-`. Absent: \"Unassigned\".",
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_.:-]{1,64}$"
          },
          "depends_on": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Index of an EARLIER order of this request (in `orders`) that must be\nFILLED in the same account before this one is placed. Waits at most\n`depends_on_timeout_ms` (default 30 s); if it does not fill, this\norder is rejected in that account (`reason: dependency_failed`), or,\nwith `depends_on_partial: filled_qty`, sent for the share its parent\nfilled once every parent slice there has ended or the wait is over.",
            "minimum": 0
          },
          "depends_on_partial": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DependsOnPartial",
                "description": "With `depends_on`: what to do when the parent filled only partly by\nthe end of the wait. Default `reject`."
              },
              {
                "type": "null"
              }
            ]
          },
          "depends_on_timeout_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "With `depends_on`: longest wait for the parent, in ms\n(1000-30000, default 30000).",
            "maximum": 30000,
            "minimum": 1000
          },
          "chase": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Chase",
                "description": "Re-price a protected market order that rests unfilled, within\nbounds (see `Chase`). Only for MARKET / LIMIT at 0 with market\nprotection on; 422 otherwise."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "OrderMarginResult": {
        "type": "object",
        "description": "Margin for one order in one account.",
        "required": [
          "order_index",
          "account",
          "instrument_token",
          "quantity",
          "total_required",
          "message",
          "error_code",
          "source",
          "stale",
          "flags"
        ],
        "properties": {
          "order_index": {
            "type": "integer",
            "description": "Index of the order in the request.",
            "minimum": 0
          },
          "account": {
            "type": "string"
          },
          "instrument_token": {
            "type": "string",
            "description": "Instrument id."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units that would be sent (after lot and multiplier sizing); 0 when\nthe account would refuse the order.",
            "minimum": 0
          },
          "total_required": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Margin required: the broker's figure, or the estimate when the\nbroker cannot calculate margins or did not answer (`source` says\nwhich); null when there is neither (`message` says why)."
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the broker gave no figure (the order would be refused, the\nbroker cannot calculate margins, or it did not answer). Kept when\n`total_required` is an estimate."
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "`not_supported_by_broker` when the account's broker cannot calculate\nmargins (e.g. Pocketful); null otherwise (branch on this, not on\n`message`). Kept when `total_required` is an estimate."
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MarginSource",
                "description": "Where `total_required` comes from; null when there is no figure."
              },
              {
                "type": "null"
              }
            ]
          },
          "stale": {
            "type": "boolean",
            "description": "The estimate used exchange data that is not today's (or that the\nexchange data load refused); always false for broker figures."
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Why the estimate may be low (e.g. `positions_unknown`). An open\nlist: ignore values you do not know. Empty for broker figures."
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "OrderProtectionRule": {
        "type": "object",
        "description": "One part of the protection asked for.",
        "required": [
          "type",
          "value"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "`percentage` (of the entry price), `points` (from it) or `price`."
          },
          "value": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "OrderProtectionRules": {
        "type": "object",
        "description": "The stop-loss / target / trail asked for (each null when off).",
        "required": [
          "stop_loss",
          "target",
          "trail"
        ],
        "properties": {
          "stop_loss": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrderProtectionRule"
              },
              {
                "type": "null"
              }
            ]
          },
          "target": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrderProtectionRule"
              },
              {
                "type": "null"
              }
            ]
          },
          "trail": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrderProtectionRule"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "OrderProtectionTrigger": {
        "type": "object",
        "description": "One trigger protecting (part of) the order.",
        "required": [
          "trigger_id",
          "version",
          "quantity",
          "entry_price"
        ],
        "properties": {
          "trigger_id": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "description": "`v2`: open it at `GET /v2/triggers/{trigger_id}`; `v1`: at\n`GET /v1/triggers/{trigger_id}`."
          },
          "quantity": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Units it protects; null when not recorded (v1).",
            "minimum": 0
          },
          "entry_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The fill price its levels were measured from; null when not\nrecorded."
          }
        }
      },
      "OrderState": {
        "type": "string",
        "description": "Order state: `SUBMITTED` (sent, not yet acknowledged), `OPEN`,\n`TRIGGER_PENDING` (stop-loss waiting for its trigger), `PARTIALLY_FILLED`,\n`FILLED`, `CANCELLED`, `REJECTED`, `EXPIRED` (day order ended unfilled)\nor `UNKNOWN` (not confirmed yet; never a guessed terminal state).",
        "enum": [
          "SUBMITTED",
          "OPEN",
          "TRIGGER_PENDING",
          "PARTIALLY_FILLED",
          "FILLED",
          "CANCELLED",
          "REJECTED",
          "EXPIRED",
          "UNKNOWN"
        ]
      },
      "OrderTag": {
        "type": "string",
        "description": "Order tag: a ULID (26 characters, sorts by creation time), assigned when the order is created.",
        "examples": [
          "01J8Z6Q3W5X7Y9A1B3C5D7E9F1"
        ],
        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
      },
      "OrderType": {
        "type": "string",
        "description": "`MARKET`, `LIMIT`, `SL` (stop-loss limit) or `SL_M` (stop-loss market;\n`SL-M` and `SLM` are accepted in requests).",
        "enum": [
          "MARKET",
          "LIMIT",
          "SL",
          "SL_M"
        ]
      },
      "PartResult": {
        "type": "object",
        "description": "One part's answer.",
        "required": [
          "order_id",
          "status",
          "message"
        ],
        "properties": {
          "order_id": {
            "type": "string",
            "description": "The part's own broker order id."
          },
          "status": {
            "$ref": "#/components/schemas/SliceStatus"
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it was rejected, or what is unknown; null when accepted."
          },
          "reason": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SliceReason",
                "description": "Why it was not accepted, machine-readable (absent when accepted)."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PartnerAppPatch": {
        "type": "object",
        "description": "Changes to an app's webhook: only the fields present change.",
        "properties": {
          "webhook_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The receiver: an `https://` URL on a public host (private, loopback\nand link-local addresses are refused). The first one creates the\nwebhook and its secret; `null` removes the webhook."
          },
          "webhook_events": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PartnerWebhookEvent"
            },
            "description": "Events to send, at least one of `order_update`, `trade`,\n`account_alert`, `connection_revoked` (all four when a webhook is\ncreated without this)."
          },
          "webhook_enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "`false` turns deliveries off; `true` turns them back on (also after\nthe webhook was turned off for failing)."
          }
        },
        "additionalProperties": false
      },
      "PartnerWebhookEvent": {
        "type": "string",
        "description": "Events a partner app's webhook can get (documentation names).",
        "enum": [
          "order_update",
          "trade",
          "account_alert",
          "connection_revoked"
        ]
      },
      "PartnerWebhookView": {
        "type": "object",
        "description": "A partner app's webhook as its owner sees it (never the secret). Times\nare RFC 3339.",
        "required": [
          "url",
          "events",
          "enabled",
          "disabled_reason",
          "consecutive_failures",
          "last_success_at",
          "last_failure_at",
          "previous_secret_expires_at",
          "secret_rotated_at"
        ],
        "properties": {
          "url": {
            "type": "string",
            "description": "The receiver: an `https://` URL on a public host."
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerWebhookEvent"
            },
            "description": "What it gets: `order_update` and `trade` for orders the app placed,\n`account_alert` for accounts of connected users, and\n`connection_revoked` when a user's connection ends."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether deliveries are sent."
          },
          "disabled_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it is off: `disabled_by_user`, `too_many_failures` (50 failed\nattempts in a row) or `failing_for_24_hours`; null while enabled."
          },
          "consecutive_failures": {
            "type": "integer",
            "format": "int32",
            "description": "Failed attempts in a row (any success resets it).",
            "minimum": 0
          },
          "last_success_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_failure_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "previous_secret_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "While set, deliveries are also signed with the previous secret (for\n24 hours after a rotation)."
          },
          "secret_rotated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PlaceOrdersRequest": {
        "type": "object",
        "description": "One or more orders, each placed in every account it names.",
        "required": [
          "orders"
        ],
        "properties": {
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderInput"
            },
            "minItems": 1
          },
          "use_multiplier": {
            "type": "boolean",
            "description": "Scale quantity by each account's `Multiplier`."
          }
        },
        "additionalProperties": false
      },
      "PortfolioAccountData": {
        "type": "object",
        "description": "One account's data of the requested kind.",
        "required": [
          "account",
          "updated_at",
          "data"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the data was last read from the broker (for `orders`: the\nlatest broker update of any order); null when unknown."
          },
          "data": {
            "$ref": "#/components/schemas/SnapshotData",
            "description": "`orders`: today's orders, newest first (`OrderData` rows);\n`positions`, `holdings`, `trades`: `PositionRow`, `HoldingRow`,\n`TradeRow` rows (`trades`: today's fills only); `margins`: one\n`MarginRow` object."
          }
        }
      },
      "PortfolioMissing": {
        "type": "object",
        "description": "An account with no data to show (yet).",
        "required": [
          "account",
          "code",
          "reason"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "code": {
            "$ref": "#/components/schemas/MissingCode",
            "description": "`no_session`: no active broker session (log in to the broker);\n`not_supported`: this broker is not supported yet; `stale`: the\nonly data is from an earlier broker session (read before today's\n04:00 IST), so it is not shown (log in to the broker)."
          },
          "reason": {
            "type": "string",
            "description": "Why, in plain English (for `stale`: when the data was last read,\ne.g. `No data since 29 Sep 19:20 IST: log in to the broker`)."
          }
        }
      },
      "PositionRow": {
        "type": "object",
        "description": "One open position row (as the broker reports it, enriched).",
        "required": [
          "account",
          "instrument_token",
          "tradingsymbol",
          "product",
          "net_qty",
          "buy_qty",
          "sell_qty",
          "buy_value",
          "sell_value",
          "average_price",
          "buy_average_price",
          "sell_average_price",
          "pnl"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "instrument_token": {
            "type": "string"
          },
          "tradingsymbol": {
            "type": "string"
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "net_qty": {
            "type": "integer",
            "format": "int64",
            "description": "Positive long, negative short."
          },
          "buy_qty": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sell_qty": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "buy_value": {
            "type": "number",
            "format": "double"
          },
          "sell_value": {
            "type": "number",
            "format": "double"
          },
          "average_price": {
            "type": "number",
            "format": "double"
          },
          "buy_average_price": {
            "type": "number",
            "format": "double"
          },
          "sell_average_price": {
            "type": "number",
            "format": "double"
          },
          "pnl": {
            "type": "number",
            "format": "double",
            "description": "Mark-to-market P&L as reported by the broker (total: booked plus\nopen)."
          },
          "overnight_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Quantity carried in from earlier sessions: positive long, negative\nshort. Absent when the broker does not report it."
          },
          "day_buy_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Bought today (absent when the broker does not report it).",
            "minimum": 0
          },
          "day_sell_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Sold today (absent when the broker does not report it).",
            "minimum": 0
          },
          "day_buy_value": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Value bought today, in rupees (absent when not reported)."
          },
          "day_sell_value": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Value sold today, in rupees (absent when not reported)."
          },
          "realised_pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Booked (closed) P&L as reported by the broker; absent when not\nreported."
          },
          "unrealised_pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Open (unbooked) P&L as reported by the broker; absent when not\nreported."
          },
          "day_pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Today's P&L, in rupees: a quantity carried in from earlier sessions\ncounts from the previous close, not its original cost. Absent when\nnot reported."
          },
          "lot_size": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Contract lot size (added when the instrument is known).",
            "minimum": 0
          },
          "broker_tradingsymbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's own spelling of the symbol, only when it differs\nfrom `tradingsymbol` (which always comes from the instrument\nlist)."
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exchange as the instrument list gives it (`NSE`, `BSE`, `MCX`,\n...): index options and futures are listed under the cash\nexchange (`NSE` for NIFTY, `BSE` for SENSEX), so match on what\n`GET /v1/instruments` returns, not on `NFO` / `BFO`."
          },
          "instrument_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Instrument type (`EQ`, `FUTIDX`, `OPTIDX`, `OPTSTK`, ...)."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Underlying symbol (the trading symbol for equities)."
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "description": "Expiry date (`YYYY-MM-DD`); empty for non-derivatives."
          },
          "strike": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Strike price; `0` for non-options."
          },
          "option_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`CE` / `PE`; empty for non-options."
          },
          "sector": {
            "type": [
              "string",
              "null"
            ],
            "description": "Industry sector; absent when the instrument list has none."
          },
          "isin": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISIN; absent when the instrument list has none."
          },
          "indices": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Index memberships (e.g. `NIFTY`, `NIFTY100`); absent when\nnone."
          },
          "instrument_missing": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Present (`true`) only when the instrument is not known; the\ninstrument fields above are then absent."
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Last traded price (added when a quote is available)."
          },
          "prev_close": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Previous close (`0` when unknown), sent with `ltp`."
          },
          "cirrus_token": {
            "type": "string",
            "deprecated": true
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "Product": {
        "type": "string",
        "description": "`MIS` (intraday), `CARRYFORWARD` (overnight derivatives, NRML),\n`DELIVERY` (equity delivery, CNC) or `MTF` (margin trading facility).",
        "enum": [
          "MIS",
          "CARRYFORWARD",
          "DELIVERY",
          "MTF"
        ]
      },
      "ProfileAuth": {
        "oneOf": [
          {
            "type": "object",
            "description": "Signed in to the app. `impersonated`: an operator acting as the user.",
            "required": [
              "impersonated",
              "scopes",
              "kind"
            ],
            "properties": {
              "impersonated": {
                "type": "boolean",
                "description": "`true` when an operator is acting as the user."
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Scope"
                },
                "description": "Always every scope."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "session"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "The user's own API key.",
            "required": [
              "key_id",
              "name",
              "scopes",
              "ip_allowlist",
              "kind"
            ],
            "properties": {
              "key_id": {
                "type": "string",
                "description": "The key's public id."
              },
              "name": {
                "type": "string",
                "description": "The user's name for the key."
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Scope"
                }
              },
              "ip_allowlist": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "IP addresses the key may be used from (empty: any address)."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "api_key"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "A partner app the user connected (OAuth).",
            "required": [
              "client_id",
              "name",
              "scopes",
              "kind"
            ],
            "properties": {
              "client_id": {
                "type": "string",
                "description": "The partner app's client id."
              },
              "name": {
                "type": "string",
                "description": "The partner app's name."
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Scope"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "partner"
                ]
              }
            }
          }
        ],
        "description": "The credential of this request, told apart by `kind`: `session` (the\nsigned-in app), `api_key` or `partner` (a connected partner app)."
      },
      "ProtectionRoute": {
        "type": "string",
        "description": "Where an order's protection lives: a broker `bracket` or `cover`\norder placed with the entry, a broker `gtt` placed once the entry\nfills, a server-side `trigger` armed once the entry fills, or a broker\n`stop_order` (a stop-loss order resting at the broker) protecting an\nexisting intraday position.",
        "enum": [
          "bracket",
          "cover",
          "gtt",
          "trigger",
          "stop_order"
        ]
      },
      "ProtectionSupportView": {
        "type": "object",
        "description": "Which broker-held protection orders in this account can use (the\n`protection.route` values besides `auto` and `trigger`, which every\naccount has). All `false` for an unsupported broker.",
        "required": [
          "bracket",
          "cover",
          "gtt",
          "gtt_two_leg"
        ],
        "properties": {
          "bracket": {
            "type": "boolean",
            "description": "Bracket orders (entry + stop-loss + target), intraday only."
          },
          "cover": {
            "type": "boolean",
            "description": "Cover orders (entry + stop-loss), intraday only."
          },
          "gtt": {
            "type": "boolean",
            "description": "GTT protection for carryforward / delivery positions."
          },
          "gtt_two_leg": {
            "type": "boolean",
            "description": "A GTT may hold a stop-loss and a target together; `false`: one leg."
          }
        }
      },
      "ReconSummary": {
        "type": "object",
        "required": [
          "status",
          "note"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/StrategyReconStatus",
            "description": "The worst over the strategy's open positions."
          },
          "note": {
            "type": "string",
            "description": "In plain English."
          }
        }
      },
      "RequestedRoute": {
        "type": "string",
        "description": "Where the caller wants the protection: `auto` (default) picks the\nbroker's own order type first and a server-side trigger otherwise;\n`bracket`, `cover`, `gtt`, `stop_order` (an existing intraday position\nonly) or `trigger` asks for that route, and the order is refused before\nthe broker when the account or order cannot use it. If the broker\nitself then refuses the bracket / cover (or the GTT once the entry\nfills), `fallback` decides: `trigger` (default) protects with a\nserver-side trigger instead, `reject` does not. A stop order the broker\nrefuses is always replaced by a server-side trigger (the position is\nnever left unprotected).",
        "enum": [
          "auto",
          "bracket",
          "cover",
          "gtt",
          "trigger",
          "stop_order"
        ]
      },
      "Rule": {
        "type": "object",
        "description": "One leg of protection.",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Off unless `true`."
          },
          "type": {
            "$ref": "#/components/schemas/RuleType"
          },
          "value": {
            "type": "number",
            "format": "double",
            "description": "Greater than 0 when enabled."
          }
        }
      },
      "RuleType": {
        "type": "string",
        "description": "How a rule's `value` is read: `percentage` of the entry price,\n`points` from it, or an absolute `price`. Case-insensitive in requests.",
        "enum": [
          "percentage",
          "points",
          "price"
        ]
      },
      "Rules": {
        "type": "object",
        "description": "Stop-loss, target and trailing stop-loss. Enable a stop-loss, a\ntarget or both; a trail needs a stop-loss and is `percentage` or\n`points`.",
        "properties": {
          "target": {
            "$ref": "#/components/schemas/Rule"
          },
          "stop_loss": {
            "$ref": "#/components/schemas/Rule"
          },
          "trail": {
            "$ref": "#/components/schemas/Rule"
          },
          "fallback": {
            "$ref": "#/components/schemas/Fallback",
            "description": "When the broker refuses a bracket / cover / GTT: `trigger`\n(default) or `reject`."
          },
          "route": {
            "$ref": "#/components/schemas/RequestedRoute",
            "description": "Where the protection should live when it is created (placing an\norder, or protecting an existing position with `POST /v1/triggers`,\nwhich takes `auto`, `gtt`, `stop_order` or `trigger`): `auto`\n(default), `bracket`, `cover`, `gtt`, `stop_order` or `trigger`; a\nroute that cannot be used is refused before the broker, and a\nbroker refusal follows `fallback`. Not stored with a trigger; refused when changing one."
          }
        }
      },
      "Scope": {
        "type": "string",
        "description": "What an API key or partner token may do: `read` (portfolio, orders,\ntriggers, GTT and activity reads; the stream), `orders` (place, modify,\ncancel and convert orders, bracket orders, GTT), `triggers` (create,\nchange and remove server-side triggers), `strategies` (create, change\nand delete automated strategies and their paper deployments),\n`strategies_live` (run strategies live, with `strategies`),\n`strategies_signal` (only post signals to a deployment), `webhooks` (create, change,\ndelete, test webhook receivers and rotate their secrets), `notifications`\n(change notification preferences) or `watchlists` (create, change and\ndelete watchlists). All but the first three are opt-in; reads need\n`read`. Partner apps may not hold `strategies_signal`, `webhooks`,\n`notifications` or `watchlists`, and may hold `strategies` and\n`strategies_live` only where the tenant enables agent access. App\nsessions may do everything.",
        "enum": [
          "read",
          "orders",
          "triggers",
          "strategies",
          "strategies_live",
          "strategies_signal",
          "webhooks",
          "notifications",
          "watchlists"
        ]
      },
      "ShareAccountScope": {
        "oneOf": [
          {
            "type": "string",
            "description": "Every account of the owner, current and future.",
            "enum": [
              "all"
            ]
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Only these account ids."
          }
        ],
        "description": "Which of the owner's accounts the share covers: `\"all\"` or a list of account ids."
      },
      "ShareScope": {
        "type": "string",
        "description": "What an owner shared: `login` (account list and login status), `funds`,\n`positions`, `holdings`, `open_orders`, `order_history`.",
        "enum": [
          "login",
          "funds",
          "positions",
          "holdings",
          "open_orders",
          "order_history"
        ]
      },
      "SharedAccount": {
        "type": "object",
        "description": "One shared account: non-secret facts only.",
        "required": [
          "client_id",
          "broker",
          "account_tag",
          "last_login_at",
          "logged_in_today"
        ],
        "properties": {
          "client_id": {
            "type": "string",
            "description": "The broker account id."
          },
          "broker": {
            "type": "string",
            "description": "Broker id (`zerodha`, `upstox`, ...)."
          },
          "account_tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "The owner's label for the account."
          },
          "last_login_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last broker login, as text (Unix seconds); `null` when unknown."
          },
          "logged_in_today": {
            "type": "boolean",
            "description": "Logged in since the start of the current trading day (08:00 IST)."
          }
        }
      },
      "SharedAccountCard": {
        "type": "object",
        "description": "One shared account on the consolidated screen. Balances need `funds`,\nP&L and counts `positions` (holdings count: `holdings`); the account\nfacts (`broker`, `account_tag`, `last_login_at`, `logged_in_today`) are\npresent only with `login`.",
        "required": [
          "client_id",
          "has_login",
          "has_funds",
          "has_positions",
          "opening_balance",
          "usable_balance",
          "utilisation",
          "pnl",
          "positions_count",
          "holdings_count",
          "updated_at",
          "missing",
          "open_orders_count",
          "failed_orders_count",
          "orders_updated_at"
        ],
        "properties": {
          "client_id": {
            "type": "string",
            "description": "The broker account id."
          },
          "has_login": {
            "type": "boolean",
            "description": "Whether `login` is shared (the account facts below are present)."
          },
          "has_funds": {
            "type": "boolean",
            "description": "Whether `funds` is shared."
          },
          "has_positions": {
            "type": "boolean",
            "description": "Whether `positions` is shared."
          },
          "opening_balance": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Opening balance; `null` without funds data."
          },
          "usable_balance": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Available funds; `null` without funds data."
          },
          "utilisation": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Funds in use; `null` without funds data."
          },
          "pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Sum of the positions' P&L; `null` without open positions."
          },
          "positions_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "holdings_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "broker": {
            "type": [
              "string",
              "null"
            ],
            "description": "With `login`: broker id."
          },
          "account_tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "With `login`: the owner's label for the account (may be `null`)."
          },
          "last_login_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "With `login`: last broker login (Unix seconds as text; may be `null`)."
          },
          "logged_in_today": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "With `login`: logged in since 08:00 IST today."
          },
          "updated_at": {
            "$ref": "#/components/schemas/SharedCardUpdatedAt"
          },
          "missing": {
            "$ref": "#/components/schemas/SharedCardMissing"
          },
          "open_orders_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Today's orders not yet final; `null` without `open_orders` or\nwithout order data.",
            "minimum": 0
          },
          "failed_orders_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Today's orders rejected or never confirmed after retries; `null`\nwithout `order_history` or without order data.",
            "minimum": 0
          },
          "orders_updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the orders were last read from the broker (the latest broker\nupdate of any order); `null` when unknown or not shared."
          }
        }
      },
      "SharedAccountData": {
        "type": "object",
        "description": "One shared account's data.",
        "required": [
          "account",
          "updated_at",
          "data"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "The broker account id."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the data was last read from the broker (orders: the latest\nbroker update); `null` when unknown."
          },
          "data": {
            "$ref": "#/components/schemas/SharedRows"
          }
        }
      },
      "SharedAccounts": {
        "type": "object",
        "description": "`accounts` view: the shared accounts.",
        "required": [
          "accounts"
        ],
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SharedAccount"
            }
          }
        }
      },
      "SharedCardMissing": {
        "type": "object",
        "description": "Shared kinds (`positions`, `margins`, `holdings`) with no data to\nshow, and why; kinds with data or not shared are left out.",
        "properties": {
          "positions": {
            "$ref": "#/components/schemas/SharedCardMissingEntry"
          },
          "margins": {
            "$ref": "#/components/schemas/SharedCardMissingEntry"
          },
          "holdings": {
            "$ref": "#/components/schemas/SharedCardMissingEntry"
          }
        }
      },
      "SharedCardMissingEntry": {
        "type": "object",
        "description": "Why a shared kind has no data on the card.",
        "required": [
          "code",
          "reason"
        ],
        "properties": {
          "code": {
            "$ref": "#/components/schemas/MissingCode",
            "description": "`no_session`, `not_supported` or `stale` (see `PortfolioMissing`)."
          },
          "reason": {
            "type": "string",
            "description": "Why, in plain English."
          }
        }
      },
      "SharedCardUpdatedAt": {
        "type": "object",
        "description": "When each kind of the card's data was last read from the broker;\n`null` when not shared or no current data.",
        "required": [
          "positions",
          "margins",
          "holdings"
        ],
        "properties": {
          "positions": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "margins": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "holdings": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "SharedOwnerAccountData": {
        "type": "object",
        "description": "One shared account's data, with its owner.",
        "required": [
          "owner_username",
          "owner_name",
          "account",
          "updated_at",
          "data"
        ],
        "properties": {
          "owner_username": {
            "type": "string",
            "description": "Username of the owner."
          },
          "owner_name": {
            "type": "string",
            "description": "The owner's display name."
          },
          "account": {
            "type": "string",
            "description": "The broker account id."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the data was last read from the broker (orders: the latest\nbroker update); `null` when unknown."
          },
          "data": {
            "$ref": "#/components/schemas/SharedRows"
          }
        }
      },
      "SharedOwnerMissing": {
        "type": "object",
        "description": "A shared account with no data to show (yet), with its owner.",
        "required": [
          "owner_username",
          "owner_name",
          "account",
          "code",
          "reason"
        ],
        "properties": {
          "owner_username": {
            "type": "string",
            "description": "Username of the owner."
          },
          "owner_name": {
            "type": "string",
            "description": "The owner's display name."
          },
          "account": {
            "type": "string",
            "description": "The broker account id."
          },
          "code": {
            "$ref": "#/components/schemas/MissingCode",
            "description": "`no_session`, `not_supported` or `stale` (see `PortfolioMissing`)."
          },
          "reason": {
            "type": "string",
            "description": "Why, in plain English."
          }
        }
      },
      "SharedOwnerSummary": {
        "type": "object",
        "description": "One owner on the consolidated screen: the share and its accounts.",
        "required": [
          "owner_username",
          "owner_name",
          "scopes",
          "account_scope",
          "accounts"
        ],
        "properties": {
          "owner_username": {
            "type": "string",
            "description": "Username of the owner."
          },
          "owner_name": {
            "type": "string",
            "description": "The owner's display name."
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShareScope"
            },
            "description": "What the owner shared."
          },
          "account_scope": {
            "$ref": "#/components/schemas/ShareAccountScope"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SharedAccountCard"
            }
          }
        }
      },
      "SharedPortfolio": {
        "type": "object",
        "description": "`positions`, `holdings`, `margins`, `open_orders` and `order_history`\nviews: one entry per shared account with data; the others under\n`missing`.",
        "required": [
          "accounts",
          "missing"
        ],
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SharedAccountData"
            }
          },
          "missing": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PortfolioMissing"
            }
          }
        }
      },
      "SharedPositionRow": {
        "type": "object",
        "description": "A position row from a shared account (see `PositionRow`) plus its owner.",
        "required": [
          "account",
          "instrument_token",
          "tradingsymbol",
          "product",
          "net_qty",
          "buy_qty",
          "sell_qty",
          "buy_value",
          "sell_value",
          "average_price",
          "buy_average_price",
          "sell_average_price",
          "pnl",
          "owner_username",
          "owner_name"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "instrument_token": {
            "type": "string"
          },
          "tradingsymbol": {
            "type": "string"
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "net_qty": {
            "type": "integer",
            "format": "int64",
            "description": "Positive long, negative short."
          },
          "buy_qty": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sell_qty": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "buy_value": {
            "type": "number",
            "format": "double"
          },
          "sell_value": {
            "type": "number",
            "format": "double"
          },
          "average_price": {
            "type": "number",
            "format": "double"
          },
          "buy_average_price": {
            "type": "number",
            "format": "double"
          },
          "sell_average_price": {
            "type": "number",
            "format": "double"
          },
          "pnl": {
            "type": "number",
            "format": "double",
            "description": "Mark-to-market P&L as reported by the broker (total: booked plus\nopen)."
          },
          "overnight_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Quantity carried in from earlier sessions: positive long, negative\nshort. Absent when the broker does not report it."
          },
          "day_buy_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Bought today (absent when the broker does not report it).",
            "minimum": 0
          },
          "day_sell_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Sold today (absent when the broker does not report it).",
            "minimum": 0
          },
          "day_buy_value": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Value bought today, in rupees (absent when not reported)."
          },
          "day_sell_value": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Value sold today, in rupees (absent when not reported)."
          },
          "realised_pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Booked (closed) P&L as reported by the broker; absent when not\nreported."
          },
          "unrealised_pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Open (unbooked) P&L as reported by the broker; absent when not\nreported."
          },
          "day_pnl": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Today's P&L, in rupees: a quantity carried in from earlier sessions\ncounts from the previous close, not its original cost. Absent when\nnot reported."
          },
          "lot_size": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Contract lot size (added when the instrument is known).",
            "minimum": 0
          },
          "broker_tradingsymbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's own spelling of the symbol, only when it differs\nfrom `tradingsymbol` (which always comes from the instrument\nlist)."
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exchange as the instrument list gives it (`NSE`, `BSE`, `MCX`,\n...): index options and futures are listed under the cash\nexchange (`NSE` for NIFTY, `BSE` for SENSEX), so match on what\n`GET /v1/instruments` returns, not on `NFO` / `BFO`."
          },
          "instrument_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Instrument type (`EQ`, `FUTIDX`, `OPTIDX`, `OPTSTK`, ...)."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Underlying symbol (the trading symbol for equities)."
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "description": "Expiry date (`YYYY-MM-DD`); empty for non-derivatives."
          },
          "strike": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Strike price; `0` for non-options."
          },
          "option_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`CE` / `PE`; empty for non-options."
          },
          "sector": {
            "type": [
              "string",
              "null"
            ],
            "description": "Industry sector; absent when the instrument list has none."
          },
          "isin": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISIN; absent when the instrument list has none."
          },
          "indices": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Index memberships (e.g. `NIFTY`, `NIFTY100`); absent when\nnone."
          },
          "instrument_missing": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Present (`true`) only when the instrument is not known; the\ninstrument fields above are then absent."
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Last traded price (added when a quote is available)."
          },
          "prev_close": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Previous close (`0` when unknown), sent with `ltp`."
          },
          "owner_username": {
            "type": "string",
            "description": "Username of the owner."
          },
          "owner_name": {
            "type": "string",
            "description": "The owner's display name."
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "SharedRows": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PositionRow"
            }
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HoldingRow"
            }
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderData"
            }
          },
          {
            "$ref": "#/components/schemas/MarginRow"
          }
        ],
        "description": "`positions`, `holdings`, `open_orders`, `order_history`: a list of rows (may be empty); `margins`: one object."
      },
      "SharedSkipReason": {
        "type": "string",
        "description": "Why an owner sharing with the caller is left out of a consolidated view.",
        "enum": [
          "not_shared",
          "unavailable"
        ]
      },
      "SharedSkippedOwner": {
        "type": "object",
        "description": "An owner left out of a consolidated view.",
        "required": [
          "owner_username",
          "reason"
        ],
        "properties": {
          "owner_username": {
            "type": "string",
            "description": "Username of the owner."
          },
          "reason": {
            "$ref": "#/components/schemas/SharedSkipReason"
          }
        }
      },
      "Side": {
        "type": "string",
        "description": "Order side.",
        "enum": [
          "BUY",
          "SELL"
        ]
      },
      "SignalDeliveryOutcome": {
        "type": "string",
        "description": "A delivery's result in one word: `placed` (every order it asked for\nwas placed), `partially_placed`, `failed` (orders were attempted, none\nplaced), `processed` (handled without new orders: levels updated,\nlifecycle event...), `ignored` (valid, but the strategy's rules meant\nnothing to do), `refused` (wrong secret or signature, unreadable\npayload), `duplicate` (the same alert again; skipped) or `rate_limited`\n(over the URL's limit; not processed).",
        "enum": [
          "placed",
          "partially_placed",
          "failed",
          "processed",
          "ignored",
          "refused",
          "duplicate",
          "rate_limited"
        ]
      },
      "SignalMode": {
        "type": "string",
        "description": "Where a Signals strategy's alerts go.",
        "enum": [
          "direct",
          "algo",
          "unknown"
        ]
      },
      "SignalModeInput": {
        "type": "object",
        "description": "`PUT /v2/signal-modes/{endpoint_id}`.",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "$ref": "#/components/schemas/SignalMode",
            "description": "`direct` or `algo`."
          },
          "deployment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "`algo`: one of the caller's running deployments whose strategy takes\nalerts on a signal URL (`webhook@1`). Absent for `direct`."
          }
        },
        "additionalProperties": false
      },
      "SignalProvider": {
        "type": "string",
        "description": "The signal provider a URL is for: `tradingview` (TradingView alerts),\n`chartink` (Chartink scanner alerts) or `kuberhunt` (Kuberhunt\nrecommendation events).",
        "enum": [
          "kuberhunt",
          "tradingview",
          "chartink"
        ]
      },
      "SignalUrlDelivery": {
        "type": "object",
        "description": "One request a signal URL received (never the payload or the secret).",
        "required": [
          "delivery_id",
          "at",
          "provider",
          "outcome",
          "reason",
          "orders_placed",
          "order_ids",
          "http_status",
          "request_id"
        ],
        "properties": {
          "delivery_id": {
            "type": "string",
            "description": "Delivery id (sorts by arrival)."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When it arrived."
          },
          "provider": {
            "$ref": "#/components/schemas/SignalProvider"
          },
          "outcome": {
            "$ref": "#/components/schemas/SignalDeliveryOutcome"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why, in plain words; null when there is nothing to explain."
          },
          "orders_placed": {
            "type": "integer",
            "format": "int64",
            "description": "Orders it placed (one per account slice).",
            "minimum": 0
          },
          "order_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Broker order ids of the orders it placed."
          },
          "http_status": {
            "type": "integer",
            "format": "int32",
            "description": "The HTTP status the provider was answered with.",
            "minimum": 0
          },
          "request_id": {
            "type": "string",
            "description": "The request's id, for support."
          }
        }
      },
      "SignalWouldPlace": {
        "type": "object",
        "description": "One order a delivery would place, per account, sized and priced as the\norder path would.",
        "required": [
          "account",
          "symbol",
          "exchange",
          "side",
          "qty",
          "order_type",
          "price",
          "product"
        ],
        "properties": {
          "account": {
            "type": "string",
            "description": "Account id."
          },
          "symbol": {
            "type": "string",
            "description": "Trading symbol."
          },
          "exchange": {
            "type": "string"
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "qty": {
            "type": "integer",
            "format": "int64",
            "description": "Quantity (units, not lots).",
            "minimum": 0
          },
          "order_type": {
            "$ref": "#/components/schemas/OrderType"
          },
          "price": {
            "type": "number",
            "format": "double",
            "description": "Limit price (0 for market orders)."
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          }
        }
      },
      "SliceReason": {
        "type": "string",
        "description": "Why a slice was not accepted, in machine-readable form.",
        "enum": [
          "rate_limited",
          "broker_rejected",
          "validation",
          "no_session",
          "dependency_failed",
          "protection_refused",
          "broker_timeout",
          "stale_quote"
        ]
      },
      "SliceResult": {
        "type": "object",
        "description": "The outcome of one order in one account (one slice; an order above\nthe exchange freeze quantity is split into several).",
        "required": [
          "order_index",
          "account",
          "instrument_token",
          "order_tag",
          "quantity",
          "status",
          "order_id",
          "message",
          "order_type",
          "price"
        ],
        "properties": {
          "order_index": {
            "type": "integer",
            "description": "Index of the order in the request.",
            "minimum": 0
          },
          "account": {
            "type": "string"
          },
          "instrument_token": {
            "type": "string",
            "description": "Instrument id."
          },
          "order_tag": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrderTag",
                "description": "Order tag for this slice; present once a broker call was attempted."
              },
              {
                "type": "null"
              }
            ]
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units sent to the broker (after lot and multiplier sizing).",
            "minimum": 0
          },
          "status": {
            "$ref": "#/components/schemas/SliceStatus"
          },
          "order_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Broker order id, when accepted. An accepted cover / bracket entry\ncan have none yet (the broker's reply did not name the entry): it\nshows up in the order book, and `GET /v1/orders/{order_tag}` finds\nit once the book has it."
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it was rejected, or what is unknown."
          },
          "order_type": {
            "$ref": "#/components/schemas/OrderType",
            "description": "Final order type/price after market protection."
          },
          "price": {
            "type": "number",
            "format": "double"
          },
          "protection": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ProtectionRoute",
                "description": "Where this slice's protection lives; absent for unprotected orders."
              },
              {
                "type": "null"
              }
            ]
          },
          "protection_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Broker basket id when the broker holds the legs from placement."
          },
          "reason": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SliceReason",
                "description": "Why it was not accepted (absent when accepted)."
              },
              {
                "type": "null"
              }
            ]
          },
          "retry_after_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "With `reason: rate_limited`: when a retry can succeed, in ms.",
            "minimum": 0
          },
          "client_tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "The order's `client_tag`, when it had one."
          },
          "reduced_from": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Planned units for this slice, when `depends_on_partial: filled_qty` sent fewer.",
            "minimum": 0
          },
          "trigger_v2_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The v2 trigger (`/v2/triggers/{trigger_id}`) that protects this\nslice once it fills, when its stop-loss / target is held by the\nserver as a v2 trigger: created on the first fill, for the filled\nquantity, levels measured from the fill price. Units filled later\nget triggers of their own (listed on `/v2/triggers`). Absent\notherwise (no protection, broker-held, or a v1 trigger)."
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token",
          "cirrus_tag": "order_tag"
        }
      },
      "SliceStatus": {
        "type": "string",
        "description": "`accepted` (the broker took it; fills arrive on the stream),\n`rejected` (refused before or by the broker; nothing was placed) or\n`unknown` (the broker may or may not have it, e.g. a timeout;\nreconciliation settles it: never retry blindly).",
        "enum": [
          "accepted",
          "rejected",
          "unknown"
        ]
      },
      "SnapshotData": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderData"
            }
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PositionRow"
            }
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HoldingRow"
            }
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TradeRow"
            }
          },
          {
            "$ref": "#/components/schemas/MarginRow"
          }
        ],
        "description": "`orders`, `positions`, `holdings`, `trades`: a list of rows (may be empty); `margins`: one object."
      },
      "SplitFrom": {
        "type": "object",
        "description": "The order a broker split into several orders, as it was placed. The\nbroker lists only the parts: the placed order's own id is never in its\norder book, so it is shown only here.",
        "required": [
          "order_id",
          "order_tag",
          "quantity"
        ],
        "properties": {
          "order_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker order id the placement returned; null when it named none."
          },
          "order_tag": {
            "$ref": "#/components/schemas/OrderTag",
            "description": "The `order_tag` the order was placed with (its first part keeps it)."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units the order was placed for.",
            "minimum": 0
          },
          "cirrus_tag": {
            "$ref": "#/components/schemas/OrderTag",
            "description": "The `order_tag` the order was placed with (its first part keeps it).",
            "deprecated": true
          }
        },
        "x-deprecated-aliases": {
          "cirrus_tag": "order_tag"
        }
      },
      "StatusChange": {
        "type": "object",
        "description": "One entry in an order's audit trail.",
        "required": [
          "from",
          "to",
          "at",
          "message"
        ],
        "properties": {
          "from": {
            "$ref": "#/components/schemas/OrderState"
          },
          "to": {
            "$ref": "#/components/schemas/OrderState"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's status text at this step, if any."
          }
        }
      },
      "StrategyAccount": {
        "type": "object",
        "description": "One account's part of a strategy.",
        "required": [
          "account",
          "at",
          "stale",
          "rows",
          "totals"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "As of: the older of the trades and positions the ledger was built\nfrom."
          },
          "stale": {
            "type": "boolean",
            "description": "The ledger was not rebuilt recently during market hours: numbers\nmay be behind."
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StrategyRow"
            }
          },
          "totals": {
            "$ref": "#/components/schemas/Totals"
          }
        }
      },
      "StrategyAnalytics": {
        "type": "object",
        "description": "Options analytics of the strategy's open positions.",
        "required": [
          "underlying",
          "spot",
          "model",
          "rate",
          "greeks",
          "breakevens",
          "max_profit",
          "max_profit_unlimited",
          "max_loss",
          "max_loss_unlimited",
          "note"
        ],
        "properties": {
          "underlying": {
            "type": [
              "string",
              "null"
            ],
            "description": "The underlying (e.g. `NIFTY`); null when the positions are not on\none underlying."
          },
          "spot": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The underlying's price used; null when not known."
          },
          "model": {
            "type": "string",
            "description": "`black_scholes` (on the underlying's price, dividend yield 0)."
          },
          "rate": {
            "type": "number",
            "format": "double",
            "description": "Annual risk-free rate used, e.g. `0.065`."
          },
          "greeks": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StrategyGreeks",
                "description": "Of every open leg; null when an option leg has no IV."
              },
              {
                "type": "null"
              }
            ]
          },
          "breakevens": {
            "type": "array",
            "items": {
              "type": "number",
              "format": "double"
            },
            "description": "Prices of the underlying where the P&L at expiry crosses zero\n(exact, also outside the payoff range), ascending."
          },
          "max_profit": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Highest P&L at expiry of the open positions; null when unlimited\n(or not computed)."
          },
          "max_profit_unlimited": {
            "type": "boolean",
            "description": "The P&L at expiry keeps rising as the underlying rises."
          },
          "max_loss": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Lowest P&L at expiry (negative: a loss); null when unlimited (or\nnot computed)."
          },
          "max_loss_unlimited": {
            "type": "boolean",
            "description": "The P&L at expiry keeps falling as the underlying rises."
          },
          "probability_of_profit": {
            "type": "number",
            "format": "double",
            "description": "Chance (0 to 1) that the P&L at expiry is above zero: risk-neutral,\nthe underlying lognormal from `spot` at `rate`, one volatility (the\noption legs' IVs averaged, weighted by each leg's |vega|) to the\noptions' common expiry. Absent (with a `note`) when an option leg\nhas no IV, the options expire on different dates, or there is no\noption leg.",
            "maximum": 1,
            "minimum": 0
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "What was left out and why, in plain English; null when nothing."
          },
          "legs": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/StrategyAnalyticsLeg"
            },
            "description": "Per leg (`GET /v1/strategies/{name}` only)."
          },
          "payoff": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StrategyPayoff",
                "description": "The payoff curves (`GET /v1/strategies/{name}` only)."
              },
              {
                "type": "null"
              }
            ]
          },
          "scenario": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StrategyScenario",
                "description": "Spot × IV scenario grid (`GET /v1/strategies/{name}?scenario=1`\nonly, when every option leg has an IV)."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "StrategyAnalyticsLeg": {
        "type": "object",
        "description": "One option or future leg.",
        "required": [
          "instrument_token",
          "tradingsymbol",
          "instrument",
          "option_type",
          "strike",
          "expiry",
          "days_to_expiry",
          "net_qty",
          "avg_price",
          "ltp",
          "iv_pct",
          "greeks",
          "note"
        ],
        "properties": {
          "instrument_token": {
            "type": "string"
          },
          "tradingsymbol": {
            "type": "string"
          },
          "instrument": {
            "type": "string",
            "description": "`option` or `future`."
          },
          "option_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`CE` or `PE`; null for a future."
          },
          "strike": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "description": "`YYYY-MM-DD`."
          },
          "days_to_expiry": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Calendar days to 15:30 IST of the expiry day."
          },
          "net_qty": {
            "type": "integer",
            "format": "int64",
            "description": "Units, summed over accounts."
          },
          "avg_price": {
            "type": "number",
            "format": "double"
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "iv_pct": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Implied volatility from `ltp`, in percent; null when it cannot be\nsolved (see `note`)."
          },
          "greeks": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StrategyGreeks",
                "description": "Of the whole leg (`net_qty` units); null without an IV."
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "StrategyGreeks": {
        "type": "object",
        "description": "Net greeks of a position, in the units traders read.",
        "required": [
          "delta",
          "gamma",
          "theta_per_day",
          "vega_per_vol_point"
        ],
        "properties": {
          "delta": {
            "type": "number",
            "format": "double",
            "description": "P&L change for a 1-point rise of the underlying."
          },
          "gamma": {
            "type": "number",
            "format": "double",
            "description": "Change of `delta` for a 1-point rise of the underlying."
          },
          "theta_per_day": {
            "type": "number",
            "format": "double",
            "description": "P&L change over one calendar day, everything else unchanged."
          },
          "vega_per_vol_point": {
            "type": "number",
            "format": "double",
            "description": "P&L change for a 1-point (1%) rise of implied volatility."
          }
        }
      },
      "StrategyLedgerMissing": {
        "type": "object",
        "required": [
          "account",
          "code",
          "reason"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "code": {
            "$ref": "#/components/schemas/StrategyLedgerMissingCode"
          },
          "reason": {
            "type": "string",
            "description": "Why, in plain English."
          }
        }
      },
      "StrategyLedgerMissingCode": {
        "type": "string",
        "description": "Why an account has no ledger to show.",
        "enum": [
          "not_available_yet",
          "unreadable"
        ]
      },
      "StrategyPayoff": {
        "type": "object",
        "description": "P&L of the open positions over a range of the underlying's price.",
        "required": [
          "spots",
          "at_expiry",
          "today"
        ],
        "properties": {
          "spots": {
            "type": "array",
            "items": {
              "type": "number",
              "format": "double"
            },
            "description": "Prices of the underlying, ascending (± 10% around `spot`)."
          },
          "at_expiry": {
            "type": "array",
            "items": {
              "type": "number",
              "format": "double"
            },
            "description": "At expiry (every option at its intrinsic value), per spot."
          },
          "today": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "number",
              "format": "double"
            },
            "description": "Today, at the legs' implied volatilities, per spot; null when an\noption leg has no IV."
          }
        }
      },
      "StrategyReconStatus": {
        "type": "string",
        "description": "Whether the strategy's open positions add up to the broker's.",
        "enum": [
          "ok",
          "pending",
          "mismatch"
        ]
      },
      "StrategyRow": {
        "type": "object",
        "description": "One instrument and product of a strategy in one account.",
        "required": [
          "instrument_token",
          "symbol",
          "tradingsymbol",
          "product",
          "net_qty",
          "avg_price",
          "realized",
          "ltp",
          "ltp_stale",
          "unrealized"
        ],
        "properties": {
          "instrument_token": {
            "type": "string",
            "description": "Instrument id (see `/v1/instruments`)."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Underlying (e.g. `NIFTY`) or the stock's name; null when the\ninstrument is not in the instrument list."
          },
          "tradingsymbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "The instrument list's trading symbol; null as `symbol`."
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "net_qty": {
            "type": "integer",
            "format": "int64",
            "description": "`+` long, `-` short, in units."
          },
          "avg_price": {
            "type": "number",
            "format": "double",
            "description": "Average price of the open quantity (`0` when flat)."
          },
          "realized": {
            "type": "number",
            "format": "double",
            "description": "Booked today (no charges)."
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Latest price; null when none is known."
          },
          "ltp_stale": {
            "type": "boolean",
            "description": "`ltp` is not current (older than a minute, of unknown time, or\nmissing): `unrealized` is computed from it anyway, or null when\nthere is no price at all. Always `false` for a flat row."
          },
          "unrealized": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "`net_qty × (ltp − avg_price)`; `0` when flat, null when open\nwithout a price."
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "StrategyScenario": {
        "type": "object",
        "description": "P&L today of the open positions for each IV shift (rows) and spot\nshift (columns).",
        "required": [
          "spot_shifts_pct",
          "iv_shifts",
          "today_pnl"
        ],
        "properties": {
          "spot_shifts_pct": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Spot moves, percent from `spot`: −5 to +5."
          },
          "iv_shifts": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "IV moves, volatility points added to every option leg's IV."
          },
          "today_pnl": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number",
                "format": "double"
              }
            },
            "description": "`today_pnl[i][j]`: P&L with IV shift `iv_shifts[i]` and spot shift\n`spot_shifts_pct[j]`, today."
          }
        }
      },
      "StrategyTrigger": {
        "type": "object",
        "description": "A v2 trigger of the strategy.",
        "required": [
          "trigger_id",
          "account",
          "kind",
          "state",
          "ended"
        ],
        "properties": {
          "trigger_id": {
            "type": "string"
          },
          "account": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/TriggerV2Kind"
          },
          "state": {
            "type": "string",
            "description": "As `TriggerV2View.state`."
          },
          "ended": {
            "type": "boolean",
            "description": "The trigger can no longer change."
          }
        }
      },
      "StrategyView": {
        "type": "object",
        "description": "One strategy across the user's accounts.",
        "required": [
          "name",
          "label",
          "accounts",
          "totals",
          "recon",
          "at"
        ],
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The strategy's name; null for the unassigned rest."
          },
          "label": {
            "type": "string",
            "description": "The name, or `Unassigned`."
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StrategyAccount"
            },
            "description": "Per account, by account id."
          },
          "totals": {
            "$ref": "#/components/schemas/Totals",
            "description": "Across `accounts`."
          },
          "recon": {
            "$ref": "#/components/schemas/ReconSummary"
          },
          "at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "As of: the oldest ledger it is built from; null without one."
          },
          "analytics": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StrategyAnalytics",
                "description": "Options analytics of the open positions (IV, greeks, payoff), for\na strategy whose open positions are all options / futures on one\nunderlying; absent otherwise. `GET /v1/strategies` has the summary,\n`GET /v1/strategies/{name}` adds `legs` and `payoff`."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "SuccessStatus": {
        "type": "string",
        "description": "Always `success`.",
        "enum": [
          "success"
        ]
      },
      "Success_AccountDetail": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "allOf": [
              {
                "type": "object",
                "description": "One linked broker account and whether it can trade. Never a\ncredential.",
                "required": [
                  "account",
                  "broker",
                  "broker_name",
                  "tag",
                  "multiplier",
                  "supported",
                  "status",
                  "missing",
                  "updates",
                  "static_ip",
                  "last_login_at",
                  "session_expires_at",
                  "seat_assigned",
                  "last_update_at",
                  "protection",
                  "warnings"
                ],
                "properties": {
                  "account": {
                    "type": "string",
                    "description": "Account id (the broker's client code), as used in an order's\n`accounts` and the `account` filters."
                  },
                  "broker": {
                    "type": "string",
                    "description": "Broker id (`zerodha`, `upstox`, `paper`, ...)."
                  },
                  "broker_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Broker display name; null for an unknown broker."
                  },
                  "tag": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The user's own label for the account."
                  },
                  "multiplier": {
                    "type": "number",
                    "format": "double",
                    "description": "Quantity multiplier applied when an order is placed in this account."
                  },
                  "supported": {
                    "type": "boolean",
                    "description": "Whether the broker is supported for trading."
                  },
                  "status": {
                    "$ref": "#/components/schemas/AccountReadiness"
                  },
                  "missing": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/AccountMissingField"
                    },
                    "description": "Fields the account lacks (empty when complete)."
                  },
                  "updates": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/AccountUpdates",
                        "description": "Null for an unsupported broker."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "static_ip": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The account's static IP as the broker sees it (what the user\nregisters): an IPv6 seat's `whitelist_ip`, else `ip`. Null when none\nis assigned."
                  },
                  "last_login_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "Last broker login."
                  },
                  "session_expires_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "When the broker session expires; null when there is no active\nsession (always null for paper accounts, which need none)."
                  },
                  "seat_assigned": {
                    "type": [
                      "boolean",
                      "null"
                    ],
                    "description": "Whether the account has a trading seat assigned (null when unknown)."
                  },
                  "last_update_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "When the order book was last read from the broker."
                  },
                  "protection": {
                    "$ref": "#/components/schemas/ProtectionSupportView"
                  },
                  "warnings": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "What needs fixing on the account although it may be `ready`, as\nsnake_case codes (empty when nothing). `static_ip_not_registered`:\nthe broker refused an order because no static IP is registered for\nthe account's API app; register `static_ip` at the broker (cleared\nby the account's next accepted order). More codes may be added:\nshow an unknown one as is."
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "health"
                ],
                "properties": {
                  "health": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/AccountHealth",
                        "description": "Null when no live worker has reported for the account recently."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            ],
            "description": "One linked broker account plus what its live worker last reported."
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AccountList": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The caller's linked broker accounts, sorted by id.",
            "required": [
              "items"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AccountView"
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_ActivityPage": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "One page of a day's activity, newest first.",
            "required": [
              "items",
              "next_cursor",
              "source"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ActivityRecord"
                },
                "description": "Records without `timeline` (see `GET /v1/activity/{id}`)."
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Pass as `cursor` for the next (older) page; null on the last page."
              },
              "source": {
                "$ref": "#/components/schemas/ActivityPageSource"
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_ActivityRecord": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "One activity-log record: something that happened to the user's\naccounts, in plain English, with the per-account results.",
            "required": [
              "id",
              "username",
              "at",
              "kind",
              "category",
              "source",
              "request_id",
              "instrument",
              "side",
              "order_type",
              "product",
              "quantity",
              "price",
              "trigger_price",
              "summary",
              "message",
              "outcome",
              "duration_ms",
              "accounts"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "ULID (sorts by creation time)."
              },
              "username": {
                "type": "string"
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "description": "When the action started. For a dependent order (`depends_on`):\nwhen its wait for the parent ended and it was sent (or refused)."
              },
              "kind": {
                "$ref": "#/components/schemas/ActivityKind"
              },
              "category": {
                "$ref": "#/components/schemas/ActivityCategory"
              },
              "source": {
                "$ref": "#/components/schemas/ActivitySource"
              },
              "request_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The `x-request-id` of the API call that started it, if any."
              },
              "instrument": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ActivityInstrument"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "side": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Side"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "order_type": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`MARKET`, `LIMIT`, `SL` or `SL_M`."
              },
              "product": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`MIS`, `CARRYFORWARD`, `DELIVERY` or `MTF`."
              },
              "quantity": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "minimum": 0
              },
              "price": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double"
              },
              "trigger_price": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double"
              },
              "order_tag": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/OrderTag",
                    "description": "The order this record is about, when it is about one order (a\nfill, a rejection, protection armed / failed for an entry)."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "summary": {
                "type": "string"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Plain reason for records without a per-account result (an ignored\nsignal, a lost session, protection that failed...)."
              },
              "outcome": {
                "$ref": "#/components/schemas/ActivityOutcome"
              },
              "duration_ms": {
                "type": "integer",
                "format": "int64",
                "description": "How long the action took. For a dependent order: from its send\nto the brokers' answer (the wait for its parent is not counted).",
                "minimum": 0
              },
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AccountResult"
                }
              },
              "depends_on": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ActivityDependsOn",
                    "description": "Only on records of a dependent order (`depends_on`)."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "timeline": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/TimelineEntry"
                },
                "description": "Only on detail responses and in the archive."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AmendResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The broker's answer to a modify or cancel. `status`: `accepted` (the\nbroker took the change; the order book follows on the stream),\n`rejected` (refused, e.g. by the broker or the account's order rate\nlimit; `message` says why) or `unknown` (no answer in time: check the\norder book before retrying).",
            "required": [
              "account",
              "order_id",
              "status",
              "message"
            ],
            "properties": {
              "account": {
                "type": "string"
              },
              "order_id": {
                "type": "string"
              },
              "status": {
                "$ref": "#/components/schemas/SliceStatus"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why it was rejected, or what is unknown; null when accepted."
              },
              "reason": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SliceReason",
                    "description": "Why it was not accepted, machine-readable (absent when accepted)."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "retry_after_ms": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "With `reason: rate_limited`: when a retry can succeed, in ms.",
                "minimum": 0
              },
              "warning": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Something the caller must act on although the change was accepted\n(e.g. a filled bracket / cover entry cancelled with `legs=true`:\nits position is now unprotected). Absent otherwise."
              },
              "split_orders": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PartResult"
                },
                "description": "For the id a placement returned when the broker split that order\ninto several orders (each order's `split_from`): one result per\nopen order it was split into, which this call changed or cancelled.\nAbsent otherwise."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoCredits": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Your platform credits.",
            "required": [
              "balance",
              "entries"
            ],
            "properties": {
              "balance": {
                "type": "integer",
                "format": "int64"
              },
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoCreditEntry"
                },
                "description": "The latest changes, newest first (at most 50)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoDeployment": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A deployment: one version on 1 to 4 accounts, paper or live.",
            "required": [
              "id",
              "strategy_id",
              "version",
              "mode",
              "status",
              "strategy_tag",
              "accounts",
              "units",
              "acknowledged",
              "compiled_hash",
              "engine_connected",
              "created_at",
              "updated_at"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "strategy_id": {
                "type": "string"
              },
              "strategy_name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The strategy's name when it was deployed (absent on deployments made\nbefore names were kept)."
              },
              "version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "mode": {
                "$ref": "#/components/schemas/AutoMode"
              },
              "status": {
                "$ref": "#/components/schemas/AutoDeploymentStatus",
                "description": "`active`, `paused`, `error` or `stopped` (`unknown`: unreadable,\ntreated as needing attention)."
              },
              "status_reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "strategy_tag": {
                "type": "string",
                "description": "Stamped on every order (`auto.` + 12 characters of the id)."
              },
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoAccountView"
                }
              },
              "units": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoUnitView"
                }
              },
              "universe": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoUniverse",
                    "description": "A watchlist deployment's universe (`spec.stock.watchlist_id`);\nabsent otherwise."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "start_on": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "end_on": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "acknowledged": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "compiled_hash": {
                "type": "string"
              },
              "last_intent": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoIntentView"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "engine_connected": {
                "type": "boolean",
                "description": "Whether intents reach the strategy engine yet."
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "stopped_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "pnl": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoPnl",
                    "description": "Today's P&L of its orders (from the strategy ledgers, by\n`strategy_tag`; `GET /v2/deployments/{id}` and the strategy's\ndeployment list only); absent when the ledgers cannot be read just\nnow."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "safety_pauses": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/AutoSafetyPause"
                },
                "description": "Accounts whose safety pause (circuit breaker) has tripped, with\nwhat it saw (`GET /v2/deployments/{id}` and the strategy's\ndeployment list only); empty when none has. Absent when the\ndeployment is stopped or the engine is not connected or did not\nanswer."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoDryRunResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "required": [
              "decision",
              "text",
              "legs",
              "validation"
            ],
            "properties": {
              "decision": {
                "$ref": "#/components/schemas/AutoDecision"
              },
              "text": {
                "type": "string",
                "description": "The decision in plain words."
              },
              "legs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoResolvedLegPreview"
                },
                "description": "Contracts it would trade now (when they could be picked)."
              },
              "net_premium": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "Net premium per cycle of those legs: positive pays, negative\nreceives (₹)."
              },
              "validation": {
                "$ref": "#/components/schemas/AutoStrategyValidation"
              },
              "analytics": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/StrategyAnalytics",
                    "description": "Of `legs` as if entered now at their premiums: the payoff at expiry\nand today, breakevens, max profit / loss (with the unlimited\nflags), probability of profit, per-leg IV and greeks, and the spot\n× IV grid. Absent when no contracts were picked or they are not\noptions / futures (`analytics_note` says why)."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "margin_estimate": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoMarginEstimate",
                    "description": "A rough margin figure for `legs`; absent without `analytics` or\nthe underlying's price."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "analytics_note": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why `analytics` is absent, in plain English."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoGalleryEarnings": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Your earnings as an author (platform credits you can spend; no payouts).",
            "required": [
              "author_share_pct",
              "sales",
              "credits_earned",
              "templates"
            ],
            "properties": {
              "author_share_pct": {
                "type": "integer",
                "format": "int32",
                "description": "Your share of each sale now, percent.",
                "minimum": 0
              },
              "sales": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "credits_earned": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "templates": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoGalleryTemplateEarnings"
                },
                "description": "Per template, most earned first."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoGalleryEligibility": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The response.",
            "required": [
              "strategy_id",
              "version",
              "required_cycles",
              "badges"
            ],
            "properties": {
              "strategy_id": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "format": "int32",
                "description": "The saved version checked.",
                "minimum": 0
              },
              "required_cycles": {
                "type": "integer",
                "format": "int32",
                "description": "Finished trades a listing needs.",
                "minimum": 0
              },
              "badges": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoGalleryBadgeEligibility"
                },
                "description": "`paper` and `live`."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoGalleryListing": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A listing as anyone signed in sees it. Never the author's username,\naccounts, capital, rupee amounts or quantities.",
            "required": [
              "listing_id",
              "name",
              "description",
              "tags",
              "underlying",
              "summary",
              "author",
              "badge",
              "label",
              "performance",
              "price_credits",
              "effective_price",
              "is_free",
              "price_reason",
              "non_refundable",
              "copies",
              "listed_at",
              "can_copy",
              "mine"
            ],
            "properties": {
              "listing_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "underlying": {
                "type": "string"
              },
              "summary": {
                "type": "string",
                "description": "The strategy in plain English."
              },
              "author": {
                "type": "string",
                "description": "The author's chosen display name."
              },
              "badge": {
                "$ref": "#/components/schemas/AutoGalleryBadge"
              },
              "label": {
                "type": "string",
                "description": "\"Past results on paper (simulated); not advice.\""
              },
              "performance": {
                "$ref": "#/components/schemas/AutoGalleryPerformance"
              },
              "price_credits": {
                "type": "integer",
                "format": "int64",
                "description": "What it costs you now (0: free); the same as `effective_price`.",
                "minimum": 0
              },
              "effective_price": {
                "type": "integer",
                "format": "int64",
                "description": "What it costs you now: 0 while paid templates are off, during a\n\"make all free\" promotion, or when staff made it free.",
                "minimum": 0
              },
              "is_free": {
                "type": "boolean"
              },
              "price_reason": {
                "type": "string",
                "description": "Why: `paid_disabled`, `promotion`, `admin_free`, `unpriced` or\n`priced`."
              },
              "non_refundable": {
                "type": "boolean",
                "description": "True when it costs something: purchases are non-refundable."
              },
              "copies": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "listed_at": {
                "type": "string"
              },
              "can_copy": {
                "type": "boolean",
                "description": "You may copy it now (free, bought, or yours)."
              },
              "mine": {
                "type": "boolean",
                "description": "It is yours."
              },
              "document": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "The version's document (detail only, when you may copy it)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoGalleryMyListing": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The author's own listing: the public view plus its review.",
            "required": [
              "listing",
              "strategy_id",
              "version",
              "status",
              "review_notes",
              "capital",
              "purchases",
              "asking_price_credits",
              "admin_free"
            ],
            "properties": {
              "listing": {
                "$ref": "#/components/schemas/AutoGalleryListing",
                "description": "The listing as others see it once approved."
              },
              "strategy_id": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "status": {
                "type": "string",
                "description": "`pending`, `approved`, `rejected`, `taken_down` or `withdrawn`."
              },
              "review_notes": {
                "type": "string",
                "description": "The reviewers' note, when they left one."
              },
              "capital": {
                "type": "number",
                "format": "double",
                "description": "The capital you declared (₹, seen by you and reviewers only)."
              },
              "purchases": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "asking_price_credits": {
                "type": "integer",
                "format": "int64",
                "description": "The price you set (kept while paid templates are off or staff made\nit free; it applies again when they are back).",
                "minimum": 0
              },
              "admin_free": {
                "type": "boolean",
                "description": "Staff made it free."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoGalleryPricing": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The tenant's paid-template settings (shows \"Free\" correctly).",
            "required": [
              "paid_enabled",
              "all_free",
              "min_price_credits",
              "max_price_credits",
              "author_share_pct",
              "non_refundable",
              "purchases_available"
            ],
            "properties": {
              "paid_enabled": {
                "type": "boolean",
                "description": "Paid templates are on (`OMS_AUTO_GALLERY_PAID`); off: every listing\nis free and authors can't set a price."
              },
              "all_free": {
                "type": "boolean",
                "description": "Staff's \"make all free\" promotion is on."
              },
              "min_price_credits": {
                "type": "integer",
                "format": "int64",
                "description": "The prices an author may set (credits).",
                "minimum": 0
              },
              "max_price_credits": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "author_share_pct": {
                "type": "integer",
                "format": "int32",
                "description": "The author's share of each sale, percent (the rest is the platform's).",
                "minimum": 0
              },
              "non_refundable": {
                "type": "boolean",
                "description": "Always true: purchases are non-refundable."
              },
              "purchases_available": {
                "type": "boolean",
                "description": "Credits can be charged right now (paid on and configured)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoGalleryPurchase": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "What a purchase answers.",
            "required": [
              "listing_id",
              "charged",
              "balance"
            ],
            "properties": {
              "listing_id": {
                "type": "string"
              },
              "charged": {
                "type": "integer",
                "format": "int64",
                "description": "Credits it cost (0 when you owned it already).",
                "minimum": 0
              },
              "balance": {
                "type": "integer",
                "format": "int64",
                "description": "Your credits now."
              },
              "receipt": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoGalleryReceipt",
                    "description": "The receipt (purchases are non-refundable)."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "copy": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoImportResult",
                    "description": "Your copy, made with the purchase (absent when you owned it already)."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoImportResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The draft an import created, with what checking it found.",
            "required": [
              "strategy",
              "validation"
            ],
            "properties": {
              "strategy": {
                "$ref": "#/components/schemas/AutoStrategy"
              },
              "validation": {
                "$ref": "#/components/schemas/AutoStrategyValidation"
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoJourneyPage": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A page of a deployment's journey, newest first.",
            "required": [
              "entries"
            ],
            "properties": {
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoJourneyEntry"
                }
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Pass as `cursor` for the next (older) page; null at the end."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoLiveView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "required": [
              "deployment_id",
              "engine_connected",
              "units"
            ],
            "properties": {
              "deployment_id": {
                "type": "string"
              },
              "engine_connected": {
                "type": "boolean"
              },
              "units": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoUnitLive"
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoRiskLimits": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The user's overall risk limits.",
            "required": [
              "close_on_breach"
            ],
            "properties": {
              "max_daily_loss": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "₹; `null`: no daily loss limit."
              },
              "max_open_exposure": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "₹; `null`: no open exposure limit."
              },
              "close_on_breach": {
                "type": "boolean",
                "description": "A breached daily loss also closes open trades."
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "When they were last changed; `null`: never set."
              },
              "today": {
                "$ref": "#/components/schemas/AutoRiskToday",
                "description": "Today across every automated strategy: on `GET` only, and absent\nwhen the strategy ledgers can't be read now."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoSharedStrategy": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A strategy someone shared with the caller: read-only, the newest\nsaved version only. Never carries accounts, deployments, orders, P&L,\njourneys, webhooks or secrets.",
            "required": [
              "strategy_id",
              "name",
              "description",
              "tags",
              "owner",
              "version",
              "summary",
              "read_only"
            ],
            "properties": {
              "strategy_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "owner": {
                "type": "string",
                "description": "The owner, shortened (`@prat…`)."
              },
              "version": {
                "type": "integer",
                "format": "int32",
                "description": "The saved version shown (forks pin it).",
                "minimum": 0
              },
              "summary": {
                "type": "string",
                "description": "The version in plain English."
              },
              "read_only": {
                "type": "boolean",
                "description": "Always true: viewers cannot edit, deploy or see runs."
              },
              "document": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "The version's document, normalized. Absent in lists."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoSharing": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The owner's view of a strategy's sharing.",
            "required": [
              "strategy_id",
              "visibility",
              "shared_with",
              "shared_version"
            ],
            "properties": {
              "strategy_id": {
                "type": "string"
              },
              "visibility": {
                "$ref": "#/components/schemas/AutoVisibility"
              },
              "shared_with": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "link": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoShareLink",
                    "description": "The share link, when one is live."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shared_version": {
                "type": "integer",
                "format": "int32",
                "description": "The version viewers see (the newest saved one).",
                "minimum": 0
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoSignalResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "required": [
              "signal_id",
              "delivered",
              "units"
            ],
            "properties": {
              "signal_id": {
                "type": "string"
              },
              "delivered": {
                "type": "boolean",
                "description": "Whether the engine took it; false: queued."
              },
              "units": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoUnitAnswerView"
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoStockStatusList": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The response.",
            "required": [
              "trading_day",
              "circuit_gap_pct",
              "stocks"
            ],
            "properties": {
              "trading_day": {
                "type": "string",
                "description": "Today (`YYYY-MM-DD`, IST): the day the lists must be for."
              },
              "circuit_gap_pct": {
                "type": "number",
                "format": "double",
                "description": "The circuit gap used (percent of the limit)."
              },
              "stocks": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoStockStatus"
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoStopAllResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "required": [
              "stopped",
              "exit_now",
              "delivered"
            ],
            "properties": {
              "stopped": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Deployments stopped."
              },
              "left_running": {
                "type": "integer",
                "description": "Running deployments left alone because they act on accounts the\nMCP connection's limits do not allow. Left out when 0, so every\nother caller's answer is unchanged.",
                "minimum": 0
              },
              "exit_now": {
                "type": "boolean"
              },
              "delivered": {
                "type": "boolean",
                "description": "Whether every stop reached the engine."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoStrategy": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A strategy with its draft.",
            "required": [
              "id",
              "name",
              "description",
              "tags",
              "display_status",
              "latest_version",
              "revision",
              "visibility",
              "archived",
              "deployments",
              "summary",
              "deployable",
              "blockers",
              "warnings",
              "schema_version",
              "draft",
              "created_at",
              "updated_at"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "display_status": {
                "$ref": "#/components/schemas/AutoDisplayStatus"
              },
              "latest_version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "revision": {
                "type": "integer",
                "format": "int64",
                "description": "Send it back on update to refuse overwriting a newer draft.",
                "minimum": 0
              },
              "visibility": {
                "$ref": "#/components/schemas/AutoVisibility",
                "description": "`private`, or (sharing on) `users` / `link`."
              },
              "forked_from": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoForkedFromView"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "archived": {
                "type": "boolean"
              },
              "deployments": {
                "$ref": "#/components/schemas/AutoDeploymentCounts"
              },
              "summary": {
                "type": "string",
                "description": "The draft in plain English."
              },
              "deployable": {
                "type": "boolean",
                "description": "The draft has no blockers."
              },
              "blockers": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoStrategyProblem"
                }
              },
              "warnings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoStrategyProblem"
                }
              },
              "schema_version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "draft": {
                "type": "object",
                "description": "The draft document, normalized (defaults written out)."
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "update_available": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AutoUpdateAvailable",
                    "description": "On a fork whose source (still shared with you) has a newer saved\nversion. Your draft and deployments never change on their own."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoStrategyExport": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A document exported: `document` for JSON, `content` (text) for YAML.",
            "required": [
              "format",
              "filename",
              "schema_version"
            ],
            "properties": {
              "format": {
                "type": "string",
                "description": "`json` or `yaml`."
              },
              "filename": {
                "type": "string",
                "description": "Suggested file name (`<name>.strategy.yaml` or `.json`)."
              },
              "version": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "description": "The exported version (null: the draft).",
                "minimum": 0
              },
              "schema_version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "document": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "document_yaml": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The YAML text (for `format=yaml`)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoStrategyValidation": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "What checking a document found.",
            "required": [
              "ok",
              "deployable",
              "schema_version",
              "errors",
              "blockers",
              "warnings",
              "needs_ack",
              "components"
            ],
            "properties": {
              "ok": {
                "type": "boolean",
                "description": "No errors: the document can be saved."
              },
              "deployable": {
                "type": "boolean",
                "description": "No errors and no blockers: a version of it can be deployed."
              },
              "schema_version": {
                "type": "integer",
                "format": "int32",
                "description": "Format of the checked document (after migration).",
                "minimum": 0
              },
              "migrated_from": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "description": "The format it was written in, when older (it was migrated).",
                "minimum": 0
              },
              "errors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoStrategyProblem"
                },
                "description": "Refused: fix these to save."
              },
              "blockers": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoStrategyProblem"
                },
                "description": "Saved as a draft, not deployable until resolved."
              },
              "warnings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoStrategyProblem"
                }
              },
              "needs_ack": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Warning codes to acknowledge at deploy (`unlimited_loss`)."
              },
              "summary": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The strategy in plain English."
              },
              "compiled_hash": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Hash of the compiled spec (same for any way of writing the same\nstrategy)."
              },
              "components": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "`name@major` of every component used."
              },
              "warm_up": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Indicator warm-up (from the engine; null until it is connected)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_AutoStrategyVersion": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "An immutable version.",
            "required": [
              "strategy_id",
              "n",
              "schema_version",
              "compiled_hash",
              "components",
              "summary",
              "deployable",
              "blockers",
              "warnings",
              "created_at"
            ],
            "properties": {
              "strategy_id": {
                "type": "string"
              },
              "n": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "schema_version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "compiled_hash": {
                "type": "string"
              },
              "components": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "summary": {
                "type": "string"
              },
              "deployable": {
                "type": "boolean"
              },
              "blockers": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoStrategyProblem"
                }
              },
              "warnings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoStrategyProblem"
                }
              },
              "created_at": {
                "type": "string"
              },
              "document": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "The version's document, normalized. Left out of lists."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_BacktestView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A backtest: where it is and, once done, its result.",
            "required": [
              "id",
              "strategy_id",
              "version",
              "status",
              "from",
              "to",
              "capital",
              "costs",
              "progress",
              "cancel_requested",
              "created_at",
              "expires_at",
              "sources",
              "counts"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "strategy_id": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "status": {
                "$ref": "#/components/schemas/BacktestStatus"
              },
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              },
              "capital": {
                "type": "number",
                "format": "double"
              },
              "costs": {
                "$ref": "#/components/schemas/BacktestCosts"
              },
              "progress": {
                "$ref": "#/components/schemas/BacktestProgress"
              },
              "cancel_requested": {
                "type": "boolean"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "started_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time",
                "description": "When the result is deleted."
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why it failed, in words."
              },
              "summary": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/BacktestSummary",
                    "description": "Once done."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "labels": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/BacktestLabels",
                    "description": "How to read the result (always shown with it)."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sources": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BacktestSourceRow"
                },
                "description": "Where every series came from."
              },
              "equity": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/BacktestEquityPoint"
                },
                "description": "Equity at each day's close (`GET /v2/backtests/{id}` only)."
              },
              "counts": {
                "$ref": "#/components/schemas/BacktestCounts",
                "description": "Rows served by `.../trades` and `.../cycles`."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Basket": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A saved basket.",
            "required": [
              "id",
              "name",
              "legs",
              "prefs",
              "updated_at"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Basket id."
              },
              "name": {
                "type": "string",
                "description": "Display name."
              },
              "legs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BasketLeg"
                },
                "description": "Legs."
              },
              "prefs": {
                "description": "Client preferences."
              },
              "strategy": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Strategy its orders are placed under; absent when none was saved."
              },
              "updated_at": {
                "type": "string",
                "format": "date-time",
                "description": "Last update (RFC3339)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_BasketId": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The id of a saved basket.",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Basket id (`bk_...`)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_BracketResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The broker's answer. `status`: `accepted`, `rejected` (`message` says\nwhy) or `unknown` (no answer in time: check the order book before\nretrying).",
            "required": [
              "account",
              "basket_id",
              "order_id",
              "status",
              "message"
            ],
            "properties": {
              "account": {
                "type": "string"
              },
              "basket_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Broker basket / parent id (placement only; null otherwise)."
              },
              "order_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The order changed or cancelled; on placement the entry's broker\norder id when the broker's reply names it (Zerodha, Dhan, Tradejini,\nXTS; Pocketful only when its reply carries `oms_order_id`), null\notherwise (the entry then shows up in the order book)."
              },
              "status": {
                "$ref": "#/components/schemas/SliceStatus"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why it was rejected, or what is unknown; null when accepted."
              },
              "reason": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SliceReason",
                    "description": "Why it was not accepted, machine-readable (absent when accepted)."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "retry_after_ms": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "With `reason: rate_limited`: when a retry can succeed, in ms.",
                "minimum": 0
              },
              "client_tag": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The `client_tag` sent on placement (absent when none was)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_ConditionValues": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The condition now.",
            "required": [
              "true_now",
              "status",
              "reason",
              "on",
              "at",
              "values"
            ],
            "properties": {
              "true_now": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "Whether it holds now; null when that is not known\n(`reason` says why). A crossing is true when it crossed at the\nlast candle close. A hold (`hold_s`) is not waited for."
              },
              "status": {
                "type": "string",
                "description": "`ok`, `warming` (a value needs more candles) or `no_history`\n(history could not be loaded now; values fill in from live candles\nonly once a strategy runs)."
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why `true_now` is null, in plain English."
              },
              "on": {
                "$ref": "#/components/schemas/ConditionCheckOn",
                "description": "`close` or `tick`: how it was checked."
              },
              "at": {
                "type": "string",
                "description": "When the values were read (RFC 3339)."
              },
              "values": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ConditionValue"
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_ConnectionLimitsView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A connection's limits. They bind `mcp` (AI agent) tokens only; classic\npartner tokens of the same connection are not limited by them.",
            "required": [
              "client_id",
              "limits",
              "is_default",
              "applies_to"
            ],
            "properties": {
              "client_id": {
                "type": "string",
                "description": "The partner app's client id."
              },
              "limits": {
                "$ref": "#/components/schemas/ConnectionLimits",
                "description": "The limits in force for `mcp` tokens. When none were set (`is_default`), the defaults\nof a dynamically registered client: paper accounts only, no account\npicked, a few orders a day, one deployment, nothing live."
              },
              "is_default": {
                "type": "boolean",
                "description": "`true` when the user never set limits on this connection."
              },
              "applies_to": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The kinds of token these limits bind. Currently always `[\"mcp\"]`:\ntokens issued to AI agents. Classic partner tokens are not limited\nby them."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_ConvertResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The broker's answer: `accepted` (positions refresh shortly),\n`rejected` (`message` says why) or `unknown` (no answer in time: check\npositions before retrying).",
            "required": [
              "account",
              "status",
              "message"
            ],
            "properties": {
              "account": {
                "type": "string"
              },
              "status": {
                "$ref": "#/components/schemas/SliceStatus"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why it was rejected, or what is unknown; null when accepted."
              },
              "reason": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SliceReason",
                    "description": "With `status: rejected`: `rate_limited` (this account's order\nbudget; retry shortly) or `no_session` (log the account in again).\nNothing reached the broker. Absent otherwise."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_CreatedApiKey": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A new API key with its secret (shown only here). Doc-only mirror of the\nbody `create` builds.",
            "required": [
              "key_id",
              "name",
              "scopes",
              "ip_allowlist",
              "created_at",
              "last_used_at",
              "api_secret",
              "note"
            ],
            "properties": {
              "key_id": {
                "type": "string",
                "description": "Public key id (`ck_...`)."
              },
              "name": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Scope"
                }
              },
              "ip_allowlist": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "IP addresses the key may be used from; empty = any."
              },
              "created_at": {
                "type": "string",
                "description": "When the key was created (RFC 3339)."
              },
              "last_used_at": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Always null for a new key."
              },
              "api_secret": {
                "type": "string",
                "description": "The key secret (`cs_...`). Store it now: it is never shown again.\nAuthenticate with `Authorization: token <key_id>:<api_secret>`."
              },
              "note": {
                "type": "string",
                "description": "A reminder that the secret is shown only once."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_CyclesPage": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A page of cycles with their journeys, in time order.",
            "required": [
              "items",
              "offset",
              "limit",
              "total"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BacktestCycleRow"
                }
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "total": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_DeletedWebhook": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A deleted webhook. Doc-only mirror of the body `remove` builds.",
            "required": [
              "id",
              "deleted"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "deleted": {
                "type": "boolean",
                "description": "Always `true`."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_DisabledPartnerApp": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The app was disabled.",
            "required": [
              "client_id",
              "disabled"
            ],
            "properties": {
              "client_id": {
                "type": "string"
              },
              "disabled": {
                "type": "boolean",
                "description": "Always `true`."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_ExitResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "What was done: the position as the broker reported it, the exit\norder's results (as `POST /v1/orders` reports them) and the protection\nremoved once the exit was accepted.",
            "required": [
              "account",
              "instrument_token",
              "product",
              "net_qty",
              "working_exit_qty",
              "exit_qty",
              "side",
              "cancelled_triggers",
              "cancelled_brackets",
              "protection_errors",
              "results"
            ],
            "properties": {
              "account": {
                "type": "string"
              },
              "instrument_token": {
                "type": "string",
                "description": "Instrument id."
              },
              "product": {
                "$ref": "#/components/schemas/Product"
              },
              "net_qty": {
                "type": "integer",
                "format": "int64",
                "description": "Net quantity open at the broker (positive long, negative short)."
              },
              "working_exit_qty": {
                "type": "integer",
                "format": "int64",
                "description": "Units of exit orders already working, left out of this exit.",
                "minimum": 0
              },
              "exit_qty": {
                "type": "integer",
                "format": "int64",
                "description": "Units this exit sent.",
                "minimum": 0
              },
              "side": {
                "$ref": "#/components/schemas/Side",
                "description": "Side of the exit order (SELL closes a long)."
              },
              "cancelled_triggers": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Ids of the triggers removed after the exit was accepted\n(server-side triggers, and the display triggers of broker-held GTT / bracket /\ncover protection, cancelled at the broker first)."
              },
              "cancelled_brackets": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Broker order ids of bracket / cover entries whose legs were\ncancelled after the exit was accepted."
              },
              "protection_errors": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Protection that could NOT be removed after the exit was accepted,\nand why: it may still fire. Empty when all went. Remove each by\nhand (`DELETE /v1/triggers/{trigger_id}`, or at the broker)."
              },
              "results": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SliceResult"
                },
                "description": "One result per slice of the exit order; check each `status`. When\nno slice was accepted nothing else changed (protection kept)."
              }
            },
            "x-deprecated-aliases": {
              "cirrus_token": "instrument_token"
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_GttResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The broker's answer. `status`: `accepted`, `rejected` (`message` says\nwhy) or `unknown` (no answer in time: list the account's GTTs before\nretrying).",
            "required": [
              "account",
              "trigger_id",
              "status",
              "message",
              "error_code"
            ],
            "properties": {
              "account": {
                "type": "string"
              },
              "trigger_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The broker's GTT id; null when creating failed."
              },
              "status": {
                "$ref": "#/components/schemas/SliceStatus"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why it was rejected, or what is unknown; null when accepted."
              },
              "error_code": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`not_supported_by_broker` when the account's broker does not offer\nthis; null otherwise (branch on this, not on `message`)."
              },
              "reason": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SliceReason",
                    "description": "With `status: rejected`: `rate_limited` (this account's order\nbudget; retry shortly) or `no_session` (log the account in again).\nNothing reached the broker. Absent otherwise."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_InstrumentExpiries": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Expiry dates of an underlying's contracts.",
            "required": [
              "underlying",
              "expiries"
            ],
            "properties": {
              "underlying": {
                "type": "string",
                "description": "The underlying asked for, as given."
              },
              "expiries": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Distinct expiry dates (`YYYY-MM-DD`), earliest first; empty when\nthe underlying has no contracts."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_InstrumentRow": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "One instrument, as in the instrument list (a field the source lacks is\nnull).",
            "required": [
              "instrument_token",
              "exchange",
              "instrument",
              "exchange_token",
              "lot_size",
              "expiry",
              "strike",
              "option_type",
              "tick_size",
              "underlying_symbol",
              "isin",
              "freeze_qty",
              "name",
              "tradingsymbol",
              "sector",
              "indices"
            ],
            "properties": {
              "instrument_token": {
                "type": "string",
                "description": "Instrument id: what orders, triggers and every row call\n`instrument_token`."
              },
              "exchange": {
                "type": "string",
                "description": "Exchange as the instrument list gives it, upper case (`NSE`, `BSE`,\n`MCX`, ...). Index options and futures are listed under the cash\nexchange (`NSE` for NIFTY, `BSE` for SENSEX options); filter by the\nvalue returned here."
              },
              "instrument": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Instrument type (`EQUITY`, `INDEX`, `FUTIDX`, `OPTIDX`, `OPTSTK`, ...)."
              },
              "exchange_token": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The exchange's own token for the instrument."
              },
              "lot_size": {
                "type": "integer",
                "format": "int64",
                "description": "Contract lot size; `0` for indices (not tradable).",
                "minimum": 0
              },
              "expiry": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Expiry date (`YYYY-MM-DD`); null for non-derivatives."
              },
              "strike": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "Strike price; null for non-options."
              },
              "option_type": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`CE` / `PE`; null for non-options."
              },
              "tick_size": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "Smallest price step."
              },
              "underlying_symbol": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Underlying symbol (derivatives), or the stock's own symbol."
              },
              "isin": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "freeze_qty": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "Exchange freeze quantity: larger orders are split into slices.",
                "minimum": 0
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Company or instrument name."
              },
              "tradingsymbol": {
                "type": "string",
                "description": "Trading symbol, as the exchange lists it."
              },
              "sector": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "indices": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Index memberships (e.g. `NIFTY 50`); empty when none."
              }
            },
            "x-deprecated-aliases": {
              "cirrus_token": "instrument_token"
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_InstrumentSearchResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Matching instruments, best match first.",
            "required": [
              "items",
              "count",
              "next_cursor"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InstrumentRow"
                }
              },
              "count": {
                "type": "integer",
                "description": "Number of `items`.",
                "minimum": 0
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Pass as `cursor` (with the same parameters) for the next page; null\non the last page."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_IssuedSignalUrl": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A new signal URL (issued or rotated). Its path and body secret are\nshown only in this response. Doc-only mirror of the body the handlers\nbuild.",
            "required": [
              "endpoint_id",
              "kind",
              "strategy_id",
              "created_at",
              "has_body_secret",
              "path",
              "body_secret",
              "note"
            ],
            "properties": {
              "endpoint_id": {
                "type": "string",
                "description": "Public id (`we_...`), kept across rotations."
              },
              "kind": {
                "$ref": "#/components/schemas/SignalProvider"
              },
              "strategy_id": {
                "type": "string"
              },
              "created_at": {
                "type": "string",
                "description": "When this URL was issued (RFC 3339)."
              },
              "has_body_secret": {
                "type": "boolean",
                "description": "TradingView: alerts must carry `body_secret`."
              },
              "path": {
                "type": "string",
                "description": "The path to give the provider, prefixed with the API origin\n(`/v1/hooks/{kind}/wh_...`). It is the credential: keep it private."
              },
              "body_secret": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "TradingView only: put `\"secret\": \"<this>\"` (`tvs_...`) in the alert\nmessage. Null for other providers."
              },
              "note": {
                "type": "string",
                "description": "A reminder that the URL is shown only once."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_LeftBy": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "What a partner app left running.",
            "required": [
              "orders",
              "gtt",
              "triggers",
              "deployments"
            ],
            "properties": {
              "orders": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderData"
                },
                "description": "Open orders it placed today, newest first."
              },
              "gtt": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Gtt"
                },
                "description": "Active GTTs it placed (from the API's own records)."
              },
              "triggers": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2"
                },
                "description": "Open v2 triggers it created."
              },
              "deployments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutoDeployment"
                },
                "description": "Strategy deployments it started that are not stopped."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_NotificationChannels": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Every channel's state for the user.",
            "required": [
              "telegram",
              "app_push",
              "webhook",
              "prompts"
            ],
            "properties": {
              "telegram": {
                "$ref": "#/components/schemas/TelegramChannelStatus"
              },
              "app_push": {
                "$ref": "#/components/schemas/AppPushChannelStatus"
              },
              "webhook": {
                "$ref": "#/components/schemas/WebhookChannelStatus"
              },
              "prompts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/NotificationPrompt"
                },
                "description": "What the app should show, most urgent first (empty: all well)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_NotificationPage": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A page of the app inbox.",
            "required": [
              "notifications",
              "next_cursor"
            ],
            "properties": {
              "notifications": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Notification"
                }
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Pass as `before` for the next page; null on the last page."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_NotificationPreferences": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Every channel's preference. Stored inside the user's profile.",
            "properties": {
              "telegram": {
                "$ref": "#/components/schemas/NotificationChannelPreference"
              },
              "app_push": {
                "$ref": "#/components/schemas/NotificationChannelPreference"
              },
              "webhook": {
                "$ref": "#/components/schemas/NotificationChannelPreference"
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_OrderData": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "An order as it is delivered live: the tracked order plus instrument\ndetails and live prices (added when the instrument is known).\n\n`instrument_token` and `order_tag` are also sent under their legacy\nnames, always with the same value; read the primary names.",
            "required": [
              "order_tag",
              "username",
              "account",
              "broker",
              "instrument_token",
              "tradingsymbol",
              "side",
              "order_type",
              "product",
              "quantity",
              "price",
              "state",
              "filled_qty",
              "created_at",
              "status_history"
            ],
            "properties": {
              "order_tag": {
                "type": "string",
                "description": "The order's id, chosen when it was placed (a ULID)."
              },
              "broker_tag": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Tag as sent to the broker (format depends on the broker)."
              },
              "order_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Broker-assigned order id; `null` until the broker acknowledges."
              },
              "parent_tag": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`order_tag` of the order this one belongs to (a protective leg's\nentry), if any."
              },
              "username": {
                "type": "string"
              },
              "account": {
                "type": "string"
              },
              "broker": {
                "type": "string",
                "description": "Broker id (`zerodha`, `upstox`, ...)."
              },
              "instrument_token": {
                "type": "string",
                "description": "Instrument id."
              },
              "tradingsymbol": {
                "type": "string"
              },
              "side": {
                "$ref": "#/components/schemas/Side"
              },
              "order_type": {
                "$ref": "#/components/schemas/OrderType"
              },
              "product": {
                "$ref": "#/components/schemas/Product"
              },
              "quantity": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "price": {
                "type": "number",
                "format": "double",
                "description": "Limit price; `0` for market orders."
              },
              "trigger_price": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double"
              },
              "state": {
                "$ref": "#/components/schemas/OrderState"
              },
              "filled_qty": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "average_price": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double"
              },
              "status_message": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The broker's latest status text (rejection reason, ...)."
              },
              "broker_updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Broker time of the last update applied."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "status_history": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/StatusChange"
                },
                "description": "Every state change so far, oldest first."
              },
              "client_tag": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The caller's own reference, as given in `client_tag` when the order\nwas placed; absent when none was given (or for orders placed\nelsewhere, e.g. in the broker's own app)."
              },
              "partner_client_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Client id of the partner app that placed the order; absent for\norders placed any other way."
              },
              "chase": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ChasePlan",
                    "description": "The order's `chase` settings and the limit it was first sent with;\nabsent when it asked for none."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "leg_role": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/LegRole",
                    "description": "For an exit leg of a bracket / cover order: `stop_loss`, `target`\nor the broker's `square_off` (its entry is `parent_tag`); absent\nfor every other order."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "chase_progress": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ChaseProgress",
                    "description": "How far the order's `chase` got (attempts used, how it ended);\nabsent before its first re-price attempt."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "strategy": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The strategy of the v2 trigger that placed the order; absent for\nevery other order."
              },
              "split_from": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SplitFrom",
                    "description": "When the broker split a placed order into several orders (its\nfreeze-quantity cap, e.g. Pocketful at 500 units or Zerodha's\nautoslice) and lists only those: each is its own order (its own\n`order_id`, quantity and fills) and this names the order as placed.\nThe first part keeps the placed `order_tag`. Change or cancel each\npart by its own `order_id`; the placed id still cancels every open\npart, or changes their price / trigger (not their quantity). Absent\nfor every other order."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lot_size": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "Contract lot size (added when the instrument is known).",
                "minimum": 0
              },
              "broker_tradingsymbol": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The broker's own spelling of the symbol, only when it differs\nfrom `tradingsymbol` (which always comes from the instrument\nlist)."
              },
              "exchange": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Exchange as the instrument list gives it (`NSE`, `BSE`, `MCX`,\n...): index options and futures are listed under the cash\nexchange (`NSE` for NIFTY, `BSE` for SENSEX), so match on what\n`GET /v1/instruments` returns, not on `NFO` / `BFO`."
              },
              "instrument_type": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Instrument type (`EQ`, `FUTIDX`, `OPTIDX`, `OPTSTK`, ...)."
              },
              "symbol": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Underlying symbol (the trading symbol for equities)."
              },
              "expiry": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Expiry date (`YYYY-MM-DD`); empty for non-derivatives."
              },
              "strike": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "Strike price; `0` for non-options."
              },
              "option_type": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`CE` / `PE`; empty for non-options."
              },
              "sector": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Industry sector; absent when the instrument list has none."
              },
              "isin": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ISIN; absent when the instrument list has none."
              },
              "indices": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                },
                "description": "Index memberships (e.g. `NIFTY`, `NIFTY100`); absent when\nnone."
              },
              "instrument_missing": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "Present (`true`) only when the instrument is not known; the\ninstrument fields above are then absent."
              },
              "ltp": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "Last traded price (added when a quote is available)."
              },
              "prev_close": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "Previous close (`0` when unknown), sent with `ltp`."
              }
            },
            "additionalProperties": false,
            "x-deprecated-aliases": {
              "cirrus_token": "instrument_token",
              "cirrus_tag": "order_tag"
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_OrderMarginResponse": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Margin per order and account, per account, and the total.",
            "required": [
              "results",
              "accounts",
              "total_required"
            ],
            "properties": {
              "results": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderMarginResult"
                }
              },
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AccountMarginTotal"
                },
                "description": "One total per account that has a result."
              },
              "total_required": {
                "type": "number",
                "format": "double",
                "description": "Sum over results that have a figure (broker or estimate)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_OrderProtection": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "An order's protection.",
            "required": [
              "order_tag",
              "account",
              "status",
              "route",
              "rules",
              "broker_id",
              "triggers"
            ],
            "properties": {
              "order_tag": {
                "type": "string",
                "description": "The order's `order_tag`."
              },
              "account": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "description": "`none` (no stop-loss / target recorded for it), `waiting_for_fill`\n(armed once the entry fills) or `armed` (protecting what filled)."
              },
              "route": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ProtectionRoute",
                    "description": "Where it lives; null when `none`."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "rules": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/OrderProtectionRules",
                    "description": "The stop-loss / target / trail asked for; null when `none`."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "broker_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The broker's bracket / cover / GTT id, when the broker holds it."
              },
              "triggers": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderProtectionTrigger"
                },
                "description": "The triggers holding it (empty while waiting, or when the broker\nholds it)."
              }
            },
            "x-deprecated-aliases": {
              "cirrus_tag": "order_tag"
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_PlaceOrdersResponse": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Per-slice results (some accounts may succeed while others are\nrefused) and the count of each status.",
            "required": [
              "results",
              "accepted",
              "rejected",
              "unknown"
            ],
            "properties": {
              "results": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SliceResult"
                }
              },
              "accepted": {
                "type": "integer",
                "minimum": 0
              },
              "rejected": {
                "type": "integer",
                "minimum": 0
              },
              "unknown": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_PortfolioRefresh": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A refresh was requested.",
            "required": [
              "requested"
            ],
            "properties": {
              "requested": {
                "type": "integer",
                "description": "How many accounts were asked to re-read.",
                "minimum": 0
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_PortfolioResponse": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Per-account data of one kind; accounts without data are listed under\n`missing`, never silently left out.",
            "required": [
              "accounts",
              "missing"
            ],
            "properties": {
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PortfolioAccountData"
                }
              },
              "missing": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PortfolioMissing"
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_RegisteredPartnerApp": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A newly registered partner app, with its client secret (shown once).",
            "required": [
              "client_id",
              "owner",
              "name",
              "verified",
              "logo_url",
              "redirect_uris",
              "scopes",
              "created_at",
              "disabled",
              "client_secret",
              "note"
            ],
            "properties": {
              "client_id": {
                "type": "string",
                "description": "OAuth client id (`cp_...`)."
              },
              "owner": {
                "type": "string",
                "description": "Username of the user who registered the app."
              },
              "name": {
                "type": "string",
                "description": "Name shown to users on the consent screen."
              },
              "verified": {
                "type": "boolean",
                "description": "Always `false` for a new app (see `PartnerApp.verified`)."
              },
              "logo_url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "HTTPS URL of the app's logo."
              },
              "redirect_uris": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Exact redirect URIs a user may be sent back to."
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Scope"
                },
                "description": "The most a user can grant this partner."
              },
              "created_at": {
                "type": "string",
                "description": "RFC 3339 time of registration."
              },
              "disabled": {
                "type": "boolean",
                "description": "Always `false` for a new app."
              },
              "client_secret": {
                "type": "string",
                "description": "The client secret (`cps_...`). Shown only in this response: store it\nnow. Only its keyed hash is kept."
              },
              "note": {
                "type": "string",
                "description": "A reminder to store the secret."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_RevokedApiKey": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A revoked API key. Doc-only mirror of the body `revoke` builds.",
            "required": [
              "key_id",
              "revoked"
            ],
            "properties": {
              "key_id": {
                "type": "string"
              },
              "revoked": {
                "type": "boolean",
                "description": "Always `true`."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_RevokedPartnerConnection": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The connection was revoked.",
            "required": [
              "client_id",
              "revoked"
            ],
            "properties": {
              "client_id": {
                "type": "string"
              },
              "revoked": {
                "type": "boolean",
                "description": "Always `true`."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_RevokedSignalUrl": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A revoked signal URL. Doc-only mirror of the body `revoke` builds.",
            "required": [
              "endpoint_id",
              "revoked"
            ],
            "properties": {
              "endpoint_id": {
                "type": "string"
              },
              "revoked": {
                "type": "boolean",
                "description": "Always `true`."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_RotatedPartnerSecret": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A rotated client secret (shown once).",
            "required": [
              "client_id",
              "client_secret",
              "previous_secret_expires_at"
            ],
            "properties": {
              "client_id": {
                "type": "string"
              },
              "client_secret": {
                "type": "string",
                "description": "The new secret (`cps_...`); store it now, it is never shown again."
              },
              "previous_secret_expires_at": {
                "type": "string",
                "format": "date-time",
                "description": "Until when the previous secret is still accepted."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_RotatedPartnerWebhookSecret": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A rotated webhook secret (shown once).",
            "required": [
              "client_id",
              "webhook_secret",
              "previous_secret_expires_at"
            ],
            "properties": {
              "client_id": {
                "type": "string"
              },
              "webhook_secret": {
                "type": "string",
                "description": "The new secret (`whsec_...`); store it now, it is never shown again."
              },
              "previous_secret_expires_at": {
                "type": "string",
                "format": "date-time",
                "description": "Until when deliveries are also signed with the previous secret."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_SharedConsolidated": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Every shared account on one screen.",
            "required": [
              "owners",
              "positions"
            ],
            "properties": {
              "owners": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SharedOwnerSummary"
                }
              },
              "positions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SharedPositionRow"
                },
                "description": "Every shared position, across owners and accounts."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_SharedConsolidatedRefresh": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A refresh request for every owner.",
            "required": [
              "owners",
              "dispatched"
            ],
            "properties": {
              "owners": {
                "type": "integer",
                "format": "int64",
                "description": "Owners sharing with the caller.",
                "minimum": 0
              },
              "dispatched": {
                "type": "integer",
                "format": "int64",
                "description": "Owners actually refreshed (the others were refreshed moments ago).",
                "minimum": 0
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_SharedConsolidatedView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "One view of every shared account, across owners.",
            "required": [
              "accounts",
              "missing",
              "skipped_owners"
            ],
            "properties": {
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SharedOwnerAccountData"
                },
                "description": "One entry per shared account with data."
              },
              "missing": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SharedOwnerMissing"
                },
                "description": "Shared accounts without data."
              },
              "skipped_owners": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SharedSkippedOwner"
                },
                "description": "Owners left out, and why."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_SharedRefresh": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A refresh request for one owner.",
            "required": [
              "requested"
            ],
            "properties": {
              "requested": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "Accounts asked to refresh; `null` when the owner was refreshed\nmoments ago (within 10 seconds, by anyone) and nothing was asked.",
                "minimum": 0
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_SharedViewData": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SharedAccounts"
              },
              {
                "$ref": "#/components/schemas/SharedPortfolio"
              }
            ],
            "description": "`accounts`: `SharedAccounts`; every other view: `SharedPortfolio`."
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_SignalDryRun": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "What a delivery of the payload would do, without doing it.",
            "required": [
              "valid",
              "errors",
              "warnings",
              "would_place"
            ],
            "properties": {
              "valid": {
                "type": "boolean",
                "description": "True when `errors` is empty: a real delivery would be acted on."
              },
              "errors": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Why a real delivery would place nothing, in plain words."
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "What it would skip, or could not check (e.g. an unsigned Kuberhunt\ntest, a sample payload, test mode on the strategy)."
              },
              "would_place": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SignalWouldPlace"
                },
                "description": "The orders it would place."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_SignalModeView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "One signal URL and where its strategy's alerts go.",
            "required": [
              "endpoint_id",
              "kind",
              "strategy_id",
              "mode",
              "can_use_algo"
            ],
            "properties": {
              "endpoint_id": {
                "type": "string",
                "description": "The signal URL (`we_...`)."
              },
              "kind": {
                "$ref": "#/components/schemas/SignalProvider"
              },
              "strategy_id": {
                "type": "string",
                "description": "The Signals strategy the URL is for."
              },
              "mode": {
                "$ref": "#/components/schemas/SignalMode",
                "description": "`direct`: alerts place orders from the strategy's settings (as\nbefore). `algo`: alerts become signals to `deployment_id`, which\ndecides with its own rules and safety checks."
              },
              "deployment_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The bound deployment (`algo` only)."
              },
              "switched_at": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "When the mode last changed (RFC 3339); null: never switched."
              },
              "can_use_algo": {
                "type": "boolean",
                "description": "False for Kuberhunt URLs (they stay direct for now)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_SignalUrlDeliveryPage": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "One page of deliveries, newest first.",
            "required": [
              "items",
              "next_cursor"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SignalUrlDelivery"
                }
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Pass as `cursor` for the next page; null on the last page."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_StrategiesView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The user's strategies for one trading day.",
            "required": [
              "trading_day",
              "available",
              "strategies",
              "missing"
            ],
            "properties": {
              "trading_day": {
                "type": "string",
                "format": "date",
                "description": "IST trading day the ledgers are for."
              },
              "available": {
                "type": "boolean",
                "description": "`false` while no account has a ledger yet today (`strategies` is\nthen empty and `missing` says why for each account): not an error,\nthe ledger appears once the account's trades are read."
              },
              "strategies": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/StrategyView"
                },
                "description": "Named strategies by name, then `Unassigned`."
              },
              "missing": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/StrategyLedgerMissing"
                },
                "description": "Accounts with no ledger to show, and why."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_StrategyDetailView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "One strategy of the user, `GET /v1/strategies/{name}`.",
            "required": [
              "trading_day",
              "available",
              "strategy",
              "missing",
              "triggers"
            ],
            "properties": {
              "trading_day": {
                "type": "string",
                "format": "date"
              },
              "available": {
                "type": "boolean",
                "description": "As in `GET /v1/strategies`."
              },
              "strategy": {
                "$ref": "#/components/schemas/StrategyView",
                "description": "The strategy (no accounts and zero totals when it holds nothing\nand booked nothing today)."
              },
              "missing": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/StrategyLedgerMissing"
                }
              },
              "triggers": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/StrategyTrigger"
                },
                "description": "Its v2 triggers (`GET /v2/triggers/{trigger_id}` has the rest);\nnull when v2 triggers are not enabled for the user or could not\nbe read just now."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_SweepView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A sweep: where it is and, once done, the recommended version and the\noverfitting warnings to show before deploy.",
            "required": [
              "id",
              "strategy_id",
              "version",
              "status",
              "from",
              "to",
              "capital",
              "costs",
              "axes",
              "progress",
              "cost",
              "cancel_requested",
              "created_at",
              "expires_at",
              "warnings",
              "notes"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "strategy_id": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "format": "int32",
                "description": "The saved version the sweep started from.",
                "minimum": 0
              },
              "status": {
                "$ref": "#/components/schemas/BacktestStatus",
                "description": "`running` until every version ended, then `done`, `failed` (fewer\nthan two versions finished) or `cancelled`."
              },
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              },
              "capital": {
                "type": "number",
                "format": "double"
              },
              "costs": {
                "$ref": "#/components/schemas/BacktestCosts"
              },
              "axes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SweepAxis"
                }
              },
              "progress": {
                "$ref": "#/components/schemas/SweepProgress"
              },
              "cost": {
                "type": "integer",
                "format": "int64",
                "description": "What it counts against the daily backtest limit.",
                "minimum": 0
              },
              "cancel_requested": {
                "type": "boolean"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "finished_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time",
                "description": "When the sweep and its backtests are deleted."
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why it failed, in words."
              },
              "recommended": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "description": "The recommended version's `n`: the best plateau, not the best point.",
                "minimum": 0
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Plain words, shown before deploy."
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Checks that did not run and why, and versions left out."
              },
              "deflated_sharpe": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "Deflated Sharpe ratio of the recommended version (0 to 1)."
              },
              "pbo": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double",
                "description": "Probability of backtest overfitting (0 to 1), from 16 versions."
              },
              "walk_forward": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SweepWalkForward"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "versions": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/SweepVersion"
                },
                "description": "Every version (`GET /v2/backtests/sweeps/{sweep_id}` only)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TelegramLinkStart": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A one-time link to open in Telegram.",
            "required": [
              "url",
              "bot_username",
              "expires_at",
              "expires_in_seconds"
            ],
            "properties": {
              "url": {
                "type": "string",
                "description": "Open this (`https://t.me/<bot>?start=<token>`): Telegram opens the\nbot, the user taps Start, and the chat is linked. Works once."
              },
              "bot_username": {
                "type": "string"
              },
              "expires_at": {
                "type": "string",
                "description": "When the link stops working; RFC 3339, India time."
              },
              "expires_in_seconds": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TelegramTestResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "What a test message came to.",
            "required": [
              "delivered",
              "message",
              "broken_reason"
            ],
            "properties": {
              "delivered": {
                "type": "boolean"
              },
              "message": {
                "type": "string",
                "description": "Plain words for the user."
              },
              "broken_reason": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/NotificationBrokenReason",
                    "description": "Why Telegram refused it, when it did for good."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TradesPage": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A page of simulated fills, in time order.",
            "required": [
              "items",
              "offset",
              "limit",
              "total"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BacktestTradeRow"
                }
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "total": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TriggerV2": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A v2 trigger and where it stands.",
            "required": [
              "trigger_id",
              "account",
              "strategy",
              "kind",
              "legs",
              "spec",
              "valid_until",
              "state",
              "transition_seq",
              "reason",
              "created_at",
              "updated_at",
              "protection"
            ],
            "properties": {
              "trigger_id": {
                "type": "string"
              },
              "account": {
                "type": "string"
              },
              "strategy": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "$ref": "#/components/schemas/TriggerV2Kind"
              },
              "legs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2Leg"
                }
              },
              "spec": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "The spec as created; null when not known here."
              },
              "valid_until": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "state": {
                "type": "string",
                "description": "`submitted` until the engine reports, then the machine's state:\n`armed`, `pending`, `active`, `t1` … (ladder rungs), `paused`, and\nthe ended ones `fired`, `done`, `target_hit`, `sl_hit`, `breached`,\n`expired`, `cancelled`, `errored`; `cancel_pending` on broker-held\nprotection whose cancel the broker refused while still holding it.\nA protection held as a v1 record is `pending` until its entry fills,\nthen `active` (or `cancel_pending`); ended, it shows one of the\nended states above (`target_hit`, `sl_hit`, `fired`, `done` when the\nposition was exited another way, `cancelled`, or `errored` when it\nstopped protecting because something failed or why is not known),\nwith v1's reason in `reason` (e.g. `stop_loss_executed_by_broker`).\nOther values may appear."
              },
              "transition_seq": {
                "type": "integer",
                "format": "int64",
                "description": "Changes the engine made so far.",
                "minimum": 0
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why it last changed, when the engine said (errors, expiry, …). A\ntrigger the server ended on its own is `cancelled` with `day_ended`\n(intraday, after its session's close) or `contract_expired`."
              },
              "created_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "type": "string"
              },
              "protection": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "What protects the position, part by part (`stop_loss`,\n`stop_condition`, `target`, `target_1` …, `target_condition`,\n`trail`): held by the broker (protects even when the server is\ndown) or by the server. Null for alerts and risk limits, and for triggers\ncreated before protection was planned.",
                "additionalProperties": {
                  "$ref": "#/components/schemas/TriggerV2ProtectionPart"
                },
                "propertyNames": {
                  "type": "string"
                }
              },
              "last_result": {
                "$ref": "#/components/schemas/TriggerV2LastResult",
                "description": "The engine's answer to the last command it handled for this\ntrigger (a refused modify, pause, resume or cancel shows here with\nits reason); absent until it answered one."
              },
              "entry": {
                "$ref": "#/components/schemas/TriggerV2Entry",
                "description": "The entry the server placed for this trigger (a bracket whose\n`entry` condition held): absent for triggers without one. `status`\n`outcome_unknown` means the entry may or may not be at the broker;\nit is never sent again (check the order book)."
              },
              "created_via": {
                "$ref": "#/components/schemas/TriggerV2CreatedVia",
                "description": "How the trigger was made: `app` (the app), `api` (an API key or a\npartner app), `order_ticket` (the server, protecting a `POST\n/v1/orders` fill). Absent for triggers made before this was\nrecorded."
              },
              "route": {
                "$ref": "#/components/schemas/ProtectionRoute",
                "description": "For a `bracket` or `ladder`: where its protection lives. `gtt` (a\nbroker GTT) or `stop_order` (a broker stop-loss order): held by the\nbroker, it protects the position even when the server is down;\n`trigger`: the server evaluates it (parts the broker backs show in\n`protection`). Absent for alerts and risk limits."
              },
              "route_reason": {
                "type": "string",
                "description": "Why that route, in words, when known."
              },
              "risk_progress": {
                "$ref": "#/components/schemas/TriggerV2RiskProgress",
                "description": "For a `risk_limit` with `targets` or a `profit_trail`: which\ntargets fired and where the trail stands, as of the trigger's last\nevent. Absent for every other trigger."
              },
              "watch": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2Watch"
                },
                "description": "The instruments the conditions read but the trigger never trades,\nas created (`watch` of the create request, so a change round-trips).\nAbsent when there are none."
              },
              "group": {
                "type": "string",
                "description": "The label given at create (`group`); absent when none."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TriggerV2Accepted": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A command the server accepted and handed to the trigger engine.",
            "required": [
              "trigger_id",
              "command_id",
              "status"
            ],
            "properties": {
              "trigger_id": {
                "type": "string"
              },
              "command_id": {
                "type": "string",
                "description": "The command's id (each create / change / cancel has its own)."
              },
              "status": {
                "type": "string",
                "description": "Always `accepted`: the engine applies it within moments; read the\ntrigger to see the result."
              },
              "route": {
                "$ref": "#/components/schemas/ProtectionRoute",
                "description": "On create of a `bracket` or `ladder`: where its protection lives.\n`gtt` (a broker GTT) or `stop_order` (a broker stop-loss order):\nthe broker holds it and keeps protecting the position when the\nserver is down; it was placed before this answer and `trigger_id`\nnames its display record. `trigger`: the server evaluates it."
              },
              "route_reason": {
                "type": "string",
                "description": "Why that route, in words (e.g. why a broker did not take it)."
              },
              "broker_cancel": {
                "type": "string",
                "description": "On cancel of broker-held protection: `cancelled` at the broker (or\nrefused, and the broker shows it already ended), `pending` (the\nbroker refused and still holds it: it stays live with `state`\n`cancel_pending`, re-checked until the broker ends it; the reason\nis in `broker_message`), or `failed` (the account is no longer\nlinked; removed)."
              },
              "broker_message": {
                "type": "string"
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TriggerV2Capabilities": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "required": [
              "kinds",
              "expressions",
              "limits",
              "entries_enabled",
              "risk_targets_enabled",
              "products",
              "account"
            ],
            "properties": {
              "kinds": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2KindInfo"
                }
              },
              "expressions": {
                "$ref": "#/components/schemas/TriggerV2ExpressionLanguage"
              },
              "limits": {
                "$ref": "#/components/schemas/TriggerV2Limits"
              },
              "entries_enabled": {
                "type": "boolean",
                "description": "A `bracket` with `entry` places its entry order for this user when\nit holds. `false`: a bracket with `entry` is refused (422\n`spec.entry`); give `entry_px` instead."
              },
              "risk_targets_enabled": {
                "type": "boolean",
                "description": "Risk limit `targets` and `profit_trail` are accepted on this server.\n`false`: a spec with either is refused (422 `spec.targets` /\n`spec.profit_trail`)."
              },
              "products": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2SegmentProducts"
                },
                "description": "The products a leg may have, by market segment (`legs[].product`)."
              },
              "account": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TriggerV2AccountCapabilities",
                    "description": "With `?account=`; null otherwise."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "indicators": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TriggerV2IndicatorCapabilities",
                    "description": "Indicator conditions: functions with their parameters, presets,\ntimeframes, exchanges and limits. Absent while they are not\navailable."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TriggerV2ChangeValidation": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The dry run's answer.",
            "required": [
              "valid",
              "errors",
              "diff",
              "valid_until"
            ],
            "properties": {
              "valid": {
                "type": "boolean",
                "description": "`true` when the change would be accepted (no `errors`). The engine\nstill applies only what the trigger's state allows (a stop-loss is\nnever loosened)."
              },
              "errors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2Problem"
                },
                "description": "Every reason the change would be refused, with `PATCH`'s `field` and\n`message`."
              },
              "diff": {
                "type": "array",
                "items": {
                  "type": "object"
                },
                "description": "What changes in the spec: `[{\"path\", \"from\", \"to\"}]`."
              },
              "valid_until": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The expiry the trigger would have (RFC 3339); null: none."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TriggerV2IndicatorValues": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The trigger's indicator values now.",
            "required": [
              "trigger_id",
              "status",
              "at",
              "values"
            ],
            "properties": {
              "trigger_id": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "description": "`ok`, or `unavailable` (the engine did not answer in time; poll again)."
              },
              "at": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "Epoch ms the values were read at."
              },
              "values": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2IndicatorValue"
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TriggerV2Journey": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A page of the journey, newest first.",
            "required": [
              "entries",
              "next_cursor"
            ],
            "properties": {
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2JourneyEntry"
                }
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Pass as `cursor` for the next (older) page; null on the last."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_TriggerV2Validation": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The dry run's answer.",
            "required": [
              "valid",
              "errors",
              "reads",
              "limits",
              "protection"
            ],
            "properties": {
              "valid": {
                "type": "boolean",
                "description": "`true` when create would accept it (no `errors`, within `limits`)."
              },
              "errors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2Problem"
                }
              },
              "reads": {
                "$ref": "#/components/schemas/TriggerV2Reads"
              },
              "limits": {
                "$ref": "#/components/schemas/TriggerV2LimitsCheck"
              },
              "protection": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TriggerV2ProtectionPreview",
                    "description": "Null for `alert` / `risk_limit`, or when the trigger does not\ncompile."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "conditions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2ConditionReading"
                },
                "description": "Conditions with indicators (or `on`, `hold_s`, a dead band, watched\ninstruments) in plain English: exactly when each fires, what it\nreads and how much history it needs. Absent when there are none."
              },
              "risk_levels": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriggerV2RiskLevelReading"
                },
                "description": "A `risk_limit`'s levels in plain English, in the order the engine\nchecks them (loss floor, profit lock, profit trail, each target,\n`when`). Absent for other kinds, or when it does not compile."
              },
              "route": {
                "$ref": "#/components/schemas/ProtectionRoute",
                "description": "For a `bracket` / `ladder`: where create would put its protection\non this account, by the same decision (`gtt` or `stop_order`: held\nby the broker; `trigger`: the server evaluates it). Nothing is\nplaced. Absent for other kinds, or when the trigger would be\nrefused."
              },
              "route_reason": {
                "type": "string",
                "description": "Why that route, in words."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_UnlinkedTelegram": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Telegram unlinked. Doc-only mirror of the body `unlink` builds.",
            "required": [
              "unlinked"
            ],
            "properties": {
              "unlinked": {
                "type": "boolean",
                "description": "Always `true`."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_UpdatedPartnerApp": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A partner app after a change to its webhook.",
            "required": [
              "client_id",
              "owner",
              "name",
              "verified",
              "logo_url",
              "redirect_uris",
              "scopes",
              "created_at",
              "disabled"
            ],
            "properties": {
              "client_id": {
                "type": "string",
                "description": "OAuth client id (`cp_...`)."
              },
              "owner": {
                "type": "string",
                "description": "Username of the user who registered the app."
              },
              "name": {
                "type": "string",
                "description": "Name shown to users on the consent screen."
              },
              "verified": {
                "type": "boolean",
                "description": "See `PartnerApp.verified`."
              },
              "logo_url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "HTTPS URL of the app's logo."
              },
              "redirect_uris": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Exact redirect URIs a user may be sent back to."
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Scope"
                },
                "description": "The most a user can grant this partner."
              },
              "created_at": {
                "type": "string",
                "description": "RFC 3339 time of registration."
              },
              "disabled": {
                "type": "boolean",
                "description": "Always `false` (a disabled app cannot be changed)."
              },
              "webhook": {
                "$ref": "#/components/schemas/PartnerWebhookView",
                "description": "The app's webhook; absent after `webhook_url: null`."
              },
              "webhook_secret": {
                "type": "string",
                "description": "The webhook's signing secret (`whsec_...`), only in the response\nthat created the webhook: store it now. Only a sealed copy is kept."
              },
              "note": {
                "type": "string",
                "description": "A reminder to store the secret (only with `webhook_secret`)."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_UserProfile": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "Who is calling, and with what credential. Never a secret.",
            "required": [
              "username",
              "auth"
            ],
            "properties": {
              "username": {
                "type": "string",
                "description": "The user's id."
              },
              "auth": {
                "$ref": "#/components/schemas/ProfileAuth"
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AccountGtts": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "One account's GTTs.",
              "required": [
                "account",
                "broker",
                "source",
                "gtts",
                "note",
                "error",
                "error_code"
              ],
              "properties": {
                "account": {
                  "type": "string"
                },
                "broker": {
                  "type": "string",
                  "description": "The account's broker."
                },
                "source": {
                  "type": "string",
                  "description": "Where the list comes from: `broker` (a live read at the broker) or\n`api_records` (the broker cannot list GTTs, or its best-effort list\nread failed, e.g. Pocketful: the GTTs placed through this API, from\nits own records).",
                  "example": "broker"
                },
                "gtts": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Gtt"
                  },
                  "description": "Empty when the list could not be read (`error` says why)."
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "With `api_records`: why the records are listed and that GTTs placed\noutside this API are not visible. Null for `broker`."
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Why this account's list is missing (others still listed); null\nwhen it was read."
                },
                "error_code": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "`not_supported_by_broker` when the broker offers no GTTs; null\notherwise."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_ApiKeyView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "An active API key as its owner sees it (never the secret or its hash).",
              "required": [
                "key_id",
                "name",
                "scopes",
                "ip_allowlist",
                "created_at",
                "last_used_at"
              ],
              "properties": {
                "key_id": {
                  "type": "string",
                  "description": "Public key id (`ck_...`): the part before `:` in\n`Authorization: token <key_id>:<key_secret>`."
                },
                "name": {
                  "type": "string",
                  "description": "The owner's label for the key."
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Scope"
                  },
                  "description": "What the key may do."
                },
                "ip_allowlist": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "IP addresses the key may be used from; empty = any."
                },
                "created_at": {
                  "type": "string",
                  "description": "When the key was created (RFC 3339)."
                },
                "last_used_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "When the key was last used (RFC 3339, updated at most once a\nminute); null when never used."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoCycleDetail": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A cycle on every account, with its journey.",
              "required": [
                "cycle",
                "journey"
              ],
              "properties": {
                "cycle": {
                  "$ref": "#/components/schemas/AutoCycleView"
                },
                "journey": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  },
                  "description": "Journey entries, oldest first."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoCycleView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "One cycle of one account.",
              "required": [
                "account",
                "day",
                "n",
                "phase",
                "legs",
                "pnl"
              ],
              "properties": {
                "account": {
                  "type": "string"
                },
                "day": {
                  "type": "string"
                },
                "n": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "phase": {
                  "$ref": "#/components/schemas/AutoCyclePhase"
                },
                "legs": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                },
                "exit_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "pnl": {
                  "$ref": "#/components/schemas/AutoCyclePnlView"
                },
                "opened_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "closed_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoDeployment": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A deployment: one version on 1 to 4 accounts, paper or live.",
              "required": [
                "id",
                "strategy_id",
                "version",
                "mode",
                "status",
                "strategy_tag",
                "accounts",
                "units",
                "acknowledged",
                "compiled_hash",
                "engine_connected",
                "created_at",
                "updated_at"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "strategy_id": {
                  "type": "string"
                },
                "strategy_name": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The strategy's name when it was deployed (absent on deployments made\nbefore names were kept)."
                },
                "version": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "mode": {
                  "$ref": "#/components/schemas/AutoMode"
                },
                "status": {
                  "$ref": "#/components/schemas/AutoDeploymentStatus",
                  "description": "`active`, `paused`, `error` or `stopped` (`unknown`: unreadable,\ntreated as needing attention)."
                },
                "status_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "strategy_tag": {
                  "type": "string",
                  "description": "Stamped on every order (`auto.` + 12 characters of the id)."
                },
                "accounts": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutoAccountView"
                  }
                },
                "units": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutoUnitView"
                  }
                },
                "universe": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/AutoUniverse",
                      "description": "A watchlist deployment's universe (`spec.stock.watchlist_id`);\nabsent otherwise."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "start_on": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "end_on": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "acknowledged": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "compiled_hash": {
                  "type": "string"
                },
                "last_intent": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/AutoIntentView"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "engine_connected": {
                  "type": "boolean",
                  "description": "Whether intents reach the strategy engine yet."
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                },
                "stopped_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "pnl": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/AutoPnl",
                      "description": "Today's P&L of its orders (from the strategy ledgers, by\n`strategy_tag`; `GET /v2/deployments/{id}` and the strategy's\ndeployment list only); absent when the ledgers cannot be read just\nnow."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "safety_pauses": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "$ref": "#/components/schemas/AutoSafetyPause"
                  },
                  "description": "Accounts whose safety pause (circuit breaker) has tripped, with\nwhat it saw (`GET /v2/deployments/{id}` and the strategy's\ndeployment list only); empty when none has. Absent when the\ndeployment is stopped or the engine is not connected or did not\nanswer."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoGalleryListing": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A listing as anyone signed in sees it. Never the author's username,\naccounts, capital, rupee amounts or quantities.",
              "required": [
                "listing_id",
                "name",
                "description",
                "tags",
                "underlying",
                "summary",
                "author",
                "badge",
                "label",
                "performance",
                "price_credits",
                "effective_price",
                "is_free",
                "price_reason",
                "non_refundable",
                "copies",
                "listed_at",
                "can_copy",
                "mine"
              ],
              "properties": {
                "listing_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "tags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "underlying": {
                  "type": "string"
                },
                "summary": {
                  "type": "string",
                  "description": "The strategy in plain English."
                },
                "author": {
                  "type": "string",
                  "description": "The author's chosen display name."
                },
                "badge": {
                  "$ref": "#/components/schemas/AutoGalleryBadge"
                },
                "label": {
                  "type": "string",
                  "description": "\"Past results on paper (simulated); not advice.\""
                },
                "performance": {
                  "$ref": "#/components/schemas/AutoGalleryPerformance"
                },
                "price_credits": {
                  "type": "integer",
                  "format": "int64",
                  "description": "What it costs you now (0: free); the same as `effective_price`.",
                  "minimum": 0
                },
                "effective_price": {
                  "type": "integer",
                  "format": "int64",
                  "description": "What it costs you now: 0 while paid templates are off, during a\n\"make all free\" promotion, or when staff made it free.",
                  "minimum": 0
                },
                "is_free": {
                  "type": "boolean"
                },
                "price_reason": {
                  "type": "string",
                  "description": "Why: `paid_disabled`, `promotion`, `admin_free`, `unpriced` or\n`priced`."
                },
                "non_refundable": {
                  "type": "boolean",
                  "description": "True when it costs something: purchases are non-refundable."
                },
                "copies": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "listed_at": {
                  "type": "string"
                },
                "can_copy": {
                  "type": "boolean",
                  "description": "You may copy it now (free, bought, or yours)."
                },
                "mine": {
                  "type": "boolean",
                  "description": "It is yours."
                },
                "document": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "The version's document (detail only, when you may copy it)."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoGalleryMyListing": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "The author's own listing: the public view plus its review.",
              "required": [
                "listing",
                "strategy_id",
                "version",
                "status",
                "review_notes",
                "capital",
                "purchases",
                "asking_price_credits",
                "admin_free"
              ],
              "properties": {
                "listing": {
                  "$ref": "#/components/schemas/AutoGalleryListing",
                  "description": "The listing as others see it once approved."
                },
                "strategy_id": {
                  "type": "string"
                },
                "version": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "status": {
                  "type": "string",
                  "description": "`pending`, `approved`, `rejected`, `taken_down` or `withdrawn`."
                },
                "review_notes": {
                  "type": "string",
                  "description": "The reviewers' note, when they left one."
                },
                "capital": {
                  "type": "number",
                  "format": "double",
                  "description": "The capital you declared (₹, seen by you and reviewers only)."
                },
                "purchases": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "asking_price_credits": {
                  "type": "integer",
                  "format": "int64",
                  "description": "The price you set (kept while paid templates are off or staff made\nit free; it applies again when they are back).",
                  "minimum": 0
                },
                "admin_free": {
                  "type": "boolean",
                  "description": "Staff made it free."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoGalleryReceipt": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A purchase as its buyer sees it.",
              "required": [
                "receipt_id",
                "listing_id",
                "name",
                "author",
                "charged_credits",
                "bought_at",
                "non_refundable"
              ],
              "properties": {
                "receipt_id": {
                  "type": "string",
                  "description": "The charge id, also on the wallet's transaction."
                },
                "listing_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "author": {
                  "type": "string",
                  "description": "The author's display name."
                },
                "charged_credits": {
                  "type": "integer",
                  "format": "int64",
                  "description": "Credits paid.",
                  "minimum": 0
                },
                "strategy_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Your copy made with the purchase."
                },
                "bought_at": {
                  "type": "string"
                },
                "non_refundable": {
                  "type": "boolean",
                  "description": "Always true: purchases are non-refundable."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoSharedStrategy": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A strategy someone shared with the caller: read-only, the newest\nsaved version only. Never carries accounts, deployments, orders, P&L,\njourneys, webhooks or secrets.",
              "required": [
                "strategy_id",
                "name",
                "description",
                "tags",
                "owner",
                "version",
                "summary",
                "read_only"
              ],
              "properties": {
                "strategy_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "tags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "owner": {
                  "type": "string",
                  "description": "The owner, shortened (`@prat…`)."
                },
                "version": {
                  "type": "integer",
                  "format": "int32",
                  "description": "The saved version shown (forks pin it).",
                  "minimum": 0
                },
                "summary": {
                  "type": "string",
                  "description": "The version in plain English."
                },
                "read_only": {
                  "type": "boolean",
                  "description": "Always true: viewers cannot edit, deploy or see runs."
                },
                "document": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "The version's document, normalized. Absent in lists."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoStrategyComponent": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A component type (`GET /v2/strategies/components`). Doc-only mirror of\nwhat `strategy_registry::capabilities::components` builds.",
              "required": [
                "id",
                "name",
                "major",
                "slots",
                "label",
                "explain",
                "group",
                "status",
                "phase",
                "deployable",
                "deprecated",
                "needs",
                "bare",
                "params_schema"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "description": "`name@major`, as written in documents."
                },
                "name": {
                  "type": "string"
                },
                "major": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "slots": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Slots it fills (`entry_source`, `legs`, `sizing`, ...)."
                },
                "label": {
                  "type": "string"
                },
                "explain": {
                  "type": "string"
                },
                "group": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "description": "`ga`, `preview`, `planned` or `deprecated`."
                },
                "phase": {
                  "type": "string",
                  "description": "Release phase (`a`, `b`, ...)."
                },
                "deployable": {
                  "type": "boolean",
                  "description": "Whether a version using it can be deployed now."
                },
                "deprecated": {
                  "type": "boolean"
                },
                "sunset_after": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "needs": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Broker capabilities it needs."
                },
                "bare": {
                  "type": "boolean",
                  "description": "May be written as the bare `name@major` (every setting has a default)."
                },
                "params_schema": {
                  "type": "object",
                  "description": "JSON Schema of its parameters."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoStrategyItem": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A strategy in a list.",
              "required": [
                "id",
                "name",
                "description",
                "tags",
                "display_status",
                "latest_version",
                "revision",
                "deployments",
                "updated_at"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "tags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "display_status": {
                  "$ref": "#/components/schemas/AutoDisplayStatus",
                  "description": "Derived from its deployments: `draft`, `active`, `paused`,\n`stopped` or `error`."
                },
                "latest_version": {
                  "type": "integer",
                  "format": "int32",
                  "description": "Newest saved version (0: none yet).",
                  "minimum": 0
                },
                "revision": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "deployments": {
                  "$ref": "#/components/schemas/AutoDeploymentCounts"
                },
                "updated_at": {
                  "type": "string"
                },
                "pnl": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/AutoPnl",
                      "description": "Today's P&L over all its deployments (from the strategy ledgers);\nabsent when the ledgers cannot be read just now."
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoStrategyTemplate": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A ready strategy to start from.",
              "required": [
                "id",
                "name",
                "goal",
                "description",
                "category",
                "category_label",
                "risk",
                "risk_label",
                "components",
                "indicators",
                "needs",
                "summary",
                "deployable",
                "blockers",
                "warnings",
                "document"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Stable id, e.g. `short_strangle`."
                },
                "name": {
                  "type": "string",
                  "description": "Plain-English name, e.g. `Short strangle`."
                },
                "goal": {
                  "type": "string",
                  "description": "The outcome it is for, e.g. `Earn from a quiet market`."
                },
                "description": {
                  "type": "string",
                  "description": "One line."
                },
                "category": {
                  "type": "string",
                  "description": "`income`, `hedged_income`, `breakout`, `trend`, `big_move`,\n`bullish` or `bearish` (labels in `category_label`)."
                },
                "category_label": {
                  "type": "string"
                },
                "risk": {
                  "type": "string",
                  "description": "`limited` or `unlimited`: whether the most it can lose is known\nbefore entering (a sold option without a bought one of the same\ntype, or a future, is unlimited)."
                },
                "risk_label": {
                  "type": "string",
                  "description": "`Limited loss` or `Unlimited loss`."
                },
                "components": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "`name@major` of every component it uses\n(`GET /v2/strategies/components`)."
                },
                "indicators": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Indicator functions its conditions call (`rsi`, `supertrend_dir`, ...)."
                },
                "needs": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Broker capabilities its components need."
                },
                "summary": {
                  "type": "string",
                  "description": "The strategy in plain English."
                },
                "deployable": {
                  "type": "boolean",
                  "description": "A version of it can be deployed on this server now."
                },
                "blockers": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutoStrategyProblem"
                  },
                  "description": "Why not, when not (e.g. indicator conditions not available here)."
                },
                "warnings": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutoStrategyProblem"
                  }
                },
                "document": {
                  "type": "object",
                  "description": "The document, normalized (defaults written out): send it as\n`document` to `POST /v2/strategies` or `/import`, after any edits."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_AutoStrategyVersion": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "An immutable version.",
              "required": [
                "strategy_id",
                "n",
                "schema_version",
                "compiled_hash",
                "components",
                "summary",
                "deployable",
                "blockers",
                "warnings",
                "created_at"
              ],
              "properties": {
                "strategy_id": {
                  "type": "string"
                },
                "n": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "schema_version": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "compiled_hash": {
                  "type": "string"
                },
                "components": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "summary": {
                  "type": "string"
                },
                "deployable": {
                  "type": "boolean"
                },
                "blockers": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutoStrategyProblem"
                  }
                },
                "warnings": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AutoStrategyProblem"
                  }
                },
                "created_at": {
                  "type": "string"
                },
                "document": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "The version's document, normalized. Left out of lists."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_BacktestView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A backtest: where it is and, once done, its result.",
              "required": [
                "id",
                "strategy_id",
                "version",
                "status",
                "from",
                "to",
                "capital",
                "costs",
                "progress",
                "cancel_requested",
                "created_at",
                "expires_at",
                "sources",
                "counts"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "strategy_id": {
                  "type": "string"
                },
                "version": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "status": {
                  "$ref": "#/components/schemas/BacktestStatus"
                },
                "from": {
                  "type": "string"
                },
                "to": {
                  "type": "string"
                },
                "capital": {
                  "type": "number",
                  "format": "double"
                },
                "costs": {
                  "$ref": "#/components/schemas/BacktestCosts"
                },
                "progress": {
                  "$ref": "#/components/schemas/BacktestProgress"
                },
                "cancel_requested": {
                  "type": "boolean"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "started_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "finished_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "expires_at": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When the result is deleted."
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Why it failed, in words."
                },
                "summary": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/BacktestSummary",
                      "description": "Once done."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "labels": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/BacktestLabels",
                      "description": "How to read the result (always shown with it)."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "sources": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BacktestSourceRow"
                  },
                  "description": "Where every series came from."
                },
                "equity": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "$ref": "#/components/schemas/BacktestEquityPoint"
                  },
                  "description": "Equity at each day's close (`GET /v2/backtests/{id}` only)."
                },
                "counts": {
                  "$ref": "#/components/schemas/BacktestCounts",
                  "description": "Rows served by `.../trades` and `.../cycles`."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_BasketSummary": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "List-view row.",
              "required": [
                "id",
                "name",
                "leg_count",
                "updated_at"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Basket id."
                },
                "name": {
                  "type": "string",
                  "description": "Display name."
                },
                "leg_count": {
                  "type": "integer",
                  "description": "Number of legs.",
                  "minimum": 0
                },
                "updated_at": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Last update (RFC3339)."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_NotificationEventInfo": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "One row of the catalogue the app shows.",
              "required": [
                "event",
                "label",
                "description",
                "group",
                "default_on",
                "mandatory",
                "account_level",
                "available"
              ],
              "properties": {
                "event": {
                  "$ref": "#/components/schemas/NotificationEvent"
                },
                "label": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "group": {
                  "$ref": "#/components/schemas/NotificationEventGroup"
                },
                "default_on": {
                  "type": "boolean",
                  "description": "On for a channel unless the user turns it off."
                },
                "mandatory": {
                  "type": "boolean",
                  "description": "Always delivered in the app (the app channel cannot turn it off)."
                },
                "account_level": {
                  "type": "boolean",
                  "description": "Sent whatever a channel's strategy / trigger scope (it is about an\naccount, not a strategy)."
                },
                "available": {
                  "type": "boolean",
                  "description": "`false`: not sent yet (it can be routed ahead of the feature)."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_PartnerApp": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A registered partner app.",
              "required": [
                "client_id",
                "owner",
                "name",
                "verified",
                "logo_url",
                "redirect_uris",
                "scopes",
                "created_at",
                "disabled"
              ],
              "properties": {
                "client_id": {
                  "type": "string",
                  "description": "OAuth client id (`cp_...`)."
                },
                "owner": {
                  "type": "string",
                  "description": "Username of the user who registered the app."
                },
                "name": {
                  "type": "string",
                  "description": "Name shown to users on the consent screen."
                },
                "verified": {
                  "type": "boolean",
                  "description": "Whether the operator has confirmed that the app's name belongs to\nits owner; never set through the API. Unverified apps are flagged\non the consent screen."
                },
                "logo_url": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "HTTPS URL of the app's logo."
                },
                "redirect_uris": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Exact redirect URIs a user may be sent back to."
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Scope"
                  },
                  "description": "The most a user can grant this partner."
                },
                "created_at": {
                  "type": "string",
                  "description": "RFC 3339 time of registration."
                },
                "disabled": {
                  "type": "boolean",
                  "description": "`true` once the owner disabled the app (its tokens stop working)."
                },
                "webhook": {
                  "$ref": "#/components/schemas/PartnerWebhookView",
                  "description": "The app's webhook (never its secret); absent until one is set with\n`PATCH /v1/partner-apps/{client_id}`."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_PartnerConnection": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A partner app the user connected (granted access to).",
              "required": [
                "client_id",
                "app_name",
                "verified",
                "scopes",
                "connected_at",
                "updated_at",
                "last_used_at",
                "calls_today"
              ],
              "properties": {
                "client_id": {
                  "type": "string",
                  "description": "The partner app's client id."
                },
                "app_name": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The app's name; `null` when the app has since been disabled."
                },
                "verified": {
                  "type": "boolean",
                  "description": "Whether the app is verified (see `PartnerApp.verified`)."
                },
                "dynamic": {
                  "type": "boolean",
                  "description": "`true` when the app registered itself dynamically (an MCP client, see\n`PartnerApp.dynamic`); `false` for classic partner apps and for a\ndisabled app."
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Scope"
                  },
                  "description": "Scopes the user granted."
                },
                "connected_at": {
                  "type": "string",
                  "description": "RFC 3339 time of the first connection."
                },
                "updated_at": {
                  "type": "string",
                  "description": "RFC 3339 time of the latest grant."
                },
                "last_used_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "RFC 3339 time of the app's latest request, refreshed at most once a\nminute; `null` when it has made none (or none in the last 90 days)."
                },
                "calls_today": {
                  "type": "integer",
                  "format": "int32",
                  "description": "Requests the app made today (IST day) that were not refused by its\nrate limit.",
                  "minimum": 0
                },
                "revoked_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "RFC 3339 time the connection was revoked; absent while it is live.\nRevoked connections are listed for 30 days."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_SharedGrant": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A share another user granted to the caller.",
              "required": [
                "owner_username",
                "owner_name",
                "scopes",
                "account_scope"
              ],
              "properties": {
                "owner_username": {
                  "type": "string",
                  "description": "Username of the owner (the path segment `{owner}` of the other\nshared routes)."
                },
                "owner_name": {
                  "type": "string",
                  "description": "The owner's display name (their username when none is set)."
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ShareScope"
                  },
                  "description": "What the owner shared."
                },
                "account_scope": {
                  "$ref": "#/components/schemas/ShareAccountScope"
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_SignalModeView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "One signal URL and where its strategy's alerts go.",
              "required": [
                "endpoint_id",
                "kind",
                "strategy_id",
                "mode",
                "can_use_algo"
              ],
              "properties": {
                "endpoint_id": {
                  "type": "string",
                  "description": "The signal URL (`we_...`)."
                },
                "kind": {
                  "$ref": "#/components/schemas/SignalProvider"
                },
                "strategy_id": {
                  "type": "string",
                  "description": "The Signals strategy the URL is for."
                },
                "mode": {
                  "$ref": "#/components/schemas/SignalMode",
                  "description": "`direct`: alerts place orders from the strategy's settings (as\nbefore). `algo`: alerts become signals to `deployment_id`, which\ndecides with its own rules and safety checks."
                },
                "deployment_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The bound deployment (`algo` only)."
                },
                "switched_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "When the mode last changed (RFC 3339); null: never switched."
                },
                "can_use_algo": {
                  "type": "boolean",
                  "description": "False for Kuberhunt URLs (they stay direct for now)."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_SignalUrl": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A live signal URL (never its secret).",
              "required": [
                "endpoint_id",
                "kind",
                "strategy_id",
                "created_at",
                "has_body_secret"
              ],
              "properties": {
                "endpoint_id": {
                  "type": "string",
                  "description": "Public id (`we_...`), kept across rotations."
                },
                "kind": {
                  "$ref": "#/components/schemas/SignalProvider"
                },
                "strategy_id": {
                  "type": "string",
                  "description": "The strategy the URL's signals trade."
                },
                "created_at": {
                  "type": "string",
                  "description": "When this URL (its current secret) was issued (RFC 3339)."
                },
                "has_body_secret": {
                  "type": "boolean",
                  "description": "TradingView: alerts must carry the body secret."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_SweepView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A sweep: where it is and, once done, the recommended version and the\noverfitting warnings to show before deploy.",
              "required": [
                "id",
                "strategy_id",
                "version",
                "status",
                "from",
                "to",
                "capital",
                "costs",
                "axes",
                "progress",
                "cost",
                "cancel_requested",
                "created_at",
                "expires_at",
                "warnings",
                "notes"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "strategy_id": {
                  "type": "string"
                },
                "version": {
                  "type": "integer",
                  "format": "int32",
                  "description": "The saved version the sweep started from.",
                  "minimum": 0
                },
                "status": {
                  "$ref": "#/components/schemas/BacktestStatus",
                  "description": "`running` until every version ended, then `done`, `failed` (fewer\nthan two versions finished) or `cancelled`."
                },
                "from": {
                  "type": "string"
                },
                "to": {
                  "type": "string"
                },
                "capital": {
                  "type": "number",
                  "format": "double"
                },
                "costs": {
                  "$ref": "#/components/schemas/BacktestCosts"
                },
                "axes": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SweepAxis"
                  }
                },
                "progress": {
                  "$ref": "#/components/schemas/SweepProgress"
                },
                "cost": {
                  "type": "integer",
                  "format": "int64",
                  "description": "What it counts against the daily backtest limit.",
                  "minimum": 0
                },
                "cancel_requested": {
                  "type": "boolean"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "finished_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "expires_at": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When the sweep and its backtests are deleted."
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Why it failed, in words."
                },
                "recommended": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int32",
                  "description": "The recommended version's `n`: the best plateau, not the best point.",
                  "minimum": 0
                },
                "warnings": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Plain words, shown before deploy."
                },
                "notes": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Checks that did not run and why, and versions left out."
                },
                "deflated_sharpe": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "format": "double",
                  "description": "Deflated Sharpe ratio of the recommended version (0 to 1)."
                },
                "pbo": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "format": "double",
                  "description": "Probability of backtest overfitting (0 to 1), from 16 versions."
                },
                "walk_forward": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SweepWalkForward"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "versions": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "$ref": "#/components/schemas/SweepVersion"
                  },
                  "description": "Every version (`GET /v2/backtests/sweeps/{sweep_id}` only)."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_TriggerV2": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A v2 trigger and where it stands.",
              "required": [
                "trigger_id",
                "account",
                "strategy",
                "kind",
                "legs",
                "spec",
                "valid_until",
                "state",
                "transition_seq",
                "reason",
                "created_at",
                "updated_at",
                "protection"
              ],
              "properties": {
                "trigger_id": {
                  "type": "string"
                },
                "account": {
                  "type": "string"
                },
                "strategy": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "kind": {
                  "$ref": "#/components/schemas/TriggerV2Kind"
                },
                "legs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TriggerV2Leg"
                  }
                },
                "spec": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "The spec as created; null when not known here."
                },
                "valid_until": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "state": {
                  "type": "string",
                  "description": "`submitted` until the engine reports, then the machine's state:\n`armed`, `pending`, `active`, `t1` … (ladder rungs), `paused`, and\nthe ended ones `fired`, `done`, `target_hit`, `sl_hit`, `breached`,\n`expired`, `cancelled`, `errored`; `cancel_pending` on broker-held\nprotection whose cancel the broker refused while still holding it.\nA protection held as a v1 record is `pending` until its entry fills,\nthen `active` (or `cancel_pending`); ended, it shows one of the\nended states above (`target_hit`, `sl_hit`, `fired`, `done` when the\nposition was exited another way, `cancelled`, or `errored` when it\nstopped protecting because something failed or why is not known),\nwith v1's reason in `reason` (e.g. `stop_loss_executed_by_broker`).\nOther values may appear."
                },
                "transition_seq": {
                  "type": "integer",
                  "format": "int64",
                  "description": "Changes the engine made so far.",
                  "minimum": 0
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Why it last changed, when the engine said (errors, expiry, …). A\ntrigger the server ended on its own is `cancelled` with `day_ended`\n(intraday, after its session's close) or `contract_expired`."
                },
                "created_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_at": {
                  "type": "string"
                },
                "protection": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "description": "What protects the position, part by part (`stop_loss`,\n`stop_condition`, `target`, `target_1` …, `target_condition`,\n`trail`): held by the broker (protects even when the server is\ndown) or by the server. Null for alerts and risk limits, and for triggers\ncreated before protection was planned.",
                  "additionalProperties": {
                    "$ref": "#/components/schemas/TriggerV2ProtectionPart"
                  },
                  "propertyNames": {
                    "type": "string"
                  }
                },
                "last_result": {
                  "$ref": "#/components/schemas/TriggerV2LastResult",
                  "description": "The engine's answer to the last command it handled for this\ntrigger (a refused modify, pause, resume or cancel shows here with\nits reason); absent until it answered one."
                },
                "entry": {
                  "$ref": "#/components/schemas/TriggerV2Entry",
                  "description": "The entry the server placed for this trigger (a bracket whose\n`entry` condition held): absent for triggers without one. `status`\n`outcome_unknown` means the entry may or may not be at the broker;\nit is never sent again (check the order book)."
                },
                "created_via": {
                  "$ref": "#/components/schemas/TriggerV2CreatedVia",
                  "description": "How the trigger was made: `app` (the app), `api` (an API key or a\npartner app), `order_ticket` (the server, protecting a `POST\n/v1/orders` fill). Absent for triggers made before this was\nrecorded."
                },
                "route": {
                  "$ref": "#/components/schemas/ProtectionRoute",
                  "description": "For a `bracket` or `ladder`: where its protection lives. `gtt` (a\nbroker GTT) or `stop_order` (a broker stop-loss order): held by the\nbroker, it protects the position even when the server is down;\n`trigger`: the server evaluates it (parts the broker backs show in\n`protection`). Absent for alerts and risk limits."
                },
                "route_reason": {
                  "type": "string",
                  "description": "Why that route, in words, when known."
                },
                "risk_progress": {
                  "$ref": "#/components/schemas/TriggerV2RiskProgress",
                  "description": "For a `risk_limit` with `targets` or a `profit_trail`: which\ntargets fired and where the trail stands, as of the trigger's last\nevent. Absent for every other trigger."
                },
                "watch": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TriggerV2Watch"
                  },
                  "description": "The instruments the conditions read but the trigger never trades,\nas created (`watch` of the create request, so a change round-trips).\nAbsent when there are none."
                },
                "group": {
                  "type": "string",
                  "description": "The label given at create (`group`); absent when none."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_WatchlistSummary": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "List-view row.",
              "required": [
                "id",
                "name",
                "count",
                "updated_at"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Watchlist id (24 hex characters)."
                },
                "name": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "description": "Number of members.",
                  "minimum": 0
                },
                "updated_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time",
                  "description": "Last change (RFC3339); null when never recorded."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Vec_WebhookView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A webhook as its owner sees it (never the secret). Times are RFC 3339.",
              "required": [
                "id",
                "url",
                "events",
                "accounts",
                "description",
                "enabled",
                "disabled_reason",
                "disabled_at",
                "consecutive_failures",
                "last_success_at",
                "last_failure_at",
                "previous_secret_expires_at",
                "secret_rotated_at",
                "created_at",
                "updated_at"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Webhook id."
                },
                "url": {
                  "type": "string",
                  "description": "The receiver: an `https://` URL on a public host."
                },
                "events": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEventType"
                  },
                  "description": "The events it gets (see the document's `webhooks` section for each\nbody)."
                },
                "accounts": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  },
                  "description": "The accounts whose events it gets; null = every account of the user\n(including ones added later). Events about the user rather than one\naccount go to every webhook subscribed to them."
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The owner's note."
                },
                "enabled": {
                  "type": "boolean",
                  "description": "Whether deliveries are sent."
                },
                "disabled_reason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Why it is off: `disabled_by_user`, `too_many_failures` (50 failed\nattempts in a row) or `failing_for_24_hours`; null while enabled."
                },
                "disabled_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "consecutive_failures": {
                  "type": "integer",
                  "format": "int32",
                  "description": "Failed attempts in a row (any success resets it).",
                  "minimum": 0
                },
                "last_success_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_failure_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "previous_secret_expires_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "While set, deliveries are also signed with the previous secret\n(for 24 hours after a rotation)."
                },
                "secret_rotated_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                },
                "trigger_updates": {
                  "type": "boolean",
                  "description": "Present (and `true`) only when the owner opted in to\n`trigger_update` deliveries (v2 trigger changes); absent otherwise."
                }
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_Watchlist": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A watchlist with its members.",
            "required": [
              "id",
              "name",
              "symbols",
              "tradable",
              "updated_at"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Watchlist id (24 hex characters)."
              },
              "name": {
                "type": "string"
              },
              "symbols": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WatchlistSymbol"
                },
                "description": "Members, in the order they were added."
              },
              "tradable": {
                "type": "integer",
                "description": "Members a stock strategy would trade today (`status` `tradable`).",
                "minimum": 0
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Last change (RFC3339); null when never recorded."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_WatchlistId": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The id of a saved watchlist.",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_WebhookDeliveryPage": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "One page of a webhook's delivery attempts, newest first. Doc-only\nmirror of the body `deliveries` builds.",
            "required": [
              "deliveries",
              "next_cursor"
            ],
            "properties": {
              "deliveries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Pass as `cursor` for the next page; null on the last page."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_WebhookTestResult": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "The result of a test delivery (one signed `ping`, one attempt, no\nretry; logged like any delivery).",
            "required": [
              "event_id",
              "delivered",
              "status_code",
              "duration_ms",
              "error_kind"
            ],
            "properties": {
              "event_id": {
                "type": "string",
                "description": "The `ping` event's id (its `webhook-id` header)."
              },
              "delivered": {
                "type": "boolean",
                "description": "Whether the receiver answered 2xx."
              },
              "status_code": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "description": "The receiver's HTTP status; null when no answer came.",
                "minimum": 0
              },
              "duration_ms": {
                "type": "integer",
                "format": "int64",
                "description": "How long the attempt took.",
                "minimum": 0
              },
              "error_kind": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why it failed: `timeout`, `connect`, `blocked_address`,\n`http_status`, `redirect`...; null when delivered."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_WebhookView": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A webhook as its owner sees it (never the secret). Times are RFC 3339.",
            "required": [
              "id",
              "url",
              "events",
              "accounts",
              "description",
              "enabled",
              "disabled_reason",
              "disabled_at",
              "consecutive_failures",
              "last_success_at",
              "last_failure_at",
              "previous_secret_expires_at",
              "secret_rotated_at",
              "created_at",
              "updated_at"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Webhook id."
              },
              "url": {
                "type": "string",
                "description": "The receiver: an `https://` URL on a public host."
              },
              "events": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WebhookEventType"
                },
                "description": "The events it gets (see the document's `webhooks` section for each\nbody)."
              },
              "accounts": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                },
                "description": "The accounts whose events it gets; null = every account of the user\n(including ones added later). Events about the user rather than one\naccount go to every webhook subscribed to them."
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The owner's note."
              },
              "enabled": {
                "type": "boolean",
                "description": "Whether deliveries are sent."
              },
              "disabled_reason": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Why it is off: `disabled_by_user`, `too_many_failures` (50 failed\nattempts in a row) or `failing_for_24_hours`; null while enabled."
              },
              "disabled_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "consecutive_failures": {
                "type": "integer",
                "format": "int32",
                "description": "Failed attempts in a row (any success resets it).",
                "minimum": 0
              },
              "last_success_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_failure_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "previous_secret_expires_at": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "While set, deliveries are also signed with the previous secret\n(for 24 hours after a rotation)."
              },
              "secret_rotated_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "trigger_updates": {
                "type": "boolean",
                "description": "Present (and `true`) only when the owner opted in to\n`trigger_update` deliveries (v2 trigger changes); absent otherwise."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "Success_WebhookWithSecret": {
        "type": "object",
        "description": "Successful response: `data` holds the result, `error` is null.",
        "required": [
          "status",
          "data",
          "error"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SuccessStatus"
          },
          "data": {
            "type": "object",
            "description": "A webhook with its signing secret (shown only in this response).\nDoc-only mirror of the body `with_secret` builds. Times are RFC 3339.",
            "required": [
              "id",
              "url",
              "events",
              "accounts",
              "description",
              "enabled",
              "disabled_reason",
              "disabled_at",
              "consecutive_failures",
              "last_success_at",
              "last_failure_at",
              "previous_secret_expires_at",
              "secret_rotated_at",
              "created_at",
              "updated_at",
              "secret",
              "note"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "events": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WebhookEventType"
                }
              },
              "accounts": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                },
                "description": "null = every account."
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "enabled": {
                "type": "boolean"
              },
              "disabled_reason": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`disabled_by_user`, `too_many_failures` or `failing_for_24_hours`."
              },
              "disabled_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "consecutive_failures": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "last_success_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_failure_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "previous_secret_expires_at": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "After a rotation: until then deliveries are also signed with the\nprevious secret."
              },
              "secret_rotated_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "trigger_updates": {
                "type": "boolean",
                "description": "Present (and `true`) only when `trigger_update` deliveries (v2\ntrigger changes) are on; absent otherwise."
              },
              "secret": {
                "type": "string",
                "description": "The signing secret (`whsec_...`): verify each delivery's\n`webhook-signature` with it. Store it now: it is never shown again."
              },
              "note": {
                "type": "string",
                "description": "A reminder that the secret is shown only once."
              }
            }
          },
          "error": {
            "type": "null"
          }
        }
      },
      "SweepAxis": {
        "type": "object",
        "description": "One setting a sweep varies.",
        "required": [
          "path",
          "values"
        ],
        "properties": {
          "path": {
            "type": "string",
            "description": "JSON pointer to a number in the strategy document, e.g.\n`/spec/legs/items/0/strike/delta`."
          },
          "values": {
            "type": "array",
            "items": {
              "type": "number",
              "format": "double"
            },
            "description": "Values to try, smallest first."
          }
        },
        "additionalProperties": false
      },
      "SweepInput": {
        "type": "object",
        "description": "Start a sweep: one backtest per version of up to 3 settings.",
        "required": [
          "strategy_id",
          "axes",
          "from",
          "to"
        ],
        "properties": {
          "strategy_id": {
            "type": "string"
          },
          "version": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The saved version the sweep starts from; the latest when absent.",
            "minimum": 0
          },
          "axes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SweepAxis"
            },
            "description": "1 to 3 settings; at most 200 versions in all."
          },
          "from": {
            "type": "string",
            "description": "First day (`YYYY-MM-DD`, IST).",
            "example": "2026-07-01"
          },
          "to": {
            "type": "string",
            "description": "Last day, inclusive; before today. `from` to `to` covers at most\n1098 days (3 years), both included.",
            "example": "2026-09-30"
          },
          "capital": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Virtual capital (₹); default 5,00,000."
          },
          "costs": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BacktestCostsInput"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "SweepProgress": {
        "type": "object",
        "description": "The sweep's versions by where they are.",
        "required": [
          "total",
          "queued",
          "running",
          "done",
          "failed",
          "cancelled"
        ],
        "properties": {
          "total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "queued": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "running": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "done": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "cancelled": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "SweepVersion": {
        "type": "object",
        "description": "One version of the sweep.",
        "required": [
          "n",
          "values",
          "backtest_id",
          "status",
          "recommended"
        ],
        "properties": {
          "n": {
            "type": "integer",
            "format": "int32",
            "description": "Its number in the sweep (from 0; the last setting varies fastest).",
            "minimum": 0
          },
          "values": {
            "type": "array",
            "items": {
              "type": "number",
              "format": "double"
            },
            "description": "One value per axis, in the order of `axes`."
          },
          "backtest_id": {
            "type": "string",
            "description": "Its backtest (`GET /v2/backtests/{backtest_id}` for trades and cycles)."
          },
          "status": {
            "$ref": "#/components/schemas/BacktestStatus"
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it failed, in words."
          },
          "summary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BacktestSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "sharpe": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Per-day Sharpe ratio, once the sweep is done (absent when undefined)."
          },
          "plateau": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Mean Sharpe over its grid neighbours: the recommended version has\nthe best."
          },
          "recommended": {
            "type": "boolean"
          }
        }
      },
      "SweepWalkForward": {
        "type": "object",
        "required": [
          "tests",
          "lost"
        ],
        "properties": {
          "tests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SweepWalkForwardTest"
            }
          },
          "lost": {
            "type": "integer",
            "format": "int32",
            "description": "Tests whose chosen version lost money.",
            "minimum": 0
          }
        }
      },
      "SweepWalkForwardTest": {
        "type": "object",
        "description": "One walk-forward test: the version chosen on the older days and its\nreturn on the days after.",
        "required": [
          "train",
          "test",
          "chosen",
          "test_return"
        ],
        "properties": {
          "train": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            },
            "description": "Day indexes (from 0), end exclusive."
          },
          "test": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          "chosen": {
            "type": "integer",
            "format": "int32",
            "description": "The version chosen on the training days (`n`).",
            "minimum": 0
          },
          "test_return": {
            "type": "number",
            "format": "double",
            "description": "Its compounded return on the test days (0.01 = 1%)."
          }
        }
      },
      "SymbolStatus": {
        "type": "string",
        "description": "Whether a member can be part of a stock strategy's universe today.",
        "enum": [
          "tradable",
          "not_listed",
          "not_equity",
          "not_allowed"
        ]
      },
      "TelegramChannelStatus": {
        "type": "object",
        "required": [
          "available",
          "unavailable_reason",
          "state",
          "linked",
          "healthy",
          "broken_reason",
          "broken_at",
          "linked_at",
          "last_delivered_at",
          "telegram_username",
          "bot_username"
        ],
        "properties": {
          "available": {
            "type": "boolean",
            "description": "Telegram can be used on this server. `false`: there is no bot, so\nnothing is sent to Telegram and it cannot be linked (see\n`unavailable_reason`); the app and webhooks still work."
          },
          "unavailable_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Plain words to show when `available` is `false`; null otherwise."
          },
          "state": {
            "$ref": "#/components/schemas/TelegramState"
          },
          "linked": {
            "type": "boolean"
          },
          "healthy": {
            "type": "boolean",
            "description": "Linked and delivering."
          },
          "broken_reason": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationBrokenReason",
                "description": "Why Telegram refuses our messages (`broken` only)."
              },
              {
                "type": "null"
              }
            ]
          },
          "broken_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "linked_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_delivered_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "telegram_username": {
            "type": [
              "string",
              "null"
            ],
            "description": "The user's Telegram `@username`, when they have one."
          },
          "bot_username": {
            "type": "string",
            "description": "The bot to talk to; empty when `available` is `false`."
          }
        }
      },
      "TelegramState": {
        "type": "string",
        "description": "`not_linked`, `linked` (delivering) or `broken` (Telegram refuses our\nmessages: see `broken_reason`).",
        "enum": [
          "not_linked",
          "linked",
          "broken"
        ]
      },
      "TimelineEntry": {
        "type": "object",
        "description": "One step in an order's life (from the order journal).",
        "required": [
          "at",
          "account",
          "order_id",
          "state",
          "message",
          "filled_qty",
          "average_price"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "account": {
            "type": "string"
          },
          "order_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string",
            "description": "`SUBMITTED`, `OPEN`, `FILLED`, `PARTIALLY_FILLED`, `CANCELLED`, ..."
          },
          "message": {
            "type": [
              "string",
              "null"
            ]
          },
          "filled_qty": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Filled so far at this step (when the journal knows).",
            "minimum": 0
          },
          "average_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          }
        }
      },
      "Totals": {
        "type": "object",
        "description": "Realized and unrealized P&L (no charges).",
        "required": [
          "realized",
          "unrealized",
          "total",
          "ltp_stale"
        ],
        "properties": {
          "realized": {
            "type": "number",
            "format": "double"
          },
          "unrealized": {
            "type": "number",
            "format": "double",
            "description": "Of the rows with a price."
          },
          "total": {
            "type": "number",
            "format": "double",
            "description": "`realized + unrealized`."
          },
          "ltp_stale": {
            "type": "boolean",
            "description": "Some open row's price is not current or missing (see\n`StrategyRow.ltp_stale`)."
          }
        }
      },
      "TradeRow": {
        "type": "object",
        "description": "One executed trade (fill) from the broker's trade book (enriched).",
        "required": [
          "account",
          "order_id",
          "instrument_token",
          "tradingsymbol",
          "side",
          "quantity",
          "fill_price",
          "trade_value"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "order_id": {
            "type": "string",
            "description": "Broker order id."
          },
          "instrument_token": {
            "type": "string"
          },
          "tradingsymbol": {
            "type": "string"
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "fill_price": {
            "type": "number",
            "format": "double"
          },
          "trade_value": {
            "type": "number",
            "format": "double"
          },
          "filled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "trade_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's or exchange's id for this fill; absent when the broker\ndoes not report it."
          },
          "product": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Product",
                "description": "Product of the fill's order; absent when the broker does not report\nit."
              },
              {
                "type": "null"
              }
            ]
          },
          "lot_size": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Contract lot size (added when the instrument is known).",
            "minimum": 0
          },
          "broker_tradingsymbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's own spelling of the symbol, only when it differs\nfrom `tradingsymbol` (which always comes from the instrument\nlist)."
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exchange as the instrument list gives it (`NSE`, `BSE`, `MCX`,\n...): index options and futures are listed under the cash\nexchange (`NSE` for NIFTY, `BSE` for SENSEX), so match on what\n`GET /v1/instruments` returns, not on `NFO` / `BFO`."
          },
          "instrument_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Instrument type (`EQ`, `FUTIDX`, `OPTIDX`, `OPTSTK`, ...)."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Underlying symbol (the trading symbol for equities)."
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "description": "Expiry date (`YYYY-MM-DD`); empty for non-derivatives."
          },
          "strike": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Strike price; `0` for non-options."
          },
          "option_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "`CE` / `PE`; empty for non-options."
          },
          "sector": {
            "type": [
              "string",
              "null"
            ],
            "description": "Industry sector; absent when the instrument list has none."
          },
          "isin": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISIN; absent when the instrument list has none."
          },
          "indices": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Index memberships (e.g. `NIFTY`, `NIFTY100`); absent when\nnone."
          },
          "instrument_missing": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Present (`true`) only when the instrument is not known; the\ninstrument fields above are then absent."
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Last traded price (added when a quote is available)."
          },
          "prev_close": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Previous close (`0` when unknown), sent with `ltp`."
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "TriggerV2": {
        "type": "object",
        "description": "A v2 trigger and where it stands.",
        "required": [
          "trigger_id",
          "account",
          "strategy",
          "kind",
          "legs",
          "spec",
          "valid_until",
          "state",
          "transition_seq",
          "reason",
          "created_at",
          "updated_at",
          "protection"
        ],
        "properties": {
          "trigger_id": {
            "type": "string"
          },
          "account": {
            "type": "string"
          },
          "strategy": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/TriggerV2Kind"
          },
          "legs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2Leg"
            }
          },
          "spec": {
            "type": [
              "object",
              "null"
            ],
            "description": "The spec as created; null when not known here."
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string",
            "description": "`submitted` until the engine reports, then the machine's state:\n`armed`, `pending`, `active`, `t1` … (ladder rungs), `paused`, and\nthe ended ones `fired`, `done`, `target_hit`, `sl_hit`, `breached`,\n`expired`, `cancelled`, `errored`; `cancel_pending` on broker-held\nprotection whose cancel the broker refused while still holding it.\nA protection held as a v1 record is `pending` until its entry fills,\nthen `active` (or `cancel_pending`); ended, it shows one of the\nended states above (`target_hit`, `sl_hit`, `fired`, `done` when the\nposition was exited another way, `cancelled`, or `errored` when it\nstopped protecting because something failed or why is not known),\nwith v1's reason in `reason` (e.g. `stop_loss_executed_by_broker`).\nOther values may appear."
          },
          "transition_seq": {
            "type": "integer",
            "format": "int64",
            "description": "Changes the engine made so far.",
            "minimum": 0
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it last changed, when the engine said (errors, expiry, …). A\ntrigger the server ended on its own is `cancelled` with `day_ended`\n(intraday, after its session's close) or `contract_expired`."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          },
          "protection": {
            "type": [
              "object",
              "null"
            ],
            "description": "What protects the position, part by part (`stop_loss`,\n`stop_condition`, `target`, `target_1` …, `target_condition`,\n`trail`): held by the broker (protects even when the server is\ndown) or by the server. Null for alerts and risk limits, and for triggers\ncreated before protection was planned.",
            "additionalProperties": {
              "$ref": "#/components/schemas/TriggerV2ProtectionPart"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "last_result": {
            "$ref": "#/components/schemas/TriggerV2LastResult",
            "description": "The engine's answer to the last command it handled for this\ntrigger (a refused modify, pause, resume or cancel shows here with\nits reason); absent until it answered one."
          },
          "entry": {
            "$ref": "#/components/schemas/TriggerV2Entry",
            "description": "The entry the server placed for this trigger (a bracket whose\n`entry` condition held): absent for triggers without one. `status`\n`outcome_unknown` means the entry may or may not be at the broker;\nit is never sent again (check the order book)."
          },
          "created_via": {
            "$ref": "#/components/schemas/TriggerV2CreatedVia",
            "description": "How the trigger was made: `app` (the app), `api` (an API key or a\npartner app), `order_ticket` (the server, protecting a `POST\n/v1/orders` fill). Absent for triggers made before this was\nrecorded."
          },
          "route": {
            "$ref": "#/components/schemas/ProtectionRoute",
            "description": "For a `bracket` or `ladder`: where its protection lives. `gtt` (a\nbroker GTT) or `stop_order` (a broker stop-loss order): held by the\nbroker, it protects the position even when the server is down;\n`trigger`: the server evaluates it (parts the broker backs show in\n`protection`). Absent for alerts and risk limits."
          },
          "route_reason": {
            "type": "string",
            "description": "Why that route, in words, when known."
          },
          "risk_progress": {
            "$ref": "#/components/schemas/TriggerV2RiskProgress",
            "description": "For a `risk_limit` with `targets` or a `profit_trail`: which\ntargets fired and where the trail stands, as of the trigger's last\nevent. Absent for every other trigger."
          },
          "watch": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2Watch"
            },
            "description": "The instruments the conditions read but the trigger never trades,\nas created (`watch` of the create request, so a change round-trips).\nAbsent when there are none."
          },
          "group": {
            "type": "string",
            "description": "The label given at create (`group`); absent when none."
          }
        }
      },
      "TriggerV2AccountCapabilities": {
        "type": "object",
        "description": "What one account's broker can hold.",
        "required": [
          "account",
          "broker_protection_enabled",
          "holds",
          "facts"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "broker_protection_enabled": {
            "type": "boolean",
            "description": "Whether the server places protection at the broker at all; when\noff, the server holds every part."
          },
          "holds": {
            "$ref": "#/components/schemas/TriggerV2BrokerHolds",
            "description": "Broker order types that can hold protection."
          },
          "facts": {
            "type": "object",
            "description": "The broker's protection facts by name.",
            "additionalProperties": {
              "$ref": "#/components/schemas/TriggerV2BrokerFact"
            },
            "propertyNames": {
              "type": "string"
            }
          }
        }
      },
      "TriggerV2BrokerFact": {
        "type": "object",
        "description": "One protection fact about the broker: proven by a recording or not\n(an unverified fact is treated as the unsafe case).",
        "required": [
          "status",
          "value"
        ],
        "properties": {
          "status": {
            "type": "string",
            "description": "`verified` or `unverified`."
          },
          "value": {
            "type": [
              "object",
              "null"
            ],
            "description": "The proven value; null when unverified."
          }
        }
      },
      "TriggerV2BrokerHolds": {
        "type": "object",
        "description": "Broker order types that can hold protection.",
        "required": [
          "bracket",
          "cover",
          "gtt",
          "gtt_two_leg"
        ],
        "properties": {
          "bracket": {
            "type": "boolean"
          },
          "cover": {
            "type": "boolean"
          },
          "gtt": {
            "type": "boolean"
          },
          "gtt_two_leg": {
            "type": "boolean"
          }
        }
      },
      "TriggerV2ConditionReading": {
        "type": "object",
        "description": "One condition in plain English.",
        "required": [
          "field",
          "on",
          "hold_s",
          "text",
          "indicators",
          "warm_bars",
          "warm_up"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "`spec.when`, `spec.entry.when`, `spec.target.when`, `spec.stop_loss.when`."
          },
          "on": {
            "type": "string",
            "description": "`close` (at each candle close) or `tick` (every price tick)."
          },
          "hold_s": {
            "type": "integer",
            "format": "int32",
            "description": "Tick mode: seconds it must stay true before acting.",
            "minimum": 0
          },
          "text": {
            "type": "string",
            "description": "Exactly when it fires."
          },
          "indicators": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2IndicatorRead"
            }
          },
          "warm_bars": {
            "type": "integer",
            "format": "int32",
            "description": "The most history any of its indicators needs (candles).",
            "minimum": 0
          },
          "warm_up": {
            "type": "string",
            "description": "Where that history comes from: `history` (loaded at once) or `live`\n(ready after `warm_bars` candles)."
          }
        }
      },
      "TriggerV2CreatedVia": {
        "type": "string",
        "description": "How a v2 trigger was made.",
        "enum": [
          "app",
          "api",
          "order_ticket"
        ]
      },
      "TriggerV2Entry": {
        "type": "object",
        "description": "The entry order the server placed for a v2 trigger.",
        "required": [
          "status",
          "filled_qty",
          "avg_price",
          "order_ids",
          "reason"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/TriggerV2EntryStatus"
          },
          "filled_qty": {
            "type": "integer",
            "format": "int64",
            "description": "Units filled so far.",
            "minimum": 0
          },
          "avg_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Average fill price; null until something filled."
          },
          "order_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The broker's order ids, one per slice once known."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it failed, or what is unknown; null otherwise."
          }
        }
      },
      "TriggerV2EntryStatus": {
        "type": "string",
        "description": "Where the entry stands: `sending` (being placed), `accepted` (at the\nbroker, not filled yet), `filled`, `partially_filled`, `failed`\n(refused or ended with no fill; the trigger is cancelled),\n`outcome_unknown` (may or may not be at the broker; never sent again).\nOther values may appear.",
        "enum": [
          "sending",
          "accepted",
          "filled",
          "partially_filled",
          "failed",
          "outcome_unknown",
          "other"
        ]
      },
      "TriggerV2ExpressionLanguage": {
        "type": "object",
        "description": "The expression language (a strict subset of CEL; numbers are doubles).",
        "required": [
          "variables",
          "functions",
          "operators",
          "max_source_bytes",
          "max_depth",
          "max_nodes"
        ],
        "properties": {
          "variables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2ExpressionName"
            }
          },
          "functions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2ExpressionName"
            }
          },
          "operators": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "max_source_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "max_depth": {
            "type": "integer",
            "minimum": 0
          },
          "max_nodes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "TriggerV2ExpressionName": {
        "type": "object",
        "description": "A name a condition may read, or a function it may call.",
        "required": [
          "name",
          "description"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "TriggerV2HeldBy": {
        "type": "string",
        "description": "Who holds a part.",
        "enum": [
          "broker",
          "server"
        ]
      },
      "TriggerV2IndicatorCapabilities": {
        "type": "object",
        "description": "What indicator conditions offer (from the engine's registry).",
        "required": [
          "functions",
          "patterns",
          "presets",
          "intervals",
          "segments",
          "limits"
        ],
        "properties": {
          "functions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2IndicatorFunction"
            }
          },
          "patterns": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2IndicatorPattern"
            },
            "description": "Candlestick patterns, read with `bullish_pattern`, `bearish_pattern`\nor `pattern` (`'name'`, then the timeframe) at the candle close."
          },
          "presets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2IndicatorPreset"
            }
          },
          "intervals": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "`1m` … `60m`."
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Exchanges with indicator conditions now."
          },
          "limits": {
            "$ref": "#/components/schemas/TriggerV2IndicatorLimits"
          }
        }
      },
      "TriggerV2IndicatorCompare": {
        "type": "object",
        "description": "How a value compares with its threshold.",
        "required": [
          "op",
          "to",
          "band",
          "distance"
        ],
        "properties": {
          "op": {
            "type": "string"
          },
          "to": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "band": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "distance": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          }
        }
      },
      "TriggerV2IndicatorFunction": {
        "type": "object",
        "description": "One indicator function.",
        "required": [
          "function",
          "indicator",
          "group",
          "description",
          "label",
          "unit",
          "verbs",
          "params",
          "needs_volume",
          "arguments_schema"
        ],
        "properties": {
          "function": {
            "type": "string",
            "description": "As written in a condition (`rsi`, `bb_upper`)."
          },
          "indicator": {
            "type": "string",
            "description": "The indicator it belongs to (`RSI`, `Bollinger Bands`)."
          },
          "group": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "description": "Label template; `{0}` … are the parameters (`RSI({0})`)."
          },
          "unit": {
            "type": "string",
            "description": "`price`, `oscillator`, `price_units`, `ratio`, `direction`, `volume`."
          },
          "verbs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Verbs the form offers (`rises_above`, `turns_up`, ...)."
          },
          "params": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2IndicatorParam"
            },
            "description": "Parameters in order; the timeframe comes last."
          },
          "needs_volume": {
            "type": "boolean",
            "description": "Needs traded volume (not on an index)."
          },
          "arguments_schema": {
            "type": "object",
            "description": "JSON Schema of the call's arguments (parameters, then the timeframe)."
          }
        }
      },
      "TriggerV2IndicatorHold": {
        "type": "object",
        "description": "A tick-mode hold in progress.",
        "required": [
          "since",
          "need_s"
        ],
        "properties": {
          "since": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "need_s": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "TriggerV2IndicatorLimits": {
        "type": "object",
        "description": "Indicator limits.",
        "required": [
          "max_calls_per_condition",
          "max_timeframes_per_trigger",
          "max_watch",
          "max_indicators",
          "max_series",
          "hold_s_max",
          "order_hold_s_default",
          "order_hold_s_min",
          "repeat_cooldown_bars_max",
          "repeat_max_per_day_max"
        ],
        "properties": {
          "max_calls_per_condition": {
            "type": "integer",
            "minimum": 0
          },
          "max_timeframes_per_trigger": {
            "type": "integer",
            "minimum": 0
          },
          "max_watch": {
            "type": "integer",
            "minimum": 0
          },
          "max_indicators": {
            "type": "integer",
            "description": "Indicator instances across the user's live triggers.",
            "minimum": 0
          },
          "max_series": {
            "type": "integer",
            "description": "(instrument, timeframe) series across the user's live triggers.",
            "minimum": 0
          },
          "hold_s_max": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "order_hold_s_default": {
            "type": "integer",
            "format": "int32",
            "description": "Order-placing tick-mode conditions: the default and least hold.",
            "minimum": 0
          },
          "order_hold_s_min": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "repeat_cooldown_bars_max": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "repeat_max_per_day_max": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "TriggerV2IndicatorParam": {
        "type": "object",
        "description": "One parameter of an indicator.",
        "required": [
          "name",
          "label",
          "type",
          "min",
          "max",
          "default"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "description": "As the form says it (`RSI length`)."
          },
          "type": {
            "type": "string",
            "description": "`int` or `float`."
          },
          "min": {
            "type": "number",
            "format": "double"
          },
          "max": {
            "type": "number",
            "format": "double"
          },
          "default": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "TriggerV2IndicatorPattern": {
        "type": "object",
        "description": "A candlestick pattern conditions can read at the candle close:\n`bullish_pattern('engulfing', '15m')`, `pattern('doji', '5m')`.",
        "required": [
          "name",
          "label",
          "directions",
          "candles",
          "functions"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "As written in a condition (`engulfing`)."
          },
          "label": {
            "type": "string",
            "description": "In plain English (`engulfing`, `morning star`)."
          },
          "directions": {
            "type": "string",
            "description": "`both`, `bullish`, `bearish` or `neither` (no direction, like a\ndoji)."
          },
          "candles": {
            "type": "integer",
            "format": "int32",
            "description": "Candles the pattern spans; the last one completes it.",
            "minimum": 0
          },
          "functions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Functions that accept it (`bullish_pattern`, `bearish_pattern`,\n`pattern`)."
          }
        }
      },
      "TriggerV2IndicatorPreset": {
        "type": "object",
        "description": "A one-click starting point.",
        "required": [
          "name",
          "when",
          "on",
          "interval"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "when": {
            "type": "string",
            "description": "The condition it builds on leg 0."
          },
          "on": {
            "type": "string",
            "description": "`close` or `tick`."
          },
          "interval": {
            "type": "string"
          }
        }
      },
      "TriggerV2IndicatorRead": {
        "type": "object",
        "description": "One indicator a condition reads.",
        "required": [
          "expr",
          "label",
          "warm_bars"
        ],
        "properties": {
          "expr": {
            "type": "string",
            "description": "As written: `nifty.rsi(14, '5m')`."
          },
          "label": {
            "type": "string",
            "description": "`RSI(14) · NIFTY 50 · 5m`."
          },
          "warm_bars": {
            "type": "integer",
            "format": "int32",
            "description": "Closed candles of history needed before its value matches a chart.",
            "minimum": 0
          }
        }
      },
      "TriggerV2IndicatorValue": {
        "type": "object",
        "description": "One indicator value of the trigger now.",
        "required": [
          "label",
          "expr",
          "condition",
          "status",
          "closed",
          "live",
          "bar_start",
          "warm_bars_left",
          "gap",
          "compare",
          "hold"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "expr": {
            "type": "string"
          },
          "condition": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "`warming`, `ready` or `fallback`."
          },
          "closed": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The last closed candle's value."
          },
          "live": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The forming candle's value."
          },
          "bar_start": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Epoch ms of the forming candle's start."
          },
          "warm_bars_left": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "gap": {
            "type": "boolean",
            "description": "The last candle was built across a gap in prices."
          },
          "compare": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TriggerV2IndicatorCompare"
              },
              {
                "type": "null"
              }
            ]
          },
          "hold": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TriggerV2IndicatorHold"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "TriggerV2JourneyActor": {
        "type": "object",
        "description": "Who asked, as the owner sees it.",
        "required": [
          "user",
          "credential"
        ],
        "properties": {
          "user": {
            "type": "string",
            "description": "The trigger's owner (the caller)."
          },
          "credential": {
            "type": "string",
            "description": "`app`, `api_key`, `partner` or `support` (an operator acting for\nthe user; never named)."
          },
          "api_key_id": {
            "type": "string",
            "description": "The API key's id (never its secret), when an API key was used."
          },
          "partner_client_id": {
            "type": "string",
            "description": "The partner app's client id, when a partner acted."
          },
          "ip": {
            "type": "string",
            "description": "The caller's own IP (app sessions and the user's API keys only)."
          }
        }
      },
      "TriggerV2JourneyEntry": {
        "type": "object",
        "description": "A journey entry as the API shows it.",
        "required": [
          "entry_id",
          "at",
          "seq",
          "source",
          "kind",
          "summary",
          "actor",
          "details"
        ],
        "properties": {
          "entry_id": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "description": "RFC 3339, India time."
          },
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "The trigger's change counter this entry goes with (0 when none).",
            "minimum": 0
          },
          "source": {
            "type": "string",
            "description": "`api`, `engine`, `result`, `exit` or `protection` (other values\nmay appear)."
          },
          "kind": {
            "type": "string",
            "description": "What happened: `created`, `modified`, `paused`, `resumed`,\n`cancelled` (api); `transition`, `note` (engine); `rejected`\n(result); `exit_placed`, `exit_partly_filled`, `exit_filled`,\n`exit_refused`, `exit_unfilled`, `exit_repriced`, `exit_retried`\n(an action of the event not done yet), `exit_failed` (given up,\ndead-lettered) (exit);\n`gtt_placed`, `gtt_modified`, `gtt_cancelled`, `gtt_triggered`,\n`readback_matched`, `readback_mismatch`, `readback_unknown`,\n`degraded` (protection). Other values may appear."
          },
          "summary": {
            "type": "string"
          },
          "actor": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TriggerV2JourneyActor"
              },
              {
                "type": "null"
              }
            ]
          },
          "details": {
            "type": "object",
            "description": "Kind-specific detail (only the fields listed for the kind)."
          }
        }
      },
      "TriggerV2Kind": {
        "type": "string",
        "description": "The machine that runs a trigger.",
        "enum": [
          "alert",
          "bracket",
          "ladder",
          "risk_limit"
        ]
      },
      "TriggerV2KindInfo": {
        "type": "object",
        "description": "A kind and its spec.",
        "required": [
          "kind",
          "description",
          "legs",
          "spec_fields"
        ],
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/TriggerV2Kind"
          },
          "description": {
            "type": "string"
          },
          "legs": {
            "type": "string",
            "description": "Legs: `none`, `one` or `one or more`."
          },
          "spec_fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerV2SpecField"
            }
          }
        }
      },
      "TriggerV2LastResult": {
        "type": "object",
        "description": "The engine's answer to a command.",
        "required": [
          "op",
          "command_id",
          "outcome",
          "reason",
          "at"
        ],
        "properties": {
          "op": {
            "type": "string",
            "description": "`create`, `modify`, `cancel`, `pause` or `resume`."
          },
          "command_id": {
            "type": "string",
            "description": "The command's id (`command_id` of the `202`)."
          },
          "outcome": {
            "type": "string",
            "description": "`applied`, `duplicate` (already applied) or `rejected` (other\nvalues may appear)."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it was refused; null otherwise."
          },
          "at": {
            "type": "string",
            "description": "When the command was sent; RFC 3339, India time."
          }
        }
      },
      "TriggerV2Leg": {
        "type": "object",
        "description": "A leg as created.",
        "required": [
          "instrument_token",
          "side",
          "quantity",
          "product"
        ],
        "properties": {
          "instrument_token": {
            "type": "string"
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "product": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Product"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "TriggerV2LegRequest": {
        "type": "object",
        "description": "One instrument the trigger watches (and, for `bracket` / `ladder`,\ntrades).",
        "required": [
          "instrument_token",
          "side",
          "quantity"
        ],
        "properties": {
          "instrument_token": {
            "type": "string",
            "description": "Instrument id (see `/v1/instruments`)."
          },
          "side": {
            "$ref": "#/components/schemas/Side",
            "description": "Side of the position's entry (`BUY` = long)."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Units.",
            "minimum": 0
          },
          "product": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Product",
                "description": "The position's product; required for `bracket` and `ladder`."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "TriggerV2Limits": {
        "type": "object",
        "description": "Limits this deployment's engine runs with.",
        "required": [
          "max_triggers",
          "max_legs",
          "max_expressions",
          "max_symbols",
          "max_trigger_bytes",
          "max_rungs"
        ],
        "properties": {
          "max_triggers": {
            "type": "integer",
            "description": "Live triggers per user.",
            "minimum": 0
          },
          "max_legs": {
            "type": "integer",
            "minimum": 0
          },
          "max_expressions": {
            "type": "integer",
            "description": "Strings in one spec (an upper bound on its expressions).",
            "minimum": 0
          },
          "max_symbols": {
            "type": "integer",
            "description": "Distinct instruments across a user's live triggers.",
            "minimum": 0
          },
          "max_trigger_bytes": {
            "type": "integer",
            "description": "One trigger's size as JSON.",
            "minimum": 0
          },
          "max_rungs": {
            "type": "integer",
            "description": "Targets of one ladder.",
            "minimum": 0
          }
        }
      },
      "TriggerV2LimitsCheck": {
        "type": "object",
        "description": "The trigger against the per-trigger limits.",
        "required": [
          "ok",
          "reason",
          "legs",
          "max_legs",
          "expressions",
          "max_expressions",
          "bytes",
          "max_bytes"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Which limit it passes, in words; null when within them all."
          },
          "legs": {
            "type": "integer",
            "minimum": 0
          },
          "max_legs": {
            "type": "integer",
            "minimum": 0
          },
          "expressions": {
            "type": "integer",
            "description": "Strings in the spec (an upper bound on its expressions).",
            "minimum": 0
          },
          "max_expressions": {
            "type": "integer",
            "minimum": 0
          },
          "bytes": {
            "type": "integer",
            "description": "The trigger's size as JSON.",
            "minimum": 0
          },
          "max_bytes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "TriggerV2PlannedPart": {
        "type": "object",
        "description": "Who would hold one part of the protection.",
        "required": [
          "held_by",
          "level",
          "adjusted_by_server",
          "note"
        ],
        "properties": {
          "held_by": {
            "$ref": "#/components/schemas/TriggerV2HeldBy"
          },
          "level": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "adjusted_by_server": {
            "type": "boolean",
            "description": "The server would move the broker's level (trailing, ladder advance)."
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "TriggerV2Problem": {
        "type": "object",
        "description": "One reason the trigger would be refused (as create's `422` says it).",
        "required": [
          "field",
          "message"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "The offending input path (`spec`, `legs[0].product`, ...)."
          },
          "message": {
            "type": "string"
          }
        }
      },
      "TriggerV2ProtectionPart": {
        "type": "object",
        "description": "One part of a v2 trigger's protection.",
        "required": [
          "held_by",
          "broker_order_id",
          "level",
          "adjusted_by_server",
          "status",
          "note"
        ],
        "properties": {
          "held_by": {
            "$ref": "#/components/schemas/TriggerV2HeldBy"
          },
          "broker_order_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The broker's GTT or order id, when the broker holds the part."
          },
          "level": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The part's price level, when it has one."
          },
          "adjusted_by_server": {
            "type": "boolean",
            "description": "The server moves the broker's level (trailing, ladder advance)."
          },
          "status": {
            "$ref": "#/components/schemas/TriggerV2ProtectionStatus"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why, in words."
          }
        }
      },
      "TriggerV2ProtectionPreview": {
        "type": "object",
        "description": "How the trigger would be protected on this account and product.",
        "required": [
          "parts",
          "reason"
        ],
        "properties": {
          "parts": {
            "type": "object",
            "description": "By part (`stop_loss`, `stop_condition`, `target`, `target_1` …,\n`target_condition`, `trail`).",
            "additionalProperties": {
              "$ref": "#/components/schemas/TriggerV2PlannedPart"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why nothing (or not everything) would be at the broker."
          }
        }
      },
      "TriggerV2ProtectionStatus": {
        "type": "string",
        "description": "Where a part stands.",
        "enum": [
          "protected",
          "degraded",
          "unknown",
          "held_by_server",
          "ended"
        ]
      },
      "TriggerV2Reads": {
        "type": "object",
        "description": "What the trigger's conditions read.",
        "required": [
          "symbols",
          "fields",
          "variables"
        ],
        "properties": {
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Instruments whose ticks it watches (`instrument_token`)."
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tick fields read, as written (`ltp`, `prev.ltp`, `legs[1].bid`)."
          },
          "variables": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Other variables read (`entry_px`, `sl_px`, `account.mtm`, ...)."
          }
        }
      },
      "TriggerV2RiskLevelReading": {
        "type": "object",
        "description": "One level of a risk limit, in plain English.",
        "required": [
          "field",
          "text"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "`spec.mtm_floor`, `spec.profit_lock`, `spec.profit_trail`,\n`spec.targets[0]`, `spec.targets`, `spec.when`."
          },
          "text": {
            "type": "string",
            "description": "What happens there, in words."
          }
        }
      },
      "TriggerV2RiskProgress": {
        "type": "object",
        "description": "Where a risk limit's targets and profit trail stand.",
        "required": [
          "targets",
          "targets_fired",
          "trail_armed",
          "trail_peak",
          "trail_floor"
        ],
        "properties": {
          "targets": {
            "type": "integer",
            "description": "Targets in the spec.",
            "minimum": 0
          },
          "targets_fired": {
            "type": "integer",
            "format": "int32",
            "description": "Targets that fired: always the first ones (they fire in order,\neach once).",
            "minimum": 0
          },
          "trail_armed": {
            "type": "boolean",
            "description": "The profit trail armed (MTM reached `profit_trail.arm_at`)."
          },
          "trail_peak": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The highest MTM since the trail armed (as of the last event: the\ntrail's moves are reported once per trail distance); null before."
          },
          "trail_floor": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The trail's floor (only ever rises); null before it armed."
          }
        }
      },
      "TriggerV2SegmentProducts": {
        "type": "object",
        "description": "Products by market segment (what a leg's `product` may be).",
        "required": [
          "segment",
          "exchanges",
          "products"
        ],
        "properties": {
          "segment": {
            "type": "string",
            "description": "`equity` (cash market) or `derivatives` (futures and options,\ncommodities, currencies)."
          },
          "exchanges": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The instrument master's exchange codes in the segment."
          },
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            },
            "description": "`MIS` (intraday), `DELIVERY` / `MTF` (equity held overnight, MTF on\nmargin), `CARRYFORWARD` (derivatives held overnight). A broker may\nstill refuse one it does not offer (MTF on some brokers)."
          }
        }
      },
      "TriggerV2SpecField": {
        "type": "object",
        "description": "A spec field of a kind.",
        "required": [
          "name",
          "type",
          "required",
          "description"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Path in `spec` (`stop_loss.trail.step`, `targets[].price`)."
          },
          "type": {
            "type": "string",
            "description": "`condition` (true/false expression), `price` (number expression),\n`number`, `string` or `object`."
          },
          "required": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "TriggerV2Watch": {
        "type": "object",
        "description": "A watched instrument.",
        "required": [
          "name",
          "symbol"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "How conditions name it (`nifty` in `nifty.rsi(14, '5m')`)."
          },
          "symbol": {
            "type": "string",
            "description": "Its instrument token."
          }
        }
      },
      "TriggerV2WatchRequest": {
        "type": "object",
        "description": "An instrument a trigger reads but never trades.",
        "required": [
          "name",
          "symbol"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "How conditions name it: `[a-z][a-z0-9_]{0,15}` (`nifty` in\n`nifty.rsi(14, '5m')`)."
          },
          "symbol": {
            "type": "string",
            "description": "Its instrument token."
          }
        },
        "additionalProperties": false
      },
      "WatchlistInput": {
        "type": "object",
        "description": "Create / update request body.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name, 1-60 characters after trimming, unique per user; not\none of the app's built-in lists (`Indices`, `Nifty 50`, `Nifty\nBank`)."
          },
          "symbols": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Members as instrument tokens (`instrument_token`), at most 50, in\norder. Every symbol added must be an NSE or BSE cash equity in\ntoday's instrument list. On create, absent means empty; on update,\nabsent keeps the members, present replaces them (members kept from\nbefore are not checked again)."
          }
        },
        "additionalProperties": false
      },
      "WatchlistSymbol": {
        "type": "object",
        "description": "One member of a watchlist.",
        "required": [
          "instrument_token",
          "tradingsymbol",
          "stock",
          "exchange",
          "name",
          "status"
        ],
        "properties": {
          "instrument_token": {
            "type": "string",
            "description": "Instrument token."
          },
          "tradingsymbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Trading symbol; null when the instrument list does not know it."
          },
          "stock": {
            "type": [
              "string",
              "null"
            ],
            "description": "The stock's symbol as strategies name it (`RELIANCE`); null when\nnot listed."
          },
          "exchange": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exchange (`NSE`, `BSE`); null when not listed."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company name; null when not known."
          },
          "status": {
            "$ref": "#/components/schemas/SymbolStatus"
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "WebhookChannelStatus": {
        "type": "object",
        "required": [
          "enabled",
          "receivers"
        ],
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "The webhook channel is on in the preferences."
          },
          "receivers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotificationWebhookStatus"
            }
          }
        }
      },
      "WebhookDelivery": {
        "type": "object",
        "description": "One delivery attempt (ids, status and timing only, never the body).",
        "required": [
          "id",
          "event_id",
          "type",
          "attempt",
          "outcome",
          "status_code",
          "duration_ms",
          "error_kind",
          "at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Attempt id (sorts by time)."
          },
          "event_id": {
            "type": "string",
            "description": "The event's id (its `webhook-id` header; the same on every retry)."
          },
          "type": {
            "$ref": "#/components/schemas/WebhookEventType"
          },
          "attempt": {
            "type": "integer",
            "format": "int32",
            "description": "1 for the first attempt, then one more per retry.",
            "minimum": 0
          },
          "outcome": {
            "type": "string",
            "description": "`delivered`, `retrying` (another attempt is scheduled), `failed` (no\nmore attempts) or `dropped`."
          },
          "status_code": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The receiver's HTTP status; null when no answer came.",
            "minimum": 0
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it failed: `timeout`, `connect`, `blocked_address`,\n`http_status`, `redirect`...; null when delivered."
          },
          "at": {
            "type": "string",
            "description": "When the attempt was made (RFC 3339)."
          }
        }
      },
      "WebhookEventType": {
        "type": "string",
        "description": "Event names. A receiver subscribes to any of `order_update` (any\nchange to an order), `trade` (a fill), `account_alert` (something about\nan account that needs the user) and `positions` (an account's positions\nchanged, at most once per second per account). `ping` is sent only by\nthe webhook's test endpoint and cannot be subscribed to.",
        "enum": [
          "order_update",
          "trade",
          "account_alert",
          "positions",
          "ping"
        ]
      },
      "WebhookPatch": {
        "type": "object",
        "description": "Changes to a webhook: only the fields present change.",
        "properties": {
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "A new receiver URL (same rules as on creation)."
          },
          "events": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            },
            "description": "A new event list (replaces the old one; at least one)."
          },
          "accounts": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "A new account list; `null` goes back to every account."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "A new note; `null` or empty removes it."
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "`false` turns deliveries off; `true` turns them back on (also after\nthe webhook was turned off for failing)."
          },
          "trigger_updates": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "`true` also sends `trigger_update` (a v2 trigger of the user\nchanged; see the document's `webhooks` section); `false` stops it.\nA new webhook starts without it unless created with it."
          }
        },
        "additionalProperties": false
      },
      "ChartinkAlert": {
        "type": "object",
        "description": "Chartink scanner alert body, sent by Chartink to\n`POST /v1/hooks/chartink/{secret}`. Chartink cannot sign requests, so\nthe URL secret is the credential. Fields other than these are ignored\n(`scan_url`, `webhook_url`, ...). The same alert (same `triggered_at`,\n`stocks`, `scan_name`, `alert_name`) arriving again within 10 minutes is\ntreated as one.",
        "required": [
          "stocks"
        ],
        "properties": {
          "stocks": {
            "$ref": "#/components/schemas/StringOrList",
            "description": "Stock symbols (NSE, else BSE), at most 50. Unknown symbols are\nskipped; the rest are still traded."
          },
          "trigger_prices": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StringOrList",
                "description": "Trigger price of each stock, in the same order as `stocks`. A\nmissing or zero price skips that stock."
              },
              {
                "type": "null"
              }
            ]
          },
          "triggered_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the scan fired, as Chartink formats it (`\"2:34 pm\"`)."
          },
          "scan_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "alert_name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "examples": [
          {
            "stocks": "SBIN,RELIANCE",
            "trigger_prices": "523.4,2890",
            "triggered_at": "2:34 pm",
            "scan_name": "Breakouts",
            "alert_name": "Breakouts"
          }
        ]
      },
      "ConnectionRevokedReason": {
        "type": "string",
        "description": "Why a connection ended.",
        "enum": [
          "user_revoked",
          "refresh_token_replay",
          "signed_out_everywhere"
        ]
      },
      "KuberhuntEvent": {
        "type": "object",
        "description": "Kuberhunt event body, sent to `POST /v1/hooks/kuberhunt/{secret}` or\nto the pre-v1 URL `POST /kuberhunt/execute-signal/{token}` (same body,\nsame headers; retired per strategy once its v1 URL has received an\naccepted delivery, and answered with `Deprecation` / `Sunset` headers).\n\nHeaders: `X-Kuberhunt-Timestamp` (Unix seconds, within ±300 s of now)\nand `X-Kuberhunt-Signature: v1=<hex HMAC-SHA256>` over\n`{timestamp}.{raw body}`, keyed with the strategy's Kuberhunt webhook\nsecret. Every refusal is answered 200 (Kuberhunt retries any non-2xx);\nonly a failure worth retrying is answered 503. The same `event_id` is\nhandled once; an `event_seq` not above the last one seen for the\nrecommendation is skipped as stale.",
        "required": [
          "event",
          "event_id",
          "reco"
        ],
        "properties": {
          "event": {
            "$ref": "#/components/schemas/KuberhuntEventName"
          },
          "event_id": {
            "$ref": "#/components/schemas/StringOrNumber",
            "description": "Delivery id (a string or a number); repeats are ignored for 24 h."
          },
          "event_seq": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StringOrNumber",
                "description": "Per-recommendation sequence (an integer, a whole number, or a\nnumeric string); anything else disables the ordering check."
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the event was produced (RFC 3339). An entry older than 120 s\nis skipped."
          },
          "reco": {
            "$ref": "#/components/schemas/KuberhuntReco"
          },
          "transition": {
            "description": "Provider detail about the state change; kept in the history, not\nused."
          },
          "meta": {
            "description": "Provider metadata; kept in the history, not used."
          }
        },
        "examples": [
          {
            "event": "reco.activated",
            "event_id": "evt-1",
            "event_seq": 1,
            "timestamp": "2026-09-28T04:05:06.789+00:00",
            "reco": {
              "reco_id": "r1",
              "instrument_token": "CT:1:2:RELIANCE-EQ",
              "action": "BUY",
              "product": "INTRADAY",
              "lower_price": 2490,
              "entry_price": 2500,
              "stop_loss_price": 2450,
              "target_price": 2600
            }
          }
        ]
      },
      "KuberhuntEventName": {
        "type": "string",
        "description": "Kuberhunt event name. `reco.activated` opens a position (entry);\n`reco.sl_hit`, `reco.target_reached` and `reco.exit` close it;\n`reco.invalidated` / `reco.cancelled` close it too; `reco.updated` /\n`reco.trail_updated` move its stop-loss / target; `reco.scheduled`,\n`reco.pending`, `webhook.test` and `reco.t1_reached` ...\n`reco.t5_reached` are acknowledged without action. Any other name is\nacknowledged and ignored.",
        "enum": [
          "reco.activated",
          "reco.scheduled",
          "reco.pending",
          "webhook.test",
          "reco.trail_updated",
          "reco.updated",
          "reco.t1_reached",
          "reco.t2_reached",
          "reco.t3_reached",
          "reco.t4_reached",
          "reco.t5_reached",
          "reco.sl_hit",
          "reco.target_reached",
          "reco.exit",
          "reco.invalidated",
          "reco.cancelled"
        ]
      },
      "KuberhuntReco": {
        "type": "object",
        "description": "The recommendation an event is about. Prices may be numbers or numeric\nstrings. `instrument_token` or its legacy name is accepted; send one\n(both with different values is refused).",
        "required": [
          "reco_id"
        ],
        "properties": {
          "reco_id": {
            "$ref": "#/components/schemas/StringOrNumber",
            "description": "Recommendation id; every later event finds the position by it. An\nentry without one is skipped."
          },
          "instrument_token": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StringOrNumber",
                "description": "Instrument id to trade (a string, or an integer). An entry without\none is skipped."
              },
              {
                "type": "null"
              }
            ]
          },
          "action": {
            "type": [
              "string",
              "null"
            ],
            "description": "`BUY` or `SELL` (any case); anything else, or none, is `BUY`."
          },
          "product": {
            "type": [
              "string",
              "null"
            ],
            "description": "`INTRADAY` / `MIS` or `CARRYFORWARD` / `CNC`; used when the strategy\nmirrors the recommendation's product."
          },
          "lower_price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StringOrNumber",
                "description": "Limit price for strategies entering at the lower price."
              },
              {
                "type": "null"
              }
            ]
          },
          "higher_price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StringOrNumber",
                "description": "Limit price for strategies entering at the higher price."
              },
              {
                "type": "null"
              }
            ]
          },
          "entry_price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StringOrNumber",
                "description": "Reference price (limit fallback, slippage reference)."
              },
              {
                "type": "null"
              }
            ]
          },
          "stop_loss_price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StringOrNumber",
                "description": "Stop-loss price, placed when the strategy asks for it."
              },
              {
                "type": "null"
              }
            ]
          },
          "target_price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StringOrNumber",
                "description": "Target price, placed when the strategy asks for it."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token"
        }
      },
      "PortfolioData": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PositionRow"
            }
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HoldingRow"
            }
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TradeRow"
            }
          },
          {
            "$ref": "#/components/schemas/MarginRow"
          }
        ],
        "description": "`positions`, `holdings`, `trades`: a list of rows (may be empty); `margins`: one object."
      },
      "PortfolioKind": {
        "type": "string",
        "description": "Portfolio data kinds kept as per-account snapshots.",
        "enum": [
          "positions",
          "holdings",
          "trades",
          "margins"
        ]
      },
      "SignalAck": {
        "type": "object",
        "description": "Reply with status 200 (see `SignalAckMessage` for every message).",
        "required": [
          "message"
        ],
        "properties": {
          "message": {
            "$ref": "#/components/schemas/SignalAckMessage"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "message": "Webhook received"
          }
        ]
      },
      "SignalAckMessage": {
        "type": "string",
        "description": "Every message a signal URL answers with status 200. The delivery was\nreceived; nothing more is promised (what it came to is in the URL's\ndelivery log and the activity log).\n\n- `Webhook received`: handled (orders placed, closed, updated, or\n  skipped by a strategy rule).\n- `Duplicate`: the same alert arrived twice; the copy was skipped.\n- `Stale`: an older Kuberhunt event arrived after a newer one.\n- `Signal is disabled` / `Strategy paused`: the strategy is paused.\n- `Strategy not found`: the strategy no longer exists.\n- `Invalid Payload` / `Invalid payload` / `Invalid JSON` / `Empty body`:\n  the body could not be read.\n- `Invalid signature`, `Timestamp out of window`, `Webhook secret\n  missing`: Kuberhunt signature checks.\n- `Only entry and exit signals are processed`: TradingView `type` was\n  neither.\n- `Too many stocks in one alert`, `No valid stocks found`, `No accounts\n  configured`: Chartink alerts that could not be traded.\n- `instrument_token ... differ; send one`, `order_tag ... differ; send\n  one`, `exits ... differ; send one`: a field was sent under both its\n  names with different values.\n- `Invalid ID`: the pre-v1 Kuberhunt URL's token is invalid.",
        "enum": [
          "Webhook received",
          "Duplicate",
          "Stale",
          "Signal is disabled",
          "Strategy paused",
          "Strategy not found",
          "Invalid Payload",
          "Invalid payload",
          "Invalid JSON",
          "Empty body",
          "Invalid signature",
          "Timestamp out of window",
          "Webhook secret missing",
          "Only entry and exit signals are processed",
          "Too many stocks in one alert",
          "No valid stocks found",
          "No accounts configured",
          "instrument_token and cirrus_token differ; send one",
          "order_tag and cirrus_tag differ; send one",
          "exits and cirrus_exits differ; send one",
          "Invalid ID"
        ]
      },
      "SignalError": {
        "type": "object",
        "description": "Reply before the URL's strategy is known: 404 `Unknown webhook`\n(unknown, revoked or malformed URL), 429 `rate limited; retry in {n}\nms` (with `Retry-After`, `X-RateLimit-Limit` and\n`X-RateLimit-Remaining` headers), or 503 `temporarily unavailable`.",
        "required": [
          "status",
          "message"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/SignalErrorStatus"
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "status": "error",
            "message": "Unknown webhook"
          }
        ]
      },
      "SignalErrorStatus": {
        "type": "string",
        "description": "Always `error`.",
        "enum": [
          "error"
        ]
      },
      "SignalForbidden": {
        "type": "object",
        "description": "Reply with status 403: the TradingView body secret did not match.",
        "required": [
          "message"
        ],
        "properties": {
          "message": {
            "$ref": "#/components/schemas/SignalForbiddenMessage"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "message": "Invalid secret"
          }
        ]
      },
      "SignalForbiddenMessage": {
        "type": "string",
        "description": "Messages answered with 403 (`Invalid secret`: the TradingView body\nsecret is missing or wrong).",
        "enum": [
          "Invalid secret"
        ]
      },
      "SignalRetry": {
        "type": "object",
        "description": "Reply with status 503: send the same delivery again later.",
        "required": [
          "message"
        ],
        "properties": {
          "message": {
            "$ref": "#/components/schemas/SignalRetryMessage"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "message": "Order handling failed; please redeliver"
          }
        ]
      },
      "SignalRetryMessage": {
        "type": "string",
        "description": "Messages answered with 503; the provider should send the delivery\nagain: `temporarily unavailable` (a store is down), `Order handling\nfailed; please redeliver` (a Kuberhunt entry or close failed in a way\nworth retrying; its de-duplication was undone), `signal strategies\nunavailable` (strategies cannot be read on this server).",
        "enum": [
          "temporarily unavailable",
          "Order handling failed; please redeliver",
          "signal strategies unavailable"
        ]
      },
      "SnapshotKind": {
        "type": "string",
        "description": "Snapshot kind: `orders` (today's order book) or a portfolio kind.",
        "enum": [
          "orders",
          "positions",
          "holdings",
          "trades",
          "margins"
        ]
      },
      "StreamAccount": {
        "type": "object",
        "description": "An account the stream covers, with the user's label for it.",
        "required": [
          "account",
          "broker"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "broker": {
            "type": "string",
            "description": "Broker id (`zerodha`, `upstox`, ...)."
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "The user's own label for the account."
          }
        },
        "additionalProperties": false
      },
      "StreamActivity": {
        "type": "object",
        "description": "Live: a new activity-log record.",
        "required": [
          "seq",
          "type",
          "data"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "activity"
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ActivityRecord"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 6,
            "type": "activity",
            "data": {
              "id": "01K6D8ZQ4XA1B2C3D4E5F6G7H8",
              "username": "alice",
              "at": "2026-09-28T04:05:06.789Z",
              "kind": "place",
              "category": "orders",
              "source": {
                "type": "app",
                "name": null
              },
              "request_id": "req_01K6D8ZQ4X",
              "instrument": {
                "cirrus_token": "CT:1:2:RELIANCE-EQ",
                "tradingsymbol": "RELIANCE-EQ",
                "exchange": "NSE",
                "instrument_token": "CT:1:2:RELIANCE-EQ"
              },
              "side": "BUY",
              "order_type": "LIMIT",
              "product": "MIS",
              "quantity": 10,
              "price": 2500,
              "trigger_price": null,
              "summary": "Buy 10 RELIANCE at 2500 in 1 account",
              "message": null,
              "outcome": "ok",
              "duration_ms": 84,
              "accounts": [
                {
                  "account": "ZX1234",
                  "broker": "zerodha",
                  "status": "placed",
                  "order_ids": [
                    "250928000123456"
                  ],
                  "message": null,
                  "broker_message": null,
                  "duration_ms": 84,
                  "route": "static_ip",
                  "static_ip": "203.0.113.10",
                  "proxy_ms": 6
                }
              ]
            }
          }
        ]
      },
      "StreamAuth": {
        "type": "object",
        "description": "Client -> server, the first frame: authenticates the connection. Not\nneeded when the upgrade request already carried a credential (an\n`Authorization` header, or the app's session cookie). Sent later it is\nignored. Without it within 5 s the server closes with 4002; a bad\ncredential closes with 4001.",
        "required": [
          "type",
          "token"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "auth"
            ]
          },
          "token": {
            "type": "string",
            "description": "An API key, access token or app session token (the same\ncredentials `/v1` routes accept); needs the `read` scope."
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "type": "auth",
            "token": "ck_live_4f1d0c9a7b2e"
          }
        ]
      },
      "StreamClientMessage": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/StreamAuth"
          },
          {
            "$ref": "#/components/schemas/StreamResync"
          },
          {
            "$ref": "#/components/schemas/StreamSubscribe"
          }
        ],
        "description": "Any message a client sends on `/v1/stream`, told apart by `type`."
      },
      "StreamError": {
        "type": "object",
        "description": "The stream hit a problem it cannot recover from on this connection;\nthe connection ends after it. Reconnect.",
        "required": [
          "seq",
          "type",
          "code",
          "message"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "error"
            ]
          },
          "code": {
            "$ref": "#/components/schemas/StreamErrorCode"
          },
          "message": {
            "type": "string",
            "description": "Plain-English explanation."
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 7,
            "type": "error",
            "code": "unavailable",
            "message": "live updates unavailable, please reconnect"
          }
        ]
      },
      "StreamErrorCode": {
        "type": "string",
        "description": "Why the stream cannot go on: `unavailable` (live updates could not be\nset up; reconnect).",
        "enum": [
          "unavailable"
        ]
      },
      "StreamHello": {
        "type": "object",
        "description": "First server message after authentication: who is connected and which\naccounts the stream covers. `snapshot` messages follow.",
        "required": [
          "seq",
          "type",
          "user",
          "accounts"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number, from 1, +1 per message. A gap\nmeans messages were lost: send `resync`.",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "hello"
            ]
          },
          "user": {
            "type": "string"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StreamAccount"
            }
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 1,
            "type": "hello",
            "user": "alice",
            "accounts": [
              {
                "account": "ZX1234",
                "broker": "zerodha",
                "tag": "Main"
              }
            ]
          }
        ]
      },
      "StreamMissing": {
        "type": "object",
        "description": "Sent in the snapshot set instead of an account's `snapshot` messages\nwhen the account has no live data: the same `code` and `reason` as\nREST lists it under `missing` (`no_session`: no active broker session,\nlog in to the broker; `not_supported`: the broker is not supported\nyet). An account whose broker session expired is reported this way,\nnot as an empty order list. With `kind`: only that kind is missing,\nsent instead of its `snapshot` because its only data is from an earlier\nbroker session (`stale`, read before today's 04:00 IST; never shown as\ncurrent).",
        "required": [
          "seq",
          "type",
          "account",
          "code",
          "reason"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "missing"
            ]
          },
          "account": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "description": "Only this kind is missing (`positions`, `holdings`, `trades` or\n`margins`); absent when the whole account is."
          },
          "code": {
            "$ref": "#/components/schemas/MissingCode"
          },
          "reason": {
            "type": "string",
            "description": "Why, in plain English."
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 2,
            "type": "missing",
            "account": "ZGN479",
            "code": "no_session",
            "reason": "No live data yet: the account has no active broker session (log in to the broker)"
          }
        ]
      },
      "StreamNotification": {
        "type": "object",
        "description": "Opt-in only (topic `notifications`): a notice for the user, the same\nas `GET /v1/notifications` lists it. De-duplicate on `data.id`. Never\nsent to a connection that did not subscribe.",
        "required": [
          "seq",
          "type",
          "data"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "notification"
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Notification"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 10,
            "type": "notification",
            "data": {
              "id": "ntf_6c5bee75ff79290eeee8c64a",
              "event": "trigger_fired",
              "severity": "info",
              "title": "Stop-loss hit on RELIANCE",
              "what_happened": "RELIANCE traded at ₹2,474.50.",
              "what_we_did": "We're placing the exit order.",
              "what_you_should_do": null,
              "account": "ZX1234",
              "strategy": null,
              "trigger_id": "01K6D8ZQ4X9V2M3N5P7R8S9T0W",
              "source": {
                "kind": "trigger",
                "name": "Bracket",
                "role": "stop_loss"
              },
              "thread": "trigger:01K6D8ZQ4X9V2M3N5P7R8S9T0W",
              "origin": {
                "kind": "trigger_update",
                "id": "01K6D8ZQ4X9V2M3N5P7R8S9T0W:3"
              },
              "at": "2026-09-28T09:35:07.120+05:30"
            }
          }
        ]
      },
      "StreamOrderUpdate": {
        "type": "object",
        "description": "Live: an order changed (state, fills, broker id...). Carries the full\norder, never a diff, so a missed message is repaired by the next one\nfor the same order.",
        "required": [
          "seq",
          "type",
          "account",
          "data"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "order_update"
            ]
          },
          "account": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/OrderData"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 4,
            "type": "order_update",
            "account": "ZX1234",
            "data": {
              "cirrus_tag": "01K6D8ZQ4X9V2M3N5P7R8S9T0W",
              "broker_tag": "01K6D8ZQ4X9V2M3N",
              "order_id": "250928000123456",
              "parent_tag": null,
              "username": "alice",
              "account": "ZX1234",
              "broker": "zerodha",
              "cirrus_token": "CT:1:2:RELIANCE-EQ",
              "tradingsymbol": "RELIANCE-EQ",
              "side": "BUY",
              "order_type": "LIMIT",
              "product": "MIS",
              "quantity": 10,
              "price": 2500,
              "trigger_price": null,
              "state": "PARTIALLY_FILLED",
              "filled_qty": 4,
              "average_price": 2499.8,
              "status_message": null,
              "broker_updated_at": "2026-09-28T04:05:07.120Z",
              "created_at": "2026-09-28T04:05:06.789Z",
              "status_history": [
                {
                  "from": "SUBMITTED",
                  "to": "OPEN",
                  "at": "2026-09-28T04:05:06.789Z",
                  "message": null
                },
                {
                  "from": "OPEN",
                  "to": "PARTIALLY_FILLED",
                  "at": "2026-09-28T04:05:07.120Z",
                  "message": null
                }
              ],
              "lot_size": 1,
              "exchange": "NSE",
              "instrument_type": "EQ",
              "symbol": "RELIANCE-EQ",
              "expiry": "",
              "strike": 0,
              "option_type": "",
              "ltp": 2501.5,
              "prev_close": 2490,
              "instrument_token": "CT:1:2:RELIANCE-EQ",
              "order_tag": "01K6D8ZQ4X9V2M3N5P7R8S9T0W"
            }
          }
        ]
      },
      "StreamPortfolio": {
        "type": "object",
        "description": "Live: an account's positions, holdings, trades or margins changed.\nCarries the full current data of that kind, never a diff.",
        "required": [
          "seq",
          "type",
          "account",
          "kind",
          "data"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "portfolio"
            ]
          },
          "account": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/PortfolioKind"
          },
          "data": {
            "$ref": "#/components/schemas/PortfolioData"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 5,
            "type": "portfolio",
            "account": "ZX1234",
            "kind": "margins",
            "data": {
              "account": "ZX1234",
              "opening_balance": 100000,
              "available": 90000.8,
              "utilised": 9999.2
            }
          }
        ]
      },
      "StreamResync": {
        "type": "object",
        "description": "Client -> server: asks for a fresh snapshot (every account's\n`snapshot` messages again, then `snapshot_done`). Use it after a gap\nin `seq`. Any other frame the client sends only counts as activity\nfor the idle timeout.",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "resync"
            ]
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "type": "resync"
          }
        ]
      },
      "StreamServerMessage": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/StreamHello"
          },
          {
            "$ref": "#/components/schemas/StreamSnapshot"
          },
          {
            "$ref": "#/components/schemas/StreamMissing"
          },
          {
            "$ref": "#/components/schemas/StreamSnapshotDone"
          },
          {
            "$ref": "#/components/schemas/StreamOrderUpdate"
          },
          {
            "$ref": "#/components/schemas/StreamPortfolio"
          },
          {
            "$ref": "#/components/schemas/StreamActivity"
          },
          {
            "$ref": "#/components/schemas/StreamError"
          },
          {
            "$ref": "#/components/schemas/StreamSubscribed"
          },
          {
            "$ref": "#/components/schemas/StreamTriggerUpdate"
          },
          {
            "$ref": "#/components/schemas/StreamNotification"
          }
        ],
        "description": "Any message the server sends on `/v1/stream`, told apart by `type`.\n\nOrder: `hello`, one `snapshot` per account and kind (or one `missing`\nfor an account with no live data), `snapshot_done`,\nthen live `order_update`, `portfolio` and `activity` messages as they\nhappen. `subscribed`, `trigger_update` and `notification` come only\nafter the client sent `subscribe`. Messages carry full state, never diffs; `resync` rebuilds\neverything.\n\nHeartbeat: the server sends a WebSocket ping frame every 15 s and closes\na connection it has heard nothing from (no frame, no pong) for 45 s.\nThe credential is re-checked every 10 s; logout or key revocation\ncloses the stream.\n\nClose codes: 4001 (credential missing, invalid, expired or revoked),\n4002 (no `auth` message within 5 s), 1013 (the client fell too far\nbehind; reconnect for a fresh snapshot), 1000 (idle)."
      },
      "StreamSnapshot": {
        "type": "object",
        "description": "The current state of one account's data kind, sent after `hello` (one\nper account and kind that has data) and again after `resync`. Kinds\nwith no data yet are left out. `snapshot_done` ends the set.",
        "required": [
          "seq",
          "type",
          "account",
          "kind",
          "data"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "snapshot"
            ]
          },
          "account": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/SnapshotKind"
          },
          "data": {
            "$ref": "#/components/schemas/SnapshotData"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 2,
            "type": "snapshot",
            "account": "ZX1234",
            "kind": "positions",
            "data": [
              {
                "account": "ZX1234",
                "cirrus_token": "CT:1:2:RELIANCE-EQ",
                "tradingsymbol": "RELIANCE-EQ",
                "product": "MIS",
                "net_qty": 4,
                "buy_qty": 4,
                "sell_qty": 0,
                "buy_value": 9999.2,
                "sell_value": 0,
                "average_price": 2499.8,
                "buy_average_price": 2499.8,
                "sell_average_price": 0,
                "pnl": 6.8,
                "lot_size": 1,
                "exchange": "NSE",
                "instrument_type": "EQ",
                "symbol": "RELIANCE-EQ",
                "expiry": "",
                "strike": 0,
                "option_type": "",
                "ltp": 2501.5,
                "prev_close": 2490,
                "instrument_token": "CT:1:2:RELIANCE-EQ"
              }
            ]
          }
        ]
      },
      "StreamSnapshotDone": {
        "type": "object",
        "description": "Every snapshot has been sent; live messages follow.",
        "required": [
          "seq",
          "type"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "snapshot_done"
            ]
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 3,
            "type": "snapshot_done"
          }
        ]
      },
      "StreamSubscribe": {
        "type": "object",
        "description": "Client -> server: opts in to messages a connection never gets unless\nit asks. Topics: `trigger_update` (a v2 trigger of the user changed;\nonly for users v2 triggers are enabled for) and `notifications` (the\nuser's notices; only where notifications are on, and only for the\nsigned-in app session, like `GET /v1/notifications`). Unknown topics are\nleft out. Answered with `subscribed`. Opting in again is harmless.",
        "required": [
          "type",
          "topics"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "subscribe"
            ]
          },
          "topics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "type": "subscribe",
            "topics": [
              "trigger_update"
            ]
          }
        ]
      },
      "StreamSubscribed": {
        "type": "object",
        "description": "Opt-in only: the answer to `subscribe`, listing every topic the\nconnection now gets (empty when none was granted). Never sent to a\nconnection that did not send `subscribe`.",
        "required": [
          "seq",
          "type",
          "topics"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "subscribed"
            ]
          },
          "topics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 8,
            "type": "subscribed",
            "topics": [
              "trigger_update"
            ]
          }
        ]
      },
      "StreamTriggerUpdate": {
        "type": "object",
        "description": "Opt-in only (topic `trigger_update`): a v2 trigger of the user changed,\nor the engine refused a command for it. One message per change;\nde-duplicate on `data.event_id`. Never sent to a connection that did\nnot subscribe, and never another user's trigger.",
        "required": [
          "seq",
          "type",
          "data"
        ],
        "properties": {
          "seq": {
            "type": "integer",
            "format": "int64",
            "description": "Per-connection sequence number (see `hello`).",
            "minimum": 0
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "trigger_update"
            ]
          },
          "data": {
            "$ref": "#/components/schemas/TriggerV2Update"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "seq": 9,
            "type": "trigger_update",
            "data": {
              "event_id": "01K6D8ZQ4X9V2M3N5P7R8S9T0W:3",
              "trigger_id": "01K6D8ZQ4X9V2M3N5P7R8S9T0W",
              "kind": "bracket",
              "account": "ZX1234",
              "strategy": null,
              "from": "active",
              "to": "sl_hit",
              "transition_seq": 3,
              "actions": [
                {
                  "type": "exit",
                  "legs": [
                    0
                  ],
                  "qty": "all"
                }
              ],
              "tick": {
                "symbol": "CT:1:2:RELIANCE-EQ",
                "ltp": 2474.5,
                "event_ts": "2026-09-28T09:35:07.120+05:30"
              },
              "reason": null,
              "result": null,
              "protection": null,
              "at": "2026-09-28T09:35:07.120+05:30",
              "journey": {
                "entry_id": "evt:01K6D8ZQ4X9V2M3N5P7R8S9T0W:3",
                "at": "2026-09-28T09:35:07.120+05:30",
                "seq": 3,
                "source": "engine",
                "kind": "transition",
                "summary": "active -> sl_hit",
                "actor": null,
                "details": {
                  "from": "active",
                  "to": "sl_hit",
                  "actions": [
                    {
                      "type": "exit",
                      "legs": [
                        0
                      ],
                      "qty": "all"
                    }
                  ],
                  "tick": {
                    "symbol": "CT:1:2:RELIANCE-EQ",
                    "ltp": 2474.5
                  },
                  "reason": null,
                  "explain": null
                }
              }
            }
          }
        ]
      },
      "StringOrList": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StringOrNumber"
            }
          }
        ],
        "description": "A comma-separated string (`\"SBIN,RELIANCE\"`) or a list."
      },
      "StringOrNumber": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "number",
            "format": "double"
          }
        ],
        "description": "A string or a number (both are read the same way)."
      },
      "TradingViewAlert": {
        "type": "object",
        "description": "TradingView alert body, sent to `POST /v1/hooks/tradingview/{secret}`.\nPut it in the alert's \"Message\" box as JSON. The URL secret and the\nbody `secret` must both match. Other fields are ignored. The same alert\narriving twice within 5 s is treated as one.",
        "required": [
          "type",
          "secret"
        ],
        "properties": {
          "type": {
            "$ref": "#/components/schemas/TradingViewSignalType"
          },
          "secret": {
            "type": "string",
            "description": "The body secret (`tvs_...`) shown once when the URL was issued. A\nmissing or wrong one is refused with 403."
          }
        },
        "examples": [
          {
            "type": "entry",
            "secret": "tvs_3kq8v1n0x7c2m5z9"
          }
        ]
      },
      "TradingViewSignalType": {
        "type": "string",
        "description": "TradingView alert type: `entry` places the strategy's legs, `exit`\ncloses what the strategy's entries placed. Case and surrounding spaces\nare ignored (`\"Entry \"` works); any other type is acknowledged and\nignored.",
        "enum": [
          "entry",
          "exit"
        ]
      },
      "TriggerV2Update": {
        "type": "object",
        "description": "A v2 trigger changed (or the engine refused a command for it).",
        "required": [
          "event_id",
          "trigger_id",
          "kind",
          "account",
          "strategy",
          "from",
          "to",
          "transition_seq",
          "actions",
          "tick",
          "reason",
          "result",
          "protection",
          "at",
          "journey"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "description": "This update's id: the same on every redelivery, so de-duplicate on\nit. `{trigger_id}:{transition_seq}` for a change,\n`{trigger_id}:cmd:{command_id}` for a refused command."
          },
          "trigger_id": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/TriggerV2Kind"
          },
          "account": {
            "type": "string",
            "description": "The trigger's account (always the caller's own)."
          },
          "strategy": {
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "type": "string",
            "description": "The state before (same values as `TriggerV2.state`; other values\nmay appear)."
          },
          "to": {
            "type": "string",
            "description": "The state after (equal to `from` for a refused command)."
          },
          "transition_seq": {
            "type": "integer",
            "format": "int64",
            "description": "The trigger's change counter after this update.",
            "minimum": 0
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "What the engine asked the server to do, as it sent it (`type`\n`enter`, `exit`, `move_sl`, `notify`, `flatten`, `pause`, `book`\n(a risk limit's target exiting `pct`% of every position in\n`scope`); other types may appear). Empty for a refused command."
          },
          "tick": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TriggerV2UpdateTick",
                "description": "The tick that caused the change; null for a command, the clock or\na position change."
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why, in words (errors, expiry), when the engine said; `day_ended` /\n`contract_expired` for a trigger the server ended on its own."
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TriggerV2UpdateResult",
                "description": "The refused command; null for a change."
              },
              {
                "type": "null"
              }
            ]
          },
          "protection": {
            "type": [
              "object",
              "null"
            ],
            "description": "The trigger's protection map as it stands with this update (same\nshape as `TriggerV2.protection`); null when it has none.",
            "additionalProperties": {
              "$ref": "#/components/schemas/TriggerV2ProtectionPart"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "at": {
            "type": "string",
            "description": "When it happened; RFC 3339, India time."
          },
          "journey": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TriggerV2JourneyEntry",
                "description": "The journey entry this update adds (see\n`GET /v2/triggers/{trigger_id}/journey`)."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "TriggerV2UpdateResult": {
        "type": "object",
        "description": "The engine's answer to a command, when it refused one.",
        "required": [
          "op",
          "command_id",
          "outcome",
          "reason"
        ],
        "properties": {
          "op": {
            "type": "string",
            "description": "`create`, `modify`, `cancel`, `pause` or `resume`."
          },
          "command_id": {
            "type": "string",
            "description": "The command's id (`command_id` of the `202` that accepted it)."
          },
          "outcome": {
            "type": "string",
            "description": "`rejected`."
          },
          "reason": {
            "type": "string",
            "description": "Why, in words."
          }
        }
      },
      "TriggerV2UpdateTick": {
        "type": "object",
        "description": "The tick that caused the change.",
        "required": [
          "symbol",
          "ltp",
          "event_ts"
        ],
        "properties": {
          "symbol": {
            "type": "string",
            "description": "The leg's instrument (`instrument_token`)."
          },
          "ltp": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Its last traded price, when the tick carried one."
          },
          "event_ts": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the exchange (or, without an exchange time, the tick\nprocessor) stamped the tick; RFC 3339, India time."
          }
        }
      },
      "WebhookAccountAlert": {
        "type": "object",
        "description": "`account_alert`: something about an account that needs the user (see `WebhookAlertKind`).\n\nEvery delivery is an HTTPS `POST` with `Content-Type: application/json` and a body `{id, type, created_at, data}` (all keys snake_case), signed per Standard Webhooks (https://www.standardwebhooks.com):\n- `webhook-id`: the event `id` (same on every retry; de-duplicate on it);\n- `webhook-timestamp`: Unix seconds when this attempt was sent;\n- `webhook-signature`: `v1,<base64 HMAC-SHA256>` over `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of the webhook's `whsec_...` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated; accept the message when any one matches.\n\nAnswer 2xx within 5 s. 408, 429, 5xx, timeouts and network errors are retried after 30 s, 2 min, 10 min, 30 min, 1 h and 2 h (7 attempts); other 4xx answers are not retried. A webhook that keeps failing (50 failures in a row, or failing for 24 h) is turned off and an `account_alert` (`webhook_disabled`) goes to the user's remaining webhooks that subscribe to `account_alert`.",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id, `evt_` + 32 hex characters. Deterministic: the same\nevent always has the same id (it is also the `webhook-id`\nheader), so receivers can de-duplicate on it."
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "account_alert"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (RFC 3339, UTC, milliseconds)."
          },
          "data": {
            "$ref": "#/components/schemas/WebhookAccountAlertData"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_db006f409e35b14728f9b0bd51a7845d",
            "type": "account_alert",
            "created_at": "2026-09-28T04:05:07.120Z",
            "data": {
              "activity_id": "01K6D8ZR0MA1B2C3D4E5F6G7H8",
              "kind": "session_expired",
              "account": "ZX1234",
              "broker": "zerodha",
              "summary": "Zerodha login expired",
              "message": "Log in to Zerodha again to keep trading from this account",
              "outcome": "failed",
              "at": "2026-09-28T04:05:07.120Z"
            }
          }
        ]
      },
      "WebhookAccountAlertData": {
        "type": "object",
        "description": "Something about an account that needs the user.",
        "required": [
          "activity_id",
          "kind",
          "summary",
          "outcome",
          "at"
        ],
        "properties": {
          "activity_id": {
            "type": "string",
            "description": "Id of the activity-log record this alert comes from."
          },
          "kind": {
            "$ref": "#/components/schemas/WebhookAlertKind"
          },
          "account": {
            "type": [
              "string",
              "null"
            ],
            "description": "The account it is about (`null`: the user as a whole)."
          },
          "broker": {
            "type": [
              "string",
              "null"
            ],
            "description": "Broker id of that account."
          },
          "summary": {
            "type": "string",
            "description": "One line in plain English."
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "More detail in plain English, when there is any."
          },
          "outcome": {
            "$ref": "#/components/schemas/ActivityOutcome"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "WebhookAlertKind": {
        "type": "string",
        "description": "Activity kinds sent as `account_alert`: `session_expired` (the broker\nlogin ended; log in again), `relogin_detected` (the account was logged\nin elsewhere), `live_updates_unavailable` / `live_updates_restored`\n(the broker's live order feed dropped / came back),\n`protection_failed` (a stop-loss / target could not be placed or\nkept), `order_rejected`, `account_setup_incomplete` (a field one\nfeature needs is missing) and `webhook_disabled` (one of the user's\nwebhooks was turned off after repeated failures). Partner app webhooks\nalso get kind `account_removed` (the account is no longer linked to the\nuser), which a user's own webhook never gets.",
        "enum": [
          "session_expired",
          "relogin_detected",
          "live_updates_unavailable",
          "live_updates_restored",
          "protection_failed",
          "order_rejected",
          "account_setup_incomplete",
          "webhook_disabled"
        ]
      },
      "WebhookConnectionRevoked": {
        "type": "object",
        "description": "`connection_revoked`: a user's connection to the partner app ended; the app must ask the user to connect again.\n\nSent only to a partner app's webhook (set with `PATCH /v1/partner-apps/{client_id}`), for users connected to the app. Every delivery is an HTTPS `POST` with `Content-Type: application/json` and a body `{id, type, created_at, username, data}` (all keys snake_case; `username` is the user the event is about), signed per Standard Webhooks (https://www.standardwebhooks.com):\n- `webhook-id`: the event `id` (same on every retry; de-duplicate on it);\n- `webhook-timestamp`: Unix seconds when this attempt was sent;\n- `webhook-signature`: `v1,<base64 HMAC-SHA256>` over `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of the app's `whsec_...` webhook secret. While a rotated secret is still honoured, one signature per secret is sent, space separated; accept the message when any one matches.\n\nAnswer 2xx within 5 s. 408, 429, 5xx, timeouts and network errors are retried after 30 s, 2 min, 10 min, 30 min, 1 h and 2 h (7 attempts); other 4xx answers are not retried. An app webhook that keeps failing (50 failures in a row, or failing for 24 h) is turned off (`PartnerApp.webhook.enabled` false, with `disabled_reason`) and the app's owner is told (their activity log, and an `account_alert` `webhook_disabled` to the owner's own webhooks that subscribe to `account_alert`); the owner turns it back on with `webhook_enabled: true`.",
        "required": [
          "id",
          "type",
          "created_at",
          "username",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id, `evt_` + 32 hex characters (also the `webhook-id` header)."
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "connection_revoked"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (RFC 3339, UTC, milliseconds)."
          },
          "username": {
            "type": "string",
            "description": "The user the event is about."
          },
          "data": {
            "$ref": "#/components/schemas/WebhookConnectionRevokedData"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_7fb290a485c105d06f1e8d9ab1352845",
            "type": "connection_revoked",
            "created_at": "2026-09-28T04:05:07.120Z",
            "data": {
              "username": "alice",
              "client_id": "cp_01k6d8zq4x9v2m3n5p7r8s9t0p",
              "reason": "user_revoked"
            },
            "username": "alice"
          }
        ]
      },
      "WebhookConnectionRevokedData": {
        "type": "object",
        "description": "A user's connection to the partner app ended.",
        "required": [
          "username",
          "client_id",
          "reason"
        ],
        "properties": {
          "username": {
            "type": "string"
          },
          "client_id": {
            "type": "string",
            "description": "The app's client id."
          },
          "reason": {
            "$ref": "#/components/schemas/ConnectionRevokedReason"
          }
        },
        "additionalProperties": false
      },
      "WebhookNotification": {
        "type": "object",
        "description": "`notification`: a plain-English notice for the user, the same as `GET /v1/notifications` lists it. Sent only to the webhooks the user chose in their notification preferences (`webhook` channel).\n\nEvery delivery is an HTTPS `POST` with `Content-Type: application/json` and a body `{id, type, created_at, data}` (all keys snake_case), signed per Standard Webhooks (https://www.standardwebhooks.com):\n- `webhook-id`: the event `id` (same on every retry; de-duplicate on it);\n- `webhook-timestamp`: Unix seconds when this attempt was sent;\n- `webhook-signature`: `v1,<base64 HMAC-SHA256>` over `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of the webhook's `whsec_...` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated; accept the message when any one matches.\n\nAnswer 2xx within 5 s. 408, 429, 5xx, timeouts and network errors are retried after 30 s, 2 min, 10 min, 30 min, 1 h and 2 h (7 attempts); other 4xx answers are not retried. A webhook that keeps failing (50 failures in a row, or failing for 24 h) is turned off and an `account_alert` (`webhook_disabled`) goes to the user's remaining webhooks that subscribe to `account_alert`.",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id, `evt_` + 32 hex characters. Deterministic: the same\nnotice always has the same id (it is also the `webhook-id`\nheader), so receivers can de-duplicate on it."
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "notification"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was sent (RFC 3339, UTC, milliseconds)."
          },
          "data": {
            "$ref": "#/components/schemas/Notification"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_fd94f3fb56c9587569d81f286b282dea",
            "type": "notification",
            "created_at": "2026-09-28T04:05:07.120Z",
            "data": {
              "id": "ntf_6c5bee75ff79290eeee8c64a",
              "event": "trigger_fired",
              "severity": "info",
              "title": "Stop-loss hit on RELIANCE",
              "what_happened": "RELIANCE traded at ₹2,474.50.",
              "what_we_did": "We're placing the exit order.",
              "what_you_should_do": null,
              "account": "ZX1234",
              "strategy": null,
              "trigger_id": "01K6D8ZQ4X9V2M3N5P7R8S9T0W",
              "source": {
                "kind": "trigger",
                "name": "Bracket",
                "role": "stop_loss"
              },
              "thread": "trigger:01K6D8ZQ4X9V2M3N5P7R8S9T0W",
              "origin": {
                "kind": "trigger_update",
                "id": "01K6D8ZQ4X9V2M3N5P7R8S9T0W:3"
              },
              "at": "2026-09-28T09:35:07.120+05:30"
            }
          }
        ]
      },
      "WebhookOrderUpdate": {
        "type": "object",
        "description": "`order_update`: any change to an order (state, fills, broker id). `data` is the full order, the same as the stream's `order_update`.\n\nEvery delivery is an HTTPS `POST` with `Content-Type: application/json` and a body `{id, type, created_at, data}` (all keys snake_case), signed per Standard Webhooks (https://www.standardwebhooks.com):\n- `webhook-id`: the event `id` (same on every retry; de-duplicate on it);\n- `webhook-timestamp`: Unix seconds when this attempt was sent;\n- `webhook-signature`: `v1,<base64 HMAC-SHA256>` over `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of the webhook's `whsec_...` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated; accept the message when any one matches.\n\nAnswer 2xx within 5 s. 408, 429, 5xx, timeouts and network errors are retried after 30 s, 2 min, 10 min, 30 min, 1 h and 2 h (7 attempts); other 4xx answers are not retried. A webhook that keeps failing (50 failures in a row, or failing for 24 h) is turned off and an `account_alert` (`webhook_disabled`) goes to the user's remaining webhooks that subscribe to `account_alert`.",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id, `evt_` + 32 hex characters. Deterministic: the same\nevent always has the same id (it is also the `webhook-id`\nheader), so receivers can de-duplicate on it."
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "order_update"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (RFC 3339, UTC, milliseconds)."
          },
          "data": {
            "$ref": "#/components/schemas/OrderData"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_b9af59b3434f9997a6fc3ece875ca056",
            "type": "order_update",
            "created_at": "2026-09-28T04:05:07.120Z",
            "data": {
              "cirrus_tag": "01K6D8ZQ4X9V2M3N5P7R8S9T0W",
              "broker_tag": "01K6D8ZQ4X9V2M3N",
              "order_id": "250928000123456",
              "parent_tag": null,
              "username": "alice",
              "account": "ZX1234",
              "broker": "zerodha",
              "cirrus_token": "CT:1:2:RELIANCE-EQ",
              "tradingsymbol": "RELIANCE-EQ",
              "side": "BUY",
              "order_type": "LIMIT",
              "product": "MIS",
              "quantity": 10,
              "price": 2500,
              "trigger_price": null,
              "state": "PARTIALLY_FILLED",
              "filled_qty": 4,
              "average_price": 2499.8,
              "status_message": null,
              "broker_updated_at": "2026-09-28T04:05:07.120Z",
              "created_at": "2026-09-28T04:05:06.789Z",
              "status_history": [
                {
                  "from": "SUBMITTED",
                  "to": "OPEN",
                  "at": "2026-09-28T04:05:06.789Z",
                  "message": null
                },
                {
                  "from": "OPEN",
                  "to": "PARTIALLY_FILLED",
                  "at": "2026-09-28T04:05:07.120Z",
                  "message": null
                }
              ],
              "lot_size": 1,
              "exchange": "NSE",
              "instrument_type": "EQ",
              "symbol": "RELIANCE-EQ",
              "expiry": "",
              "strike": 0,
              "option_type": "",
              "ltp": 2501.5,
              "prev_close": 2490,
              "instrument_token": "CT:1:2:RELIANCE-EQ",
              "order_tag": "01K6D8ZQ4X9V2M3N5P7R8S9T0W"
            }
          }
        ]
      },
      "WebhookPing": {
        "type": "object",
        "description": "`ping`: a test delivery, sent only when the user asks for one (a new id every time).\n\nEvery delivery is an HTTPS `POST` with `Content-Type: application/json` and a body `{id, type, created_at, data}` (all keys snake_case), signed per Standard Webhooks (https://www.standardwebhooks.com):\n- `webhook-id`: the event `id` (same on every retry; de-duplicate on it);\n- `webhook-timestamp`: Unix seconds when this attempt was sent;\n- `webhook-signature`: `v1,<base64 HMAC-SHA256>` over `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of the webhook's `whsec_...` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated; accept the message when any one matches.\n\nAnswer 2xx within 5 s. 408, 429, 5xx, timeouts and network errors are retried after 30 s, 2 min, 10 min, 30 min, 1 h and 2 h (7 attempts); other 4xx answers are not retried. A webhook that keeps failing (50 failures in a row, or failing for 24 h) is turned off and an `account_alert` (`webhook_disabled`) goes to the user's remaining webhooks that subscribe to `account_alert`.",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id, `evt_` + 32 hex characters. Deterministic: the same\nevent always has the same id (it is also the `webhook-id`\nheader), so receivers can de-duplicate on it."
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "ping"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (RFC 3339, UTC, milliseconds)."
          },
          "data": {
            "$ref": "#/components/schemas/WebhookPingData"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_789c8513c48f23ed0d0012dde1f53850",
            "type": "ping",
            "created_at": "2026-09-28T04:05:07.120Z",
            "data": {
              "webhook_id": "pb_01k6d8zq4x9v2m3n5p7r8s9t0w",
              "message": "Test event: your endpoint is reachable."
            }
          }
        ]
      },
      "WebhookPingData": {
        "type": "object",
        "description": "The test delivery's content.",
        "required": [
          "webhook_id",
          "message"
        ],
        "properties": {
          "webhook_id": {
            "type": "string",
            "description": "The webhook being tested."
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "WebhookPositions": {
        "type": "object",
        "description": "`positions`: an account's positions changed (full list; at most one per second per account).\n\nEvery delivery is an HTTPS `POST` with `Content-Type: application/json` and a body `{id, type, created_at, data}` (all keys snake_case), signed per Standard Webhooks (https://www.standardwebhooks.com):\n- `webhook-id`: the event `id` (same on every retry; de-duplicate on it);\n- `webhook-timestamp`: Unix seconds when this attempt was sent;\n- `webhook-signature`: `v1,<base64 HMAC-SHA256>` over `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of the webhook's `whsec_...` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated; accept the message when any one matches.\n\nAnswer 2xx within 5 s. 408, 429, 5xx, timeouts and network errors are retried after 30 s, 2 min, 10 min, 30 min, 1 h and 2 h (7 attempts); other 4xx answers are not retried. A webhook that keeps failing (50 failures in a row, or failing for 24 h) is turned off and an `account_alert` (`webhook_disabled`) goes to the user's remaining webhooks that subscribe to `account_alert`.",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id, `evt_` + 32 hex characters. Deterministic: the same\nevent always has the same id (it is also the `webhook-id`\nheader), so receivers can de-duplicate on it."
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "positions"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (RFC 3339, UTC, milliseconds)."
          },
          "data": {
            "$ref": "#/components/schemas/WebhookPositionsData"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_014d471054c08189e7d7d67e7673474a",
            "type": "positions",
            "created_at": "2026-09-28T04:05:07.120Z",
            "data": {
              "account": "ZX1234",
              "positions": [
                {
                  "account": "ZX1234",
                  "cirrus_token": "CT:1:2:RELIANCE-EQ",
                  "tradingsymbol": "RELIANCE-EQ",
                  "product": "MIS",
                  "net_qty": 4,
                  "buy_qty": 4,
                  "sell_qty": 0,
                  "buy_value": 9999.2,
                  "sell_value": 0,
                  "average_price": 2499.8,
                  "buy_average_price": 2499.8,
                  "sell_average_price": 0,
                  "pnl": 6.8,
                  "lot_size": 1,
                  "exchange": "NSE",
                  "instrument_type": "EQ",
                  "symbol": "RELIANCE-EQ",
                  "expiry": "",
                  "strike": 0,
                  "option_type": "",
                  "ltp": 2501.5,
                  "prev_close": 2490,
                  "instrument_token": "CT:1:2:RELIANCE-EQ"
                }
              ]
            }
          }
        ]
      },
      "WebhookPositionsData": {
        "type": "object",
        "description": "An account's full positions after a change.",
        "required": [
          "account",
          "positions"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "positions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PositionRow"
            }
          }
        },
        "additionalProperties": false
      },
      "WebhookTrade": {
        "type": "object",
        "description": "`trade`: one fill of an order.\n\nEvery delivery is an HTTPS `POST` with `Content-Type: application/json` and a body `{id, type, created_at, data}` (all keys snake_case), signed per Standard Webhooks (https://www.standardwebhooks.com):\n- `webhook-id`: the event `id` (same on every retry; de-duplicate on it);\n- `webhook-timestamp`: Unix seconds when this attempt was sent;\n- `webhook-signature`: `v1,<base64 HMAC-SHA256>` over `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of the webhook's `whsec_...` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated; accept the message when any one matches.\n\nAnswer 2xx within 5 s. 408, 429, 5xx, timeouts and network errors are retried after 30 s, 2 min, 10 min, 30 min, 1 h and 2 h (7 attempts); other 4xx answers are not retried. A webhook that keeps failing (50 failures in a row, or failing for 24 h) is turned off and an `account_alert` (`webhook_disabled`) goes to the user's remaining webhooks that subscribe to `account_alert`.",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id, `evt_` + 32 hex characters. Deterministic: the same\nevent always has the same id (it is also the `webhook-id`\nheader), so receivers can de-duplicate on it."
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "trade"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (RFC 3339, UTC, milliseconds)."
          },
          "data": {
            "$ref": "#/components/schemas/WebhookTradeData"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_ae7b238d8eb79444044e61522187f090",
            "type": "trade",
            "created_at": "2026-09-28T04:05:07.120Z",
            "data": {
              "account": "ZX1234",
              "broker": "zerodha",
              "order_id": "250928000123456",
              "order_tag": "01K6D8ZQ4X9V2M3N5P7R8S9T0W",
              "instrument_token": "CT:1:2:RELIANCE-EQ",
              "tradingsymbol": "RELIANCE-EQ",
              "side": "BUY",
              "product": "MIS",
              "order_type": "LIMIT",
              "quantity": 4,
              "price": 2499.8,
              "filled_qty": 4,
              "order_quantity": 10,
              "average_price": 2499.8,
              "order_state": "PARTIALLY_FILLED",
              "filled_at": "2026-09-28T04:05:07.120Z",
              "cirrus_token": "CT:1:2:RELIANCE-EQ",
              "cirrus_tag": "01K6D8ZQ4X9V2M3N5P7R8S9T0W"
            }
          }
        ]
      },
      "WebhookTradeData": {
        "type": "object",
        "description": "A fill: the quantity an order filled since its previous update, with\nthe order's cumulative state after it.",
        "required": [
          "account",
          "broker",
          "order_tag",
          "instrument_token",
          "tradingsymbol",
          "side",
          "product",
          "order_type",
          "quantity",
          "filled_qty",
          "order_quantity",
          "order_state",
          "filled_at"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "broker": {
            "type": "string",
            "description": "Broker id."
          },
          "order_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Broker order id."
          },
          "order_tag": {
            "type": "string"
          },
          "instrument_token": {
            "type": "string"
          },
          "tradingsymbol": {
            "type": "string"
          },
          "side": {
            "$ref": "#/components/schemas/Side"
          },
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "order_type": {
            "$ref": "#/components/schemas/OrderType"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "Quantity of this fill.",
            "minimum": 0
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Price of this fill (from the change in the order's average price);\n`null` when the average is unknown."
          },
          "filled_qty": {
            "type": "integer",
            "format": "int64",
            "description": "The order's total filled quantity after this fill.",
            "minimum": 0
          },
          "order_quantity": {
            "type": "integer",
            "format": "int64",
            "description": "The order's total quantity.",
            "minimum": 0
          },
          "average_price": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "The order's average fill price after this fill."
          },
          "order_state": {
            "$ref": "#/components/schemas/OrderState"
          },
          "filled_at": {
            "type": "string",
            "format": "date-time"
          },
          "cirrus_token": {
            "type": "string",
            "deprecated": true
          },
          "cirrus_tag": {
            "type": "string",
            "deprecated": true
          }
        },
        "additionalProperties": false,
        "x-deprecated-aliases": {
          "cirrus_token": "instrument_token",
          "cirrus_tag": "order_tag"
        }
      },
      "WebhookTriggerUpdate": {
        "type": "object",
        "description": "`trigger_update`: a v2 trigger of the user changed, or the engine refused a command for it. Sent only to webhooks that opted in (`trigger_updates: true`); `data` is the same as the stream's `trigger_update`.\n\nEvery delivery is an HTTPS `POST` with `Content-Type: application/json` and a body `{id, type, created_at, data}` (all keys snake_case), signed per Standard Webhooks (https://www.standardwebhooks.com):\n- `webhook-id`: the event `id` (same on every retry; de-duplicate on it);\n- `webhook-timestamp`: Unix seconds when this attempt was sent;\n- `webhook-signature`: `v1,<base64 HMAC-SHA256>` over `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the base64-decoded part of the webhook's `whsec_...` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated; accept the message when any one matches.\n\nAnswer 2xx within 5 s. 408, 429, 5xx, timeouts and network errors are retried after 30 s, 2 min, 10 min, 30 min, 1 h and 2 h (7 attempts); other 4xx answers are not retried. A webhook that keeps failing (50 failures in a row, or failing for 24 h) is turned off and an `account_alert` (`webhook_disabled`) goes to the user's remaining webhooks that subscribe to `account_alert`.",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id, `evt_` + 32 hex characters. Deterministic: the same\nupdate always has the same id (it is also the `webhook-id`\nheader), so receivers can de-duplicate on it."
          },
          "type": {
            "type": "string",
            "description": "The message type.",
            "enum": [
              "trigger_update"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (RFC 3339, UTC, milliseconds)."
          },
          "data": {
            "$ref": "#/components/schemas/TriggerV2Update"
          }
        },
        "additionalProperties": false,
        "examples": [
          {
            "id": "evt_b47744999b9c89b900c37651373d0985",
            "type": "trigger_update",
            "created_at": "2026-09-28T04:05:07.120Z",
            "data": {
              "event_id": "01K6D8ZQ4X9V2M3N5P7R8S9T0W:3",
              "trigger_id": "01K6D8ZQ4X9V2M3N5P7R8S9T0W",
              "kind": "bracket",
              "account": "ZX1234",
              "strategy": null,
              "from": "active",
              "to": "sl_hit",
              "transition_seq": 3,
              "actions": [
                {
                  "type": "exit",
                  "legs": [
                    0
                  ],
                  "qty": "all"
                }
              ],
              "tick": {
                "symbol": "CT:1:2:RELIANCE-EQ",
                "ltp": 2474.5,
                "event_ts": "2026-09-28T09:35:07.120+05:30"
              },
              "reason": null,
              "result": null,
              "protection": null,
              "at": "2026-09-28T09:35:07.120+05:30",
              "journey": {
                "entry_id": "evt:01K6D8ZQ4X9V2M3N5P7R8S9T0W:3",
                "at": "2026-09-28T09:35:07.120+05:30",
                "seq": 3,
                "source": "engine",
                "kind": "transition",
                "summary": "active -> sl_hit",
                "actor": null,
                "details": {
                  "from": "active",
                  "to": "sl_hit",
                  "actions": [
                    {
                      "type": "exit",
                      "legs": [
                        0
                      ],
                      "qty": "all"
                    }
                  ],
                  "tick": {
                    "symbol": "CT:1:2:RELIANCE-EQ",
                    "ltp": 2474.5
                  },
                  "reason": null,
                  "explain": null
                }
              }
            }
          }
        ]
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "The user's API key, created in the app: `Authorization: token <key_id>:<key_secret>`. Carries the scopes chosen at creation (`read`, `orders`, `triggers`, and the opt-in `webhooks`, `notifications`, `watchlists`)."
      },
      "partner_oauth": {
        "type": "oauth2",
        "description": "OAuth 2.0 for partner apps acting for a user: the authorization code flow with PKCE (`S256`). The user approves the app on the app's consent page; the partner then exchanges the code at the token URL and sends `Authorization: Bearer <access_token>`.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://web.cirrus.trade/oauth/authorize",
            "tokenUrl": "https://api.cirrus.trade/v1/oauth/token",
            "refreshUrl": "https://api.cirrus.trade/v1/oauth/token",
            "scopes": {
              "read": "Read portfolio, orders, triggers, GTT, accounts, instruments, the activity log and the stream.",
              "orders": "Place, modify, cancel and convert orders, bracket / cover orders and GTT.",
              "triggers": "Create, change and remove stop-loss / target triggers.",
              "strategies": "Create, change and delete automated strategies and their paper deployments (only where the tenant enables agent access).",
              "strategies_live": "Run strategies live, with `strategies` (only where the tenant enables agent access)."
            }
          }
        }
      },
      "app_session": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "The signed-in app session. Routes tagged `app_session_only` accept nothing else."
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "`unauthorized`: no credential, or it is invalid, expired or revoked.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Forbidden": {
        "description": "`forbidden`: the credential lacks the route's scope, the route is for app sessions only, or the caller's IP is not allowed.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "RateLimited": {
        "description": "`rate_limited`: too many requests for this credential; retry after `Retry-After` seconds (`error.retry_after_ms` has the exact wait).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "description": "Seconds until a retry may succeed (rounded up, at least 1).",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "order_update": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "webhook_order_update",
        "summary": "An order changed",
        "description": "Sent to each HTTPS receiver the user registered for this event (see `/v1/postbacks`). Answer any 2xx within 5 s; anything else, or no answer, is retried after 30 s, 2 min, 10 min, 30 min, 1 h, 2 h (then the delivery is dropped, and a receiver that keeps failing is turned off). Deliveries can repeat and arrive out of order: de-duplicate on `webhook-id` (also the body's `id`) and order by `created_at`.\n\nSigned per the Standard Webhooks spec: `webhook-signature` is `v1,<base64(HMAC-SHA256(key, \"{webhook-id}.{webhook-timestamp}.{body}\"))>`, where `key` is the base64-decoded part of the receiver's `whsec_` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated: accept the delivery when any one matches. Reject timestamps far from your clock to stop replays.",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "Event id (same as the body's `id`); the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64>` signatures (see above).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookOrderUpdate"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer is retried."
          }
        }
      }
    },
    "trade": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "webhook_trade",
        "summary": "An order filled (fully or partly)",
        "description": "Sent to each HTTPS receiver the user registered for this event (see `/v1/postbacks`). Answer any 2xx within 5 s; anything else, or no answer, is retried after 30 s, 2 min, 10 min, 30 min, 1 h, 2 h (then the delivery is dropped, and a receiver that keeps failing is turned off). Deliveries can repeat and arrive out of order: de-duplicate on `webhook-id` (also the body's `id`) and order by `created_at`.\n\nSigned per the Standard Webhooks spec: `webhook-signature` is `v1,<base64(HMAC-SHA256(key, \"{webhook-id}.{webhook-timestamp}.{body}\"))>`, where `key` is the base64-decoded part of the receiver's `whsec_` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated: accept the delivery when any one matches. Reject timestamps far from your clock to stop replays.",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "Event id (same as the body's `id`); the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64>` signatures (see above).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookTrade"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer is retried."
          }
        }
      }
    },
    "account_alert": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "webhook_account_alert",
        "summary": "Something about an account needs the user",
        "description": "Sent to each HTTPS receiver the user registered for this event (see `/v1/postbacks`). Answer any 2xx within 5 s; anything else, or no answer, is retried after 30 s, 2 min, 10 min, 30 min, 1 h, 2 h (then the delivery is dropped, and a receiver that keeps failing is turned off). Deliveries can repeat and arrive out of order: de-duplicate on `webhook-id` (also the body's `id`) and order by `created_at`.\n\nSigned per the Standard Webhooks spec: `webhook-signature` is `v1,<base64(HMAC-SHA256(key, \"{webhook-id}.{webhook-timestamp}.{body}\"))>`, where `key` is the base64-decoded part of the receiver's `whsec_` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated: accept the delivery when any one matches. Reject timestamps far from your clock to stop replays.",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "Event id (same as the body's `id`); the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64>` signatures (see above).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookAccountAlert"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer is retried."
          }
        }
      }
    },
    "positions": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "webhook_positions",
        "summary": "An account's positions changed",
        "description": "Sent to each HTTPS receiver the user registered for this event (see `/v1/postbacks`). Answer any 2xx within 5 s; anything else, or no answer, is retried after 30 s, 2 min, 10 min, 30 min, 1 h, 2 h (then the delivery is dropped, and a receiver that keeps failing is turned off). Deliveries can repeat and arrive out of order: de-duplicate on `webhook-id` (also the body's `id`) and order by `created_at`.\n\nSigned per the Standard Webhooks spec: `webhook-signature` is `v1,<base64(HMAC-SHA256(key, \"{webhook-id}.{webhook-timestamp}.{body}\"))>`, where `key` is the base64-decoded part of the receiver's `whsec_` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated: accept the delivery when any one matches. Reject timestamps far from your clock to stop replays.",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "Event id (same as the body's `id`); the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64>` signatures (see above).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPositions"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer is retried."
          }
        }
      }
    },
    "ping": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "webhook_ping",
        "summary": "Test delivery",
        "description": "Sent to each HTTPS receiver the user registered for this event (see `/v1/postbacks`). Answer any 2xx within 5 s; anything else, or no answer, is retried after 30 s, 2 min, 10 min, 30 min, 1 h, 2 h (then the delivery is dropped, and a receiver that keeps failing is turned off). Deliveries can repeat and arrive out of order: de-duplicate on `webhook-id` (also the body's `id`) and order by `created_at`.\n\nSigned per the Standard Webhooks spec: `webhook-signature` is `v1,<base64(HMAC-SHA256(key, \"{webhook-id}.{webhook-timestamp}.{body}\"))>`, where `key` is the base64-decoded part of the receiver's `whsec_` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated: accept the delivery when any one matches. Reject timestamps far from your clock to stop replays.",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "Event id (same as the body's `id`); the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64>` signatures (see above).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPing"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer is retried."
          }
        }
      }
    },
    "trigger_update": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "webhook_trigger_update",
        "summary": "A v2 trigger changed (webhooks that opted in only)",
        "description": "Sent to each HTTPS receiver the user registered for this event (see `/v1/postbacks`). Answer any 2xx within 5 s; anything else, or no answer, is retried after 30 s, 2 min, 10 min, 30 min, 1 h, 2 h (then the delivery is dropped, and a receiver that keeps failing is turned off). Deliveries can repeat and arrive out of order: de-duplicate on `webhook-id` (also the body's `id`) and order by `created_at`.\n\nSigned per the Standard Webhooks spec: `webhook-signature` is `v1,<base64(HMAC-SHA256(key, \"{webhook-id}.{webhook-timestamp}.{body}\"))>`, where `key` is the base64-decoded part of the receiver's `whsec_` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated: accept the delivery when any one matches. Reject timestamps far from your clock to stop replays.",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "Event id (same as the body's `id`); the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64>` signatures (see above).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookTriggerUpdate"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer is retried."
          }
        }
      }
    },
    "connection_revoked": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "webhook_connection_revoked",
        "summary": "A user's connection to your partner app ended (partner app webhooks only)",
        "description": "Sent only to a partner app's webhook (set with `PATCH /v1/partner-apps/{client_id}`), for users connected to the app. Answer any 2xx within 5 s; anything else, or no answer, is retried after 30 s, 2 min, 10 min, 30 min, 1 h, 2 h (then the delivery is dropped, and an app webhook that keeps failing is turned off and its owner told). Deliveries can repeat and arrive out of order: de-duplicate on `webhook-id` (also the body's `id`) and order by `created_at`.\n\nSigned per the Standard Webhooks spec: `webhook-signature` is `v1,<base64(HMAC-SHA256(key, \"{webhook-id}.{webhook-timestamp}.{body}\"))>`, where `key` is the base64-decoded part of the app's `whsec_` webhook secret. While a rotated secret is still honoured, one signature per secret is sent, space separated: accept the delivery when any one matches. Reject timestamps far from your clock to stop replays. Every body a partner app gets is described by `PartnerWebhookBody`.",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "Event id (same as the body's `id`); the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64>` signatures (see above).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookConnectionRevoked"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer is retried."
          }
        }
      }
    },
    "notification": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "webhook_notification",
        "summary": "A notification (webhooks chosen in notification preferences only)",
        "description": "Sent to each HTTPS receiver the user registered for this event (see `/v1/postbacks`). Answer any 2xx within 5 s; anything else, or no answer, is retried after 30 s, 2 min, 10 min, 30 min, 1 h, 2 h (then the delivery is dropped, and a receiver that keeps failing is turned off). Deliveries can repeat and arrive out of order: de-duplicate on `webhook-id` (also the body's `id`) and order by `created_at`.\n\nSigned per the Standard Webhooks spec: `webhook-signature` is `v1,<base64(HMAC-SHA256(key, \"{webhook-id}.{webhook-timestamp}.{body}\"))>`, where `key` is the base64-decoded part of the receiver's `whsec_` secret. While a rotated secret is still honoured, one signature per secret is sent, space separated: accept the delivery when any one matches. Reject timestamps far from your clock to stop replays.",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "Event id (same as the body's `id`); the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when this attempt was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "Space-separated `v1,<base64>` signatures (see above).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookNotification"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer is retried."
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.cirrus.trade",
      "description": "Cirrus API"
    }
  ]
}
