---
title: "Install the SDK"
description: "Add the official SDK for your language — or call the API directly."
url: https://www.unitpost.com/docs/install
section: Docs
updated: 2026-08-28
---
# Install the SDK

## Install the SDK

> Add the official SDK for your language — or call the API directly.

You can integrate in whichever way fits your stack. The official SDKs wrap the same REST API with idempotent retries 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+.
```

**PHP**

```php
# Composer
composer require unitpost/unitpost

# Requires PHP 8.2+.
```

**Laravel**

```php
# Composer — also pulls unitpost/unitpost
composer require unitpost/laravel

# Requires PHP 8.2+ and Laravel 10+.
```

**Go**

```go
go get github.com/unitpostcom/unitpost-go

# Requires Go 1.22+.
```

**Java**

```java
# Maven
# <dependency>
#   <groupId>com.unitpost</groupId>
#   <artifactId>unitpost</artifactId>
#   <version>0.3.0</version>
# </dependency>

# Requires Java 17+.
```

**Rust**

```rust
cargo add unitpost

# Requires Rust 1.70+.
```

**.NET**

```csharp
dotnet add package Unitpost

# Requires .NET 8+.
```

### 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/email \
  -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
```

**PHP**

```php
<?php
use Unitpost\Client;

// Reads UNITPOST_API_KEY from the environment, or pass it explicitly:
//   new Client(['apiKey' => 'pk_live_...']);
$unitpost = new Client();
```

**Laravel**

```php
use Unitpost\Laravel\Facades\Unitpost;

// Bound from UNITPOST_API_KEY / config/unitpost.php
$result = Unitpost::email()->send([/* ... */]);
```

**Go**

```go
import "github.com/unitpostcom/unitpost-go"

// Reads UNITPOST_API_KEY from the environment, or:
//   unitpost.NewWithOptions(unitpost.Options{APIKey: "pk_live_..."})
client := unitpost.New()
```

**Java**

```java
import com.unitpost.Unitpost;

// Reads UNITPOST_API_KEY from the environment, or:
//   new Unitpost(java.util.Map.of("apiKey", "pk_live_..."));
var unitpost = new Unitpost();
```

**Rust**

```rust
use unitpost::Unitpost;

// Reads UNITPOST_API_KEY from the environment
let unitpost = Unitpost::new();
```

**.NET**

```csharp
using Unitpost;

// Reads UNITPOST_API_KEY from the environment, or:
//   new UnitpostClient(apiKey: "pk_live_...");
var unitpost = new UnitpostClient();
```

> **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.
