# Delete Line Item

To delete an existing line item, submit a DELETE request with the corresponding line item ID.

## Delete line item

<mark style="color:red;">`DELETE`</mark> `https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>`

This method can be used to delete one line item at a time.

#### Path Parameters

| Name           | Type   | Description                                                    |
| -------------- | ------ | -------------------------------------------------------------- |
| line\_item\_id | string | <p>The ID of the line item that needs to be<br>deleted</p>     |
| photon\_key    | string | <p>Photon Key of the JSON file that needs to<br>be updated</p> |

#### Headers

| Name          | Type   | Description                                                                                              |
| ------------- | ------ | -------------------------------------------------------------------------------------------------------- |
| CLIENT-ID     | string | <p>Unique client-id provided upon user<br>registration</p>                                               |
| AUTHORIZATION | string | <p>Pass your username and password in the <br>form 'apikey &#x3C;your-username>:&#x3C;your-api-key>'</p> |
| SECRET-KEY    | string | Secret key as a string                                                                                   |
| PASSWORD      | string | Password used during user registration                                                                   |
| Content-Type  | string | Set to "application/json"                                                                                |

{% tabs %}
{% tab title="200 " %}
```
{"message":"Deleted line item successfully","status":"success"}
```
{% endtab %}
{% endtabs %}

Syntax for sending a POST request to delete an existing line item:

{% tabs %}
{% tab title="cURL" %}
```
curl -X DELETE -H 'Content-Type: application/json' -H "CLIENT-ID:<client-id>" -H "AUTHORIZATION:apikey <username>:<api-key>" -H 'PASSWORD:<password>' -H "SECRET-KEY:<secret-key>" "https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>?api_key=<your-api-key>&photon_key=<mention-the-photon-key-here>
```
{% endtab %}

{% tab title="Python" %}
```
import requests

headers = {
    'Content-Type': 'application/json',
    'CLIENT-ID': '<client-id>',
    'AUTHORIZATION': 'apikey <username>:<api-key>',
    'PASSWORD': '<password>',
    'SECRET-KEY': '<secret-key>',
}

params = (
    ('photon_key', '<mention-the-photon-key-here>'),
)

response = requests.delete('https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>', headers=headers, params=params)
```
{% endtab %}

{% tab title="NodeJS" %}
```
var request = require('request');

var headers = {
    'Content-Type': 'application/json',
    'CLIENT-ID': '<client-id>',
    'AUTHORIZATION': 'apikey <username>:<api-key>',
    'PASSWORD': '<password>',
    'SECRET-KEY': '<secret-key>'
};

var options = {
    url: 'https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>?photon_key=<mention-the-photon-key-here>',
    method: 'DELETE',
    headers: headers
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
```
{% endtab %}

{% tab title="Java" %}
```
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {
		URL url = new URL("https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>?photon_key=<mention-the-photon-key-here>");
		HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
		httpConn.setRequestMethod("DELETE");

		httpConn.setRequestProperty("Content-Type", "application/json");
		httpConn.setRequestProperty("CLIENT-ID", "<client-id>");
		httpConn.setRequestProperty("AUTHORIZATION", "apikey <username>:<api-key>");
		httpConn.setRequestProperty("PASSWORD", "<password>");
		httpConn.setRequestProperty("SECRET-KEY", "<secret-key>");

		InputStream responseStream = httpConn.getResponseCode() / 100 == 2
				? httpConn.getInputStream()
				: httpConn.getErrorStream();
		Scanner s = new Scanner(responseStream).useDelimiter("\\A");
		String response = s.hasNext() ? s.next() : "";
		System.out.println(response);
	}
}
```
{% endtab %}
{% endtabs %}
