`lumail@2.1.0` · [`lumail.subscribers`](/docs/sdk/v2/subscribers)

```typescript
subscribers.removeTags(idOrEmail: string, tags: string[]): Promise<LumailResult<RemoveTagsResponse>>
```

Detach tags. The SDK sends `tags` as a JSON-string query param.

## Path Parameters

| Name | Type | Description |
| ----------- | ------ | ------------------------------------- |
| `idOrEmail` | string | **Required.** Subscriber id or email. |

## Query Parameters

| Name | Type | Description |
| ------ | -------- | --------------------------------------------------------------------------- |
| `tags` | string[] | **Required.** Second argument. Tag names to detach. Serialized as `?tags=`. |

## Response Fields

| Field | Type | Description |
| --------- | ---------------- | ----------------------------- |
| `removed` | number | Count of tags detached. |
| `tags` | `{ id, name }[]` | Remaining tags when returned. |
| `message` | string | Optional confirmation. |

`data` is `{ removed?, tags?, message? }`. Failures return `{ data: null, error: { name, message, statusCode } }`.


## API Reference
**Method:** DELETE
**Endpoint:** /api/v2/subscribers/:subscriber/tags

### SDK
```ts
import { Lumail } from "lumail";

const lumail = new Lumail({ apiKey: process.env.LUMAIL_API_KEY });
const { data, error } = await lumail.subscribers.removeTags(
  "user@example.com",
  ["vip"],
);
if (error) {
  throw error;
}
console.log(data.removed ?? data.message);
```

### cURL
```bash
curl -X DELETE "https://lumail.io/api/v2/subscribers/user@example.com/tags?tags=%5B%22vip%22%5D" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

### JavaScript
```javascript
const tags = encodeURIComponent(JSON.stringify(["vip"]));
const response = await fetch(
  `https://lumail.io/api/v2/subscribers/user@example.com/tags?tags=${tags}`,
  {
    method: "DELETE",
    headers: {
      Authorization: "Bearer YOUR_API_TOKEN",
    },
  },
);
const data = await response.json();
```

### Success Response
```json
{
  "removed": 1,
  "tags": [{ "id": "tag_abc", "name": "newsletter" }],
  "message": "Tags removed"
}
```

### Error Response
```json
{
  "name": "validation_error",
  "message": "tags must be a JSON array of strings",
  "statusCode": 422
}
```
