# Clear Items from a Shopping List

## Clear Items

<mark style="color:red;">`DELETE`</mark> `https://api.whisk.com/list/v2/{id}/item`

You can use the following path parameter and a body parameter to clear items from a shopping list:

#### Path Parameters

| Name | Type   | Description                                                              |
| ---- | ------ | ------------------------------------------------------------------------ |
| id   | string | The unique identifier of the list that contains the items to be cleared. |

#### Headers

| Name           | Type   | Description                                                                                                                                           |
| -------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authentication | string | Server Token or a User Access token containing `shopping_list:write` scope to authorize the API usage. For more information, see Authentication.&#xD; |

#### Request Body

| Name | Type   | Description                                                                                                         |
| ---- | ------ | ------------------------------------------------------------------------------------------------------------------- |
| body | object | The body object contains an attribute to indicate which items are to be cleared. See the Body Object Example below. |

{% tabs %}
{% tab title="200 This is how a successful response looks." %}

```graphql
{}
```

{% endtab %}

{% tab title="400 This failed response appears when error codes are found in the endpoint query." %}

```yaml
{
  "error_code": "REAL_CODES_ARE_IN_ENDPOINT_DESCRIPTION",
  "message": "Additional details about error are not static and can be changed"
}
```

{% endtab %}

{% tab title="401 This failed response appears due to API authentication failure. The possible error codes that may appear are:auth.tokenNotFound, auth.tokenExpired, auth.tokenInvalid, auth.tokenRequired." %}

```yaml
{
  "code": "auth.tokenNotFound"
}
```

{% endtab %}

{% tab title="500 This failed response appears when something is not right on Whisk's end. Please send a message to <help@whisk.com>, and be sure to include both the Request and Response data. We’ll get back to you soon." %}

```yaml
This is unexpected response, something is wrong on our side, please contact: help@whisk.com
```

{% endtab %}
{% endtabs %}

### Request Body Object Example

```graphql
{
  "only_checked": false
}
```

#### `only_checked`

This boolean attribute allows you to indicate to remove only checked items from the list by setting it to `true` or all items from the list by setting it to `false`.

### Sample Request and Response

{% tabs %}
{% tab title="Curl Request" %}

```bash
curl -X DELETE "https://api.whisk.com/list/v2/106e1fa4cbb7c844458be372c3e0f7bfa94/item"
    -H "Accept: application/json"
    -H "Authorization: Bearer <YOUR-API-ACCESS-KEY>"
    -d "{ \"only_checked\": false}"
```

{% hint style="info" %}
Whisk allows you to discover and understand its API capabilities on the Swagger interface with the ability to try out the API calls directly in your browser. You can call this endpoint [here](https://api.whisk.com/spec/#/ShoppingListAPI/ShoppingListAPI_ClearList).
{% endhint %}
{% endtab %}

{% tab title="Response" %}

```graphql
{}
```

{% endtab %}
{% endtabs %}
