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

Remove one or more tags from an existing subscriber. Tags that don't exist or that the subscriber doesn't have will be ignored.

## Response

- **Success (200 OK)** - Returns the list of tags that were actually removed.
- **Error (404 Not Found)** - Subscriber not found.
- **Error (400 Bad Request)** - Invalid request body or empty tags array.

## Response Fields

| Field         | Type    | Description                                                 |
| ------------- | ------- | ----------------------------------------------------------- |
| `success`     | boolean | Indicates if the operation was successful                   |
| `removed`     | number  | Number of tags actually removed from the subscriber         |
| `tags`        | array   | List of tags that were removed                              |
| `tags[].id`   | string  | Unique identifier for the tag                               |
| `tags[].name` | string  | Name of the tag                                             |
| `message`     | string  | (Optional) Additional information when no tags were removed |

## Request Schema

| Field  | Type     | Default  | Description                                                                     |
| ------ | -------- | -------- | ------------------------------------------------------------------------------- |
| `tags` | string[] | required | Array of tag names to remove from the subscriber. At least one tag is required. |

## Path Parameters

| Parameter    | Type   | Description                                                                                       |
| ------------ | ------ | ------------------------------------------------------------------------------------------------- |
| `subscriber` | string | Subscriber identifier - can be either the subscriber ID (e.g., `sub_TTYPR5tWDh`) or email address |

## Usage Example

Use this API endpoint to:

- Remove tags from subscribers when they no longer qualify for a segment
- Sync tag removals from your CRM or other systems
- Clean up subscriber data by removing obsolete tags
- Manage subscriber preferences and opt-outs

## Related Documentation

- [Get All Tags](/docs/api-reference/api-tags-get) - List available tags
- [Add Tags to Subscriber](/docs/api-reference/api-subscriber-tags-post) - Add tags to subscribers
- [Action Step](/docs/workflows/workflow-action-step) - Remove tags within workflows
- [Subscriber Events](/docs/features/subscriber-events) - View tag removal history


## API Reference
**Method:** DELETE
**Endpoint:** /api/v1/subscribers/{subscriber}/tags

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

const { removed, tags } = await lumail.subscribers.removeTags(
  "subscriber@example.com",
  ["newsletter", "premium"]
);
console.log(`Removed ${removed} tags:`, tags);
```

### cURL
```bash
curl -X DELETE https://lumail.io/api/v1/subscribers/subscriber@example.com/tags \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"tags": ["newsletter", "premium"]}'
```

### JavaScript
```javascript
const response = await fetch('https://lumail.io/api/v1/subscribers/subscriber@example.com/tags', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    tags: ['newsletter', 'premium']
  }),
});

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

### Python
```python
import requests

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

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

### Success Response
```json
{
  "success": true,
  "removed": 2,
  "tags": [
    {
      "id": "tag_JqaddtEx7z",
      "name": "newsletter"
    },
    {
      "id": "tag_rdEPhyjnfA",
      "name": "premium"
    }
  ]
}
```

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