`https://lumail.io/api/v1/subscribers/{subscriber}/unsubscribe`

Marks the subscriber as unsubscribed and stops future mail. The subscriber row, send history, opens, clicks, and journal stay. Subscriber deletion is not a product operation; `DELETE /api/v1/subscribers/{subscriber}` returns 405.

## Response

- **Success (200 OK)** - Returns the unsubscribed subscriber.
- **Error (404 Not Found)** - Returned if the subscriber does not exist.

## Response Fields

| Field                | Type    | Description                                     |
| -------------------- | ------- | ----------------------------------------------- |
| `success`            | boolean | Indicates if the operation was successful       |
| `message`            | string  | Confirms the subscriber was unsubscribed        |
| `subscriber.id`      | string  | Unique identifier for the subscriber            |
| `subscriber.email`   | string  | Email address of the subscriber                 |
| `subscriber.status`  | string  | `UNSUBSCRIBED`, or the existing non-subscribed status |

## Request Schema

No request body is required. Identify the subscriber by unique ID or email address in the URL path.

## Usage Example

Use this endpoint when you need to:

- Stop sending to a subscriber who asked to leave
- Keep send history and deliverability data intact
- Mirror an unsubscribe from an integration


## API Reference
**Method:** POST
**Endpoint:** /api/v1/subscribers/{subscriber}/unsubscribe

## Request Examples
### SDK (TypeScript)
```ts
import { Lumail } from "lumail";
const lumail = new Lumail({ apiKey: "YOUR_API_TOKEN" });

const { subscriber } = await lumail.subscribers.unsubscribe(
  "subscriber@example.com",
);
console.log(subscriber);
```

### cURL
```bash
# Unsubscribe by ID
curl -X POST https://lumail.io/api/v1/subscribers/sub_TTYPR5tWDh/unsubscribe \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

# Or unsubscribe by email
curl -X POST https://lumail.io/api/v1/subscribers/subscriber@example.com/unsubscribe \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
```

### JavaScript
```javascript
const response = await fetch(
  'https://lumail.io/api/v1/subscribers/subscriber@example.com/unsubscribe',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_TOKEN',
      'Content-Type': 'application/json',
    },
  },
);

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

### Python
```python
import requests

url = "https://lumail.io/api/v1/subscribers/subscriber@example.com/unsubscribe"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)
data = response.json()
print(data)
```

## Response Examples
### Success Response
```json
{
  "success": true,
  "message": "Subscriber unsubscribed successfully",
  "subscriber": {
    "id": "sub_TTYPR5tWDh",
    "email": "subscriber@example.com",
    "status": "UNSUBSCRIBED"
  }
}
```

### Error Response
```json
{
  "message": "Subscriber not found"
}
```
