Skip to content


Repository files navigation


The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

This Ruby package is automatically generated by the OpenAPI Generator project:

  • API version: 1.3.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit



Getting Started


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.

Installation & Usage

Install with the appropriate package manager.

Then add Lob's Ruby SDK to your Gemfile

gem install 'lob'

First API Call

require 'lob'

config = Lob::Configuration.default
config.username = ENV['LOB_API_TEST_KEY']

apiInstance =
addressEditable ={
    description: "Harry - Office",
    name: "Harry Zhang",
    company: "Lob",
    email: "",
    phone: "5555555555",
    address_line1: "2261 Market Street",
    address_line2: "Ste 5668",
    address_city: "San Francisco",
    address_state: "CA",
    address_zip: "94114",
    address_country: "US",

  result = apiInstance.create(addressEditable)
  p result
rescue Lob::ApiError => e
  puts "Exception when calling AddressesApi->create: #{e}"

API Documentation

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


First, install RSpec to run the tests. This can be done by running either of the following lines on your command line depending on whether you use Bundler:

$ bundle add rspec # with Bundler

$ gem install rspec # without Bundler

Unit Tests

$ rspec -P __tests__/Api/* --color --format doc

Integration Tests

Integration tests run against a live deployment of the Lob API and require multiple valid API keys with access to specific features. As such, it is not expected that these tests will pass for every user in every environment.

To run integration tests:

$ LOB_API_TEST_KEY=<<YOUR TEST KEY>> LOB_API_LIVE_KEY=<<YOUR LIVE KEY>> rspec -P __tests__/Integration/* --color --format doc

A cleaner alternative if you are going to run integration tests frequently

Run this the first time:


Then, to run the integration tests:

$ env $(cat LOCAL.env) rspec -P __tests__/Integration/* --color --format doc


Copyright © 2022

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