> ## Documentation Index
> Fetch the complete documentation index at: https://docs.novu.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscriber crud examples

# Subscriber CRUD Examples

## Create

### Node.js

```typescript theme={null}
import { Novu } from "@novu/api";

const novu = new Novu({
  secretKey: process.env.NOVU_SECRET_KEY,
});

await novu.subscribers.create({
  subscriberId: "user-123",
  email: "jane@example.com",
  firstName: "Jane",
  lastName: "Doe",
  phone: "+15551234567",
  avatar: "https://example.com/jane.jpg",
  locale: "en-US",
  timezone: "America/New_York",
  data: {
    plan: "pro",
    company: "Acme Inc",
  },
});
```

### Python

```python theme={null}
from novu_py import Novu

novu = Novu(security=Security(secret_key=os.environ["NOVU_SECRET_KEY"]))

novu.subscribers.create(request={
    "subscriber_id": "user-123",
    "email": "jane@example.com",
    "first_name": "Jane",
    "last_name": "Doe",
})
```

### cURL

```bash theme={null}
curl -X POST https://api.novu.co/v1/subscribers \
  -H "Authorization: ApiKey $NOVU_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "subscriberId": "user-123",
    "email": "jane@example.com",
    "firstName": "Jane",
    "lastName": "Doe"
  }'
```

## Read

### Retrieve Single Subscriber

```typescript theme={null}
const subscriber = await novu.subscribers.retrieve("user-123");
console.log(subscriber.result);
```

### cURL — Get Subscriber

```bash theme={null}
curl https://api.novu.co/v1/subscribers/user-123 \
  -H "Authorization: ApiKey $NOVU_SECRET_KEY"
```

### Search Subscribers

```typescript theme={null}
const results = await novu.subscribers.search({
  email: "jane@example.com",
});
```

## Update

### Partial Update

```typescript theme={null}
await novu.subscribers.patch(
  { firstName: "Jane", data: { plan: "enterprise" } },
  "user-123"
);
```

### cURL

```bash theme={null}
curl -X PATCH https://api.novu.co/v1/subscribers/user-123 \
  -H "Authorization: ApiKey $NOVU_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Jane",
    "data": { "plan": "enterprise" }
  }'
```

## Delete

```typescript theme={null}
await novu.subscribers.delete("user-123");
```

### cURL

```bash theme={null}
curl -X DELETE https://api.novu.co/v1/subscribers/user-123 \
  -H "Authorization: ApiKey $NOVU_SECRET_KEY"
```

## Bulk Create

At max 500 subscribers can be created in one single api call

```typescript theme={null}
await novu.subscribers.createBulk({
  subscribers: [
    { subscriberId: "user-1", email: "alice@example.com", firstName: "Alice" },
    { subscriberId: "user-2", email: "bob@example.com", firstName: "Bob" },
    { subscriberId: "user-3", email: "carol@example.com", firstName: "Carol" },
  ],
});
```
