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

```typescript
subscribers.update(idOrEmail: string, params: UpdateSubscriberParams): Promise<LumailResult<UpdateSubscriberResponse>>
```

Patch name, fields, tags. Optional `replaceTags`, `resubscribe`, `triggerWorkflows`, `skipDoubleOptIn`.

`skipDoubleOptIn: true` promotes an existing `PENDING_CONFIRMATION` contact to `SUBSCRIBED` before tag events. It does not resubscribe `UNSUBSCRIBED` unless `resubscribe` is also `true`.

## Path Parameters

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

## Body Parameters

| Name | Type | Description |
| ------------------ | -------------- | ------------------------------------------------------------------------------------------------- |
| `email` | string | New email address. |
| `name` | string or null | Display name. |
| `phone` | string or null | Phone number. |
| `tags` | string[] | Tag names to attach. |
| `fields` | `Record` | Custom fields. `null` clears a field. |
| `replaceTags` | boolean | When `true`, replace the existing tag set with `tags`. |
| `resubscribe` | boolean | When `true`, re-subscribe an `UNSUBSCRIBED` contact. Omitted `resubscribe` does not re-subscribe. |
| `triggerWorkflows` | boolean | When `true`, run subscribe workflows. |
| `skipDoubleOptIn` | boolean | When `true`, promote `PENDING_CONFIRMATION` to `SUBSCRIBED` before tag events. |
| `ipAddress` | string | Optional signup IP. |
| `country` | string | Optional country code. |

## Response Fields

| Field | Type | Description |
| ----------- | ------------------ | ---------------------------- |
| `id` | string | Subscriber id. |
| `email` | string | Email. |
| `name` | string or null | Display name. |
| `phone` | string or null | Phone. |
| `status` | `SubscriberStatus` | Current status. |
| `tags` | `{ id, name }[]` | Attached tags. |
| `fields` | `Record` | Custom fields. |
| `createdAt` | string | Optional ISO 8601 timestamp. |
| `updatedAt` | string | Optional ISO 8601 timestamp. |
| `warnings` | string[] | Optional non-fatal notes. |

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


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

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

const lumail = new Lumail({ apiKey: process.env.LUMAIL_API_KEY });
const { data, error } = await lumail.subscribers.update(
  "user@example.com",
  { name: "Ada Lovelace" },
);
if (error) {
  throw error;
}
console.log(data.name);
```

### cURL
```bash
curl -X PATCH https://lumail.io/api/v2/subscribers/user@example.com \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Ada Lovelace"}'
```

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

### Success Response
```json
{
  "id": "sub_abc123",
  "email": "user@example.com",
  "name": "Ada Lovelace",
  "phone": null,
  "status": "SUBSCRIBED",
  "tags": [],
  "fields": {}
}
```

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