Attaches tags to a contact. Missing tag names are created. Emits `tag.added` events. Permission: `subscribers`.

## Path Parameters

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

## Body Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| `tags` | string[] | **Required.** Tag names to attach. |

## Response Fields

| Field | Type | Description |
| ----- | ---- | ----------- |
| `tagsAdded` | integer | Number of tags processed. |
| `subscribersProcessed` | integer | Contacts updated (always `1` on this route). |
| `totalAssociationsCreated` | integer | New subscriber–tag links created. |
| `warning` | string | Present when some ids were skipped. |

## Errors

| Status | `name` | When |
| ------ | ------ | ---- |
| 401 | `missing_api_key` | Missing or invalid bearer token |
| 403 | `missing_permission` | Token lacks the `subscribers` permission |
| 404 | `not_found` | Unknown subscriber |
| 422 | `validation_error` | Invalid JSON body |

## Related

- [Remove Subscriber Tags](/docs/api-reference/v2/subscribers-tags-remove)
- [SDK: lumail.subscribers.addTags](/docs/sdk/v2/subscribers-add-tags)


## API Reference
**Method:** POST
**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.addTags(
  "user@example.com",
  ["customer"],
);
if (error) {
  throw error;
}
console.log(data.tagsAdded);
```

### cURL
```bash
curl -X POST https://lumail.io/api/v2/subscribers/user@example.com/tags \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"tags":["customer"]}'
```

### JavaScript
```javascript
const response = await fetch(
  "https://lumail.io/api/v2/subscribers/user@example.com/tags",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ tags: ["customer"] }),
  },
);
const data = await response.json();
```

### Success Response
```json
{
  "tagsAdded": 1,
  "subscribersProcessed": 1,
  "totalAssociationsCreated": 1
}
```

### Error Response
```json
{
  "name": "not_found",
  "message": "Subscriber not found",
  "statusCode": 404
}
```
