# Order Convert To delivery

This API converts an intraday (I) position to a delivery (C) position for a specific security on the exchange. The backend processes the request by validating the provided credentials and order details, updating the order's status and type in the trading system, and then confirming the successful conversion.

\
**Endpoint**

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

```
https://connects.torusdigital.com/api/v1/order/convert/delivery
```

{% endcode %}

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

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

#### **Request Parameter**

<table><thead><tr><th width="167">Parameter</th><th width="103">Value</th><th>Mandatory</th><th>Remarks</th></tr></thead><tbody><tr><td>exchange</td><td>NSE</td><td>Y</td><td>The exchange where the transaction takes place, it can be NSE/BSE.</td></tr><tr><td>segment</td><td>E</td><td>Y</td><td>The market segment, where "E" might stand for "Equity".</td></tr><tr><td>security_id</td><td>14366</td><td>Y</td><td>The unique identifier for the security being traded.</td></tr><tr><td>quantity</td><td>2</td><td>Y</td><td>Non-zero integer value</td></tr><tr><td>txn_type</td><td>B</td><td>Y</td><td>B for buy position, S for sell position</td></tr><tr><td>mkt_type</td><td>N</td><td>Y</td><td>Default value is NL</td></tr><tr><td>product_from</td><td>I</td><td>Y</td><td>Original product while placing order.</td></tr><tr><td>product_to</td><td>C</td><td>Y</td><td>Change to new product.</td></tr><tr><td>user_type</td><td>C/D</td><td>Y</td><td>C – Client, D - Dealer</td></tr></tbody></table>

#### **Request**

{% tabs %}
{% tab title="curl" %}
{% code title="cURL" overflow="wrap" lineNumbers="true" %}

```javascript
curl --location 'https://connects.torusdigital.com/api/v1/order/convert/delivery' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
    "source": "N",
    "data": {
        "exchange": "NSE",
        "segment": "E",
        "security_id": "14366",
        "quantity": 1,
        "mkt_type": "NL",
        "product_from": "I",
        "product_to": "C",
        "user_type": "C",
        "txn_type": "B"
    }
}'
```

{% endcode %}
{% 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/convert/delivery")
  .header("Authorization", "Bearer {{token}}")
  .header("Content-Type", "application/json")
  .body("{\n" +
        "    \"source\": \"N\",\n" +
        "    \"data\": {\n" +
        "        \"exchange\": \"NSE\",\n" +
        "        \"segment\": \"E\",\n" +
        "        \"security_id\": \"14366\",\n" +
        "        \"quantity\": 1,\n" +
        "        \"mkt_type\": \"NL\",\n" +
        "        \"product_from\": \"I\",\n" +
        "        \"product_to\": \"C\",\n" +
        "        \"user_type\": \"C\",\n" +
        "        \"txn_type\": \"B\"\n" +
        "    }\n" +
        "}")
  .asString();
```

{% endcode %}
{% endtab %}

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

```go
package main

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

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

	payload := strings.NewReader(`{
		"source": "N",
		"data": {
			"exchange": "NSE",
			"segment": "E",
			"security_id": "14366",
			"quantity": 1,
			"mkt_type": "NL",
			"product_from": "I",
			"product_to": "C",
			"user_type": "C",
			"txn_type": "B"
		}
	}`)

	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" lineNumbers="true" %}

```javascript
var settings = {
  "url": "https://connects.torusdigital.com/api/v1/order/convert/delivery",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {{token}}",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "source": "N",
    "data": {
      "exchange": "NSE",
      "segment": "E",
      "security_id": "14366",
      "quantity": 1,
      "mkt_type": "NL",
      "product_from": "I",
      "product_to": "C",
      "user_type": "C",
      "txn_type": "B"
    }
  }),
};

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

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

**Response**

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

```json
{
    "status": "success",
    "message": "Position converted successfully.",
    "data": []
}
```

{% endtab %}
{% endtabs %}

**Response**

| Parameter | Description                                    |
| --------- | ---------------------------------------------- |
| Status    | “success”                                      |
| Message   | “Some Message”                                 |
| Data      | An object containing the details of the order. |
| order\_no | Order specific identification number.          |
