---
title: "Install the SDK"
description: "Add the official Node, Python, or Ruby SDK — or call the API directly."
url: https://www.unitpost.com/docs/install
section: Docs
updated: 2026-07-23
---
# Install the SDK

## Install the SDK

> Add the official Node, Python, or Ruby SDK — or call the API directly.

You can integrate in whichever way fits your stack. The official SDKs (all published as `unitpost`) wrap the same REST API with idempotent retries, typed responses, and a `{ data, error }` result shape — or skip the dependency entirely and call the HTTP API directly with cURL or your language's HTTP client.

### 1. Add the SDK

Pick your language tab. The API tab needs nothing installed — any HTTP client works.

**cURL**

```bash
# No package to install — call the REST API with any HTTP client.
# Keep your key in an environment variable:
export UNITPOST_API_KEY="pk_live_..."
```

**Node.js**

```ts
# npm
npm install unitpost

# pnpm
pnpm add unitpost

# yarn
yarn add unitpost

# Requires Node.js 18+ (uses the built-in fetch).
```

**Python**

```python
# pip
pip install unitpost

# Poetry
poetry add unitpost

# Requires Python 3.8+.
```

**Ruby**

```ruby
# Bundler — add to your Gemfile:
#   gem "unitpost"
bundle install

# or install directly:
gem install unitpost

# Requires Ruby 3.0+.
```

### 2. Initialize the client

Construct a client once and reuse it. Each SDK reads UNITPOST_API_KEY from the environment by default, or you can pass the key explicitly. Never hard-code a key in source you commit.

**cURL**

```bash
# Every request carries your key as a Bearer token plus a User-Agent.
curl https://www.unitpost.com/api/v1/emails \
  -H "Authorization: Bearer $UNITPOST_API_KEY" \
  -H "Content-Type: application/json" \
  -H "User-Agent: my-app/1.0"
```

**Node.js**

```ts
import { Unitpost } from "unitpost";

// Reads UNITPOST_API_KEY from the environment, or pass it explicitly:
//   new Unitpost("pk_live_...")
const unitpost = new Unitpost(process.env.UNITPOST_API_KEY);
```

**Python**

```python
from unitpost import Unitpost

# Reads UNITPOST_API_KEY from the environment, or pass it explicitly:
#   Unitpost(api_key="pk_live_...")
unitpost = Unitpost()
```

**Ruby**

```ruby
require "unitpost"

# Reads UNITPOST_API_KEY from the environment, or pass it explicitly:
#   Unitpost::Client.new(api_key: "pk_live_...")
unitpost = Unitpost::Client.new
```

> **Keys live in the environment:** Store your API key in an environment variable (UNITPOST_API_KEY) or your secrets manager — not in committed source. Scope it to Sending if the integration only sends mail. See Quickstart (#guide-quickstart) for creating and scoping keys.

That's it — you're ready to send. Head to the Quickstart (#guide-quickstart) to make your first request, or jump straight to Templates & variables (#guide-templates).

## Related

- [Quickstart](https://www.unitpost.com/docs/quickstart): Create a key, verify a domain, and send your first email.
- [Templates & variables](https://www.unitpost.com/docs/templates): Reference a saved template and pass per-recipient data.
- [Subscription topics](https://www.unitpost.com/docs/topics): Let contacts opt out of one kind of mail without leaving your list.
