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

# Delete Subscriber

> Permanently remove a subscriber from your mailing list

## Overview

Permanently delete a subscriber from your MailGreet account. This action cannot be undone.

<Warning>
  This is a destructive action. Once deleted, the subscriber and all associated data (engagement history, custom field values, group memberships) will be permanently removed.
</Warning>

## Authentication

<ParamField header="Authorization" type="string" required>
  Bearer token. Format: `Bearer YOUR_API_KEY`
</ParamField>

## Path Parameters

<ParamField path="subscriberId" type="string" required>
  The unique identifier (UUID) of the subscriber to delete.

  Example: `550e8400-e29b-41d4-a716-446655440000`
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the subscriber was deleted successfully
</ResponseField>

<ResponseField name="message" type="string">
  Confirmation message
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.mailgreet.com/api/v1/external/subscribers/550e8400-e29b-41d4-a716-446655440000" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const subscriberId = '550e8400-e29b-41d4-a716-446655440000';

  const response = await fetch(
    `https://api.mailgreet.com/api/v1/external/subscribers/${subscriberId}`,
    {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  subscriber_id = '550e8400-e29b-41d4-a716-446655440000'

  response = requests.delete(
      f'https://api.mailgreet.com/api/v1/external/subscribers/{subscriber_id}',
      headers={'Authorization': 'Bearer YOUR_API_KEY'}
  )

  print(response.json())
  ```

  ```php PHP theme={null}
  <?php
  $subscriberId = '550e8400-e29b-41d4-a716-446655440000';

  $ch = curl_init();

  curl_setopt_array($ch, [
      CURLOPT_URL => "https://api.mailgreet.com/api/v1/external/subscribers/{$subscriberId}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'DELETE',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer YOUR_API_KEY'
      ]
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  echo $response;
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "message": "Subscriber deleted successfully"
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "success": false,
    "error": "Subscriber not found"
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "success": false,
    "error": "Invalid or missing API key"
  }
  ```
</ResponseExample>

## Best Practices

<Tip>
  **Consider unsubscribing instead of deleting**: If you want to stop sending emails to a subscriber but keep their data for analytics, use the Update Subscriber endpoint to set their status to `unsubscribed` instead of deleting them.
</Tip>

### When to Delete vs Unsubscribe

| Action          | Use Case                                                          |
| --------------- | ----------------------------------------------------------------- |
| **Delete**      | GDPR/data deletion requests, duplicate records, test data cleanup |
| **Unsubscribe** | User opts out, temporary pause, compliance requirements           |
