Skip to content


Repository files navigation


NPM version Downloads Build Status Dependency Status Dev Dependency Status Coverage Status

Node.js wrapper for the API. See full documentation here.

Starting a new project, we recommend using our TypeScript SDK!

Move your existing project from lob-node to lob-typescript-sdk? Checkout this migration guide.

Table of Contents

Getting Started

Here's a general overview of the Lob services available, click through to read more.

Please read through the official API Documentation to get a complete sense of what to expect from each endpoint.


First, you will need to first create an account at and obtain your Test and Live API Keys.

Once you have created an account, you can access your API Keys from the Settings Panel.


lob-node can be installed through the npm:

$ npm install lob

To build and install from the latest source:

$ git clone
$ npm install


const Lob = require('lob')('YOUR API KEY');

// change api version
const Lob = require('lob')('YOUR API KEY', { apiVersion: 'API-VERSION' });

// change internal defaults (e.g. host)
const options = {/* see options below */};
const Lob = require('lob')('YOUR API KEY', options);

// you can also just pass options
const options = { apiKey: 'foo', host: 'bar' };
const Lob = require('lob')(options);

// callback pattern
Lob.addresses.list((err, body) => {
  if (err) return callback(err);
  return callback(null,;

Additionally, every resource method returns a promise, so you don't have to use the regular callback. E.g.

const Lob = require('lob')('YOUR API KEY');

.then((res) => {
.catch((e) => {


The Lob constructor accepts an options object which may contain one or more of the following options:

  • apiVersion - Optionally set the version of the Lob API to use. Defaults to latest.
  • host - Override the default host API calls are issued to.
  • userAgent - Override the default userAgent.
  • headers - Edit the headers sent in all API calls.
  • agent - Override the default HTTP agent used to make requests.


We've provided various examples for you to try out here.

There are simple scripts to demonstrate how to create all the core Lob objects (checks, letters, postcards. etc.) as well as more complex examples that utilize other libraries and external files.

Accessing Response Headers

You can access response headers via a hidden _response property.

.then((res) => {
  // => "application/json; charset=utf-8"

You can also access headers from errors.

.catch((err) => {
  // => "application/json; charset=utf-8"

API Documentation

The full and comprehensive documentation of Lob's APIs is available here.


To contribute, please see the file.


To run the tests with coverage:


To run the tests without coverage:

LOB_API_KEY=YOUR_TEST_API_KEY npm run test-no-cover


Copyright © 2013

Released under the MIT License, which can be found in the repository in LICENSE.txt.