# Order Entry

Allows clients to place new orders in the trading system. Requires comprehensive details such as client identification, order specifications (product, quantity, price, type), exchange and market parameters, and validity period.

#### Endpoint

{% code title="Base URL" overflow="wrap" fullWidth="false" %}

```
https://connects.torusdigital.com/api/v1/order/entry
```

{% endcode %}

#### Header Parameters <a href="#header-parameters" id="header-parameters"></a>

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

| Field          | Value  | Description                                                                                  |
| -------------- | ------ | -------------------------------------------------------------------------------------------- |
| source         | M      | The source of the transaction.                                                               |
| txn\_type      | B      | The type of transaction, where "B" typically stands for Buy and "S" stands for SELL.         |
| exchange       | NSE    | The exchange where the transaction on takes place, it can be NSE/BSE.                        |
| segment        | E      | The market segment, where "E" might stand for "Equity".                                      |
| product        | I      | The product type.                                                                            |
| security\_id   | 14366  | The unique identifier for the security being traded.                                         |
| quantity       | 1      | The number of units to be traded.                                                            |
| price          | 0.00   | The price at which the transaction is to be executed. "0.00" indicates a market order.       |
| validity       | DAY    | The validity of the order, indicating it is valid for the day.                               |
| order\_type    | MKT    | The type of order, where "MKT" stands for a market order.                                    |
| disc\_quantity | 0      | The disclosed quantity of the order.                                                         |
| trigger\_price | 0.00   | The price at which a stop order is triggered. "0.00" indicates no stop price.                |
| off\_mkt\_flag | false  | Indicates whether the order is off-market.                                                   |
| remarks        | 502929 | Additional remarks or reference number for the transaction.                                  |
| mkt\_type      | NL     | Default value is NL                                                                          |
| settlor        | X      | The settlor's identifier, possibly indicating the person or entity settling the transaction. |
| group\_id      | 1      | The group identifier for the transaction.                                                    |

#### **Request**

{% tabs %}
{% tab title="curl" %}

<pre class="language-javascript" data-title="cURL" data-overflow="wrap"><code class="lang-javascript"><strong>curl --location 'https://connects.torusdigital.com/api/v1/order/entry' \
</strong>--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
  "source": "M",
  "data": {
    "txn_type": "B",
    "exchange": "NSE",
    "segment": "E",
    "product": "I",
    "security_id": "14366",
    "quantity": "1",
    "price": "0.00",
    "validity": "DAY",
    "order_type": "MKT",
    "disc_quantity": "0",
    "trigger_price": "0.00",
    "off_mkt_flag": "false",
    "remarks": "502929",
    "mkt_type": "NL",
    "settlor": "X",
    "group_id": "1"
  }
}'
</code></pre>

{% endtab %}

{% tab title="Java" %}
{% code title="Java-Unirest" fullWidth="false" %}

```java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://connects.torusdigital.com/api/v1/order/entry")
  .header("Authorization", "Bearer {{token}}")
  .header("Content-Type", "application/json")
  .body("{\n" +
        "  \"source\": \"M\",\n" +
        "  \"data\": {\n" +
        "    \"txn_type\": \"B\",\n" +
        "    \"exchange\": \"NSE\",\n" +
        "    \"segment\": \"E\",\n" +
        "    \"product\": \"I\",\n" +
        "    \"security_id\": \"14366\",\n" +
        "    \"quantity\": \"1\",\n" +
        "    \"price\": \"0.00\",\n" +
        "    \"validity\": \"DAY\",\n" +
        "    \"order_type\": \"MKT\",\n" +
        "    \"disc_quantity\": \"0\",\n" +
        "    \"trigger_price\": \"0.00\",\n" +
        "    \"off_mkt_flag\": \"false\",\n" +
        "    \"remarks\": \"502929\",\n" +
        "    \"mkt_type\": \"NL\",\n" +
        "    \"settlor\": \"X\",\n" +
        "    \"group_id\": \"1\"\n" +
        "  }\n" +
        "}")
  .asString();
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code title="Go-Native" overflow="wrap" fullWidth="true" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://connects.torusdigital.com/api/v1/order/entry"
  method := "POST"

  payload := strings.NewReader(`{
    "source": "M",
    "data": {
      "txn_type": "B",
      "exchange": "NSE",
      "segment": "E",
      "product": "I",
      "security_id": "14366",
      "quantity": "1",
      "price": "0.00",
      "validity": "DAY",
      "order_type": "MKT",
      "disc_quantity": "0",
      "trigger_price": "0.00",
      "off_mkt_flag": "false",
      "remarks": "502929",
      "mkt_type": "NL",
      "settlor": "X",
      "group_id": "1"
    }
  }`)

  client := &http.Client{}
  req, err := http.NewRequest(method, url, payload)
  if err != nil {
    fmt.Println(err)
    return
  }

  req.Header.Add("Authorization", "Bearer {{token}}")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  
  fmt.Println(string(body))
}
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code title="JavaScript-jQuery" overflow="wrap" %}

```javascript
var settings = {
  "url": "https://connects.torusdigital.com/api/v1/order/entry",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {{token}}",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "source": "M",
    "data": {
      "txn_type": "B",
      "exchange": "NSE",
      "segment": "E",
      "product": "I",
      "security_id": "14366",
      "quantity": "1",
      "price": "0.00",
      "validity": "DAY",
      "order_type": "MKT",
      "disc_quantity": "0",
      "trigger_price": "0.00",
      "off_mkt_flag": "false",
      "remarks": "502929",
      "mkt_type": "NL",
      "settlor": "X",
      "group_id": "1"
    }
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "status": "success",
    "message": "Order submitted successfully. Your Order Ref No. 1122031117658",
    "data": [
        {
            "order_no": "1122031117658"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th width="162">Name</th><th>Description</th></tr></thead><tbody><tr><td>status</td><td>The status of the response.</td></tr><tr><td>message</td><td>The message associated with the response.</td></tr><tr><td>data</td><td>An object containing the details of the order.</td></tr><tr><td>order_no</td><td>Order specific identification number</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://heytorus.gitbook.io/torus-digital-open-api/orders/order-entry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
