---
title: NodeJS
description: "Send your mail using unsend in NodeJS"
icon: node-js
---
## Prerequisites
- [Unsend API key](https://app.unsend.dev/dev-settings/api-keys)
- [Verified domain](https://app.unsend.dev/domains)
## Using SDK
```bash npm
npm install unsend
```
```bash yarn
yarn add unsend
```
```bash pnpm
pnpm add unsend
```
```bash bun
bun add unsend
```
Get the API key from the [Unsend dashboard](https://app.unsend.dev/dev-settings/api-keys) and initialize the SDK
```javascript
import { Unsend } from "unsend";
const unsend = new Unsend({ apiKey: "us_12345" });
```
```javascript
unsend.emails.send({
to: "hello@acme.com",
from: "hello@company.com",
subject: "Unsend email",
html: "
Unsend is the best open source product to send emails
",
text: "Unsend is the best open source product to send emails",
});
```
## Adding contacts programatically
Get the contact book id from the [Unsend dashboard](https://app.unsend.dev/contacts/). Copy the contact book id
```javascript
unsend.contacts
.create("clzeydgeygff", {
email: "hey@koushik.dev",
firstName: "Koushik",
lastName: "KM",
})
```
```javascript
unsend.contacts.update("clzeydgeygff", contactId, {
firstName: "Koushik",
lastName: "KM",
});
```