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

```typescript
tags.update(idOrName: string, params: { name: string }): Promise<LumailResult<UpdateTagResponse>>
```

Rename.

## Path Parameters

| Name | Type | Description |
| ---------- | ------ | ------------------------------------- |
| `idOrName` | string | **Required.** Current tag id or name. |

## Body Parameters

| Name | Type | Description |
| ------ | ------ | --------------------------- |
| `name` | string | **Required.** New tag name. |

## Response Fields

| Field | Type | Description |
| ------ | ------ | ----------- |
| `id` | string | Tag id. |
| `name` | string | New name. |

`data` is `{ id, name }`. Failures return `{ data: null, error: { name, message, statusCode } }`.


## API Reference
**Method:** PATCH
**Endpoint:** /api/v2/tags/:tag

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

const lumail = new Lumail({ apiKey: process.env.LUMAIL_API_KEY });
const { data, error } = await lumail.tags.update("vip", {
  name: "customer",
});
if (error) {
  throw error;
}
console.log(data.name);
```

### cURL
```bash
curl -X PATCH https://lumail.io/api/v2/tags/vip \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"customer"}'
```

### JavaScript
```javascript
const response = await fetch("https://lumail.io/api/v2/tags/vip", {
  method: "PATCH",
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ name: "customer" }),
});
const data = await response.json();
```

### Success Response
```json
{ "id": "tag_abc123", "name": "customer" }
```

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