lob-api-sdk
v1.0.0
Published
The Lob API is a comprehensive direct mail and address verification service that helps developers extend their applications into the physical world through automated print and mail capabilities. It provides APIs for creating and managing addresses, verify
Readme
Getting Started with Lob API
Introduction
Lob helps creators extend their applications into the physical world with automated direct mail and address verification APIs.
Get started in the way that works best for you:
- Watch our 10-minute video walkthrough showing how to get started with Lob API collections.
Explore our API documentatation: docs.lob.com
Read through our Getting Started guide below
Need more help? Contact us at [email protected]
Getting Started
Sign up for a free Lob account
Your API keys are located under Settings.
You'll use the SECRET API KEYS that begin with test_. for your Test API key and live_. for your Live API key.
In order to use the collections in this public workspace, you'll select the Lob API collection and fork it into your personal workspace.
You'll also want to setup environment variables. A short cut is to fork Lob Public Env from Lob's public workspace. You also have the option to create them yourself - see the image below.
Set the Current Value for LIVE_API_KEY and TEST_API_KEY to your Lob "live" and "test" API keys and click Save.
Make sure Lob Public Env is selected in the environment menu.
Start exploring Lob's API collection
The Test API key is used for all print & mail related endpoints while the Live API key is used for the address verification endpoint.
Install the Package
Run the following command from your project directory to install the package from npm:
npm install [email protected]For additional package details, see the Npm page for the [email protected] npm.
Test the SDK
To validate the functionality of this SDK, you can execute all tests located in the test directory. This SDK utilizes Jest as both the testing framework and test runner.
To run the tests, navigate to the root directory of the SDK and execute the following command:
npm run testOr you can also run tests with coverage report:
npm run test:coverageInitialize the API Client
Note: Documentation for the client can be found here.
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
| environment | Environment | The API environment. Default: Environment.Production |
| timeout | number | Timeout for API calls.Default: 0 |
| httpClientOptions | Partial<HttpClientOptions> | Stable configurable http client options. |
| unstableHttpClientOptions | any | Unstable configurable http client options. |
| basicAuthCredentials | BasicAuthCredentials | The credential object for basicAuth |
The API client can be initialized as follows:
import { Client, Environment } from 'lob-api-sdk';
const client = new Client({
basicAuthCredentials: {
username: 'username',
password: 'password'
},
timeout: 0,
environment: Environment.Production,
});Authorization
This API uses the following authentication schemes.
List of APIs
- Address Verification Intl
- Address Verification US
- Bank Accounts
- Billing Groups
- Campaign Creatives
- Campaign Uploads
- Card Orders
- Reverse Geocode
- Self Mailers
- Template Versions
- Addresses
- Campaigns
- Cards
- Checks
- Letters
- Postcards
- Templates
- Zipcode
