> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ecomail.cz/llms.txt
> Use this file to discover all available pages before exploring further.

# Unsubscribe subscriber from list

> Unsubscribe a subscriber from a specific list.

<ParamField path="list_id" type="integer" required>
  ID of the list.
</ParamField>

<ParamField body="email" type="string" required>
  Email address of the subscriber to unsubscribe.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE https://api2.ecomailapp.cz/lists/1/unsubscribe \
    -H "key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"email": "foo@bar.cz"}'
  ```

  ```php PHP theme={null}
  $listId = 1;
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, "https://api2.ecomailapp.cz/lists/{$listId}/unsubscribe");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'key: YOUR_API_KEY',
      'Content-Type: application/json',
  ]);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
      'email' => 'foo@bar.cz',
  ]));
  $response = curl_exec($ch);
  curl_close($ch);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": 4,
    "list_id": 1,
    "email": "foo@bar.cz",
    "status": 2,
    "subscribed_at": "2024-11-27T11:18:00.000000Z",
    "unsubscribed_at": "2024-11-27T11:39:16.000000Z",
    "custom_fields": { "mergetag": "content" },
    "source": "api"
  }
  ```
</ResponseExample>
