openapi: 3.0.3
info:
title: Lob
version: "1.5.0"
description: >
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.
Looking for our [previous documentation](https://lob.github.io/legacy-docs/)?
license:
name: MIT
url: https://mit-license.org/
contact:
name: Lob Developer Experience
url: https://support.lob.com/
email: lob-openapi@lob.com
termsOfService: https://www.lob.com/legal
servers:
- url: https://api.lob.com/v1
description: production
tags:
- name: Addresses
description: |
To add an address to your address book, you create a new address object. You can retrieve and delete individual
addresses as well as get a list of addresses. Addresses are identified by a unique random ID.
- name: Authentication
x-traitTag: true
description: |
Requests made to the API are protected with [HTTP Basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication).
In order to properly authenticate with the API you must use your API key as the username
while leaving the password blank. Requests not properly authenticated will return a `401`
[error code](#tag/Errors). You can find your account's API keys
in your [Dashboard Settings](https://dashboard.lob.com/#/settings/keys).
### Example Request
curl uses the -u flag to pass basic auth credentials (adding a colon after your API key will prevent it from asking you for a
password). One of our test API keys has been filled into all the examples on the page, so you can test out any example right away.
```bash
curl https://api.lob.com/v1/addresses \
-u test_0dc8dXXXXXXXXXXXXXXXXXXXXXX5b0cc:
```
## API Keys
Lob authenticates your API requests using your account's API keys.
If you do not include your key when making an API request, or use
one that is incorrect or outdated, Lob returns an error with a `401`
HTTP response code. You can find all API keys in your dashboard
under [Settings](https://dashboard.lob.com/#/settings/keys).
There are two types of API keys: *secret* and *publishable*.
- **Secret API keys** should be kept confidential and only stored on your own servers.
Your account's secret API key can perform any API request to Lob without restriction.
- **Publishable API keys** are limited to US verifications, international verifications,
and US autocomplete requests. While we encourage you to use a secret key for maximum
security, you can publish these keys to JavaScript code or in an Android or iPhone app
without exposing print and mail services or your secret key. Publishable keys are always
prefixed with `[environment]_pub`.
Every type comes with a pair of keys: one for the testing environment and one for the
live environment. We recommend reading [Test and Live Environments](#tag/Test-and-Live-Environments)
for more information.
- name: Bank Accounts
description: |
Bank Accounts allow you to store your bank account securely in our system. The API provides
endpoints for creating bank accounts, deleting bank accounts, verifying bank accounts,
retrieving individual bank accounts, and retrieving a list of bank accounts.
- name: Beta Program
x-traitTag: true
description: |
At Lob, we pride ourselves on building high quality platform capabilities rapidly
and iteratively, so we can constantly be delivering additional value to our customers.
When evaluating a new product or feature from Lob, you may see that it has been released in Beta.
Typically, something in Beta means that the feature is early in its lifecycle here at
Lob. While we fully stand behind the quality of everything we release in Beta, we do
anticipate receiving a higher level of customer feedback on Beta features, as well as a
faster pace of changes from our engineering team in response to that feedback.
By participating in a Lob Beta program, you will have the opportunity to get early access
to a new product capability, as well as having a unique opportunity to influence the product's
direction with your feedback.
You should also anticipate that features in Beta may have functional or design limitations,
and might change rapidly as we receive customer feedback and make improvements. In particular,
new APIs in Beta may also go through more frequent versioning and version deprecation cycles
than our more mature APIs.
If you are participating in a Beta program and want to provide feedback, please feel free to
[contact us](https://lob.com/support#contact)!
- name: Billing Groups
description: |
The Billing Groups API allows you to create and view labels that can be attached to certain consumption-based
usages of Letters, Checks, Postcards and Self-Mailers to customize your bill. Please check each
resource API section to learn more about how to access the Billing Groups API.
- name: Bulk Intl Verifications
description: Verify a list of non-US addresses.
- name: Bulk US Verifications
description: Verify a list of US addresses.
- name: Card Orders
description: |
The card orders endpoint allows you to easily create card orders for existing cards.
The API provides endpoints for creating card orders and listing card orders for a given card.
- name: Cards
description: |
The cards endpoint allows you to easily create cards that can later be affixed to Letters.
The API provides endpoints for creating cards, retrieving individual cards, creating card orders, and retrieving a list of cards.
- name: Checks
description: |
Checks allow you to send payments via physical checks. The API provides endpoints
for creating checks, retrieving individual checks, canceling checks, and retrieving a list of checks.
- name: Errors
x-traitTag: true
description: |
Lob uses RESTful HTTP response codes to indicate success or failure of an API request - read below for more information. In general, 2xx indicates success, 4xx indicate an input error, and 5xx indicates an error on Lob's end.
CODE |
STATUS_CODE |
MESSAGE |
422 |
BAD_REQUEST |
An invalid request was made. See error message for details. |
409/422 |
CONFLICT |
This operation would leave data in a conflicted state. |
403 |
FEATURE_LIMIT_REACHED |
The account has reached its resource limit and requires upgrading to add more. |
500 |
INTERNAL_SERVER_ERROR |
An error has occured on Lob's servers. Please try request again. |
422 |
INVALID |
An invalid request was made. See error message for details. |
422 |
NOT_DELETABLE |
An attempt was made to delete a resource, but the resource cannot be deleted. |
404 |
NOT_FOUND |
The requested resource was not found. |
408 |
REQUEST_TIMEOUT |
The request took too long. Please try again. |
503 |
SERVICE_UNAVAILABLE |
The Lob servers are temporarily unavailable. Please try again. |
404 |
UNRECOGNIZED_ENDPOINT |
The requested endpoint doesn't exist. |
422 |
UNSUPPORTED_LOB_VERSION |
An unsupported Lob API version was requested. |
### Error Codes - Authentication
CODE |
STATUS_CODE |
MESSAGE |
401 |
PAYMENT_METHOD_UNVERIFIED |
You must have a verified bank account or credit card to submit live requests. |
404 |
DELETED_BANK_ACCOUNT |
Checks cannot be created with a deleted bank account. |
422 |
ADDRESS_LENGTH_EXCEEDS_LIMIT |
The sum of to.address_line1 and to.address_line2 cannot surpass 50 characters. |
422 |
BANK_ACCOUNT_ALREADY_VERIFIED |
The bank account has already been verified. |
422 |
BANK_ERROR |
There's an issue with the bank account. |
422 |
CUSTOM_ENVELOPE_INVENTORY_DEPLETED |
Custom envelope inventory is depleted, and more will need to be ordered. |
422 |
FAILED_DELIVERABILITY_STRICTNESS |
The to address doesn't meet strictness requirements. See [Account Settings](https://dashboard.lob.com/#/settings/account) to configure strictness. |
422 |
FILE_PAGES_BELOW_MIN |
Not enough pages. |
422 |
FILE_PAGES_EXCEED_MAX |
Too many pages. |
422 |
FILE_SIZE_EXCEEDS_LIMIT |
The file size is too large. See description for details. |
422 |
FOREIGN_RETURN_ADDRESS |
The 'from' address must be a US address. |
422 |
INCONSISTENT_PAGE_DIMENSIONS |
All pages of the input file must have the same dimensions. |
422 |
INVALID_BANK_ACCOUNT |
The provided bank routing number is invalid. |
422 |
INVALID_BANK_ACCOUNT_VERIFICATION |
Verification amounts do not match. |
422 |
INVALID_CHECK_INTERNATIONAL |
Checks cannot be sent internationally. |
422 |
INVALID_COUNTRY_COVID |
The postal service in the specified country is currently unable to process the request due to COVID-19 restrictions. |
422 |
INVALID_FILE |
The file is invalid. |
422 |
INVALID_FILE_DIMENSIONS |
File dimensions are incorrect for the selected mail type. |
422 |
INVALID_FILE_DOWNLOAD_TIME |
File download from remote server took too long. |
422 |
INVALID_FILE_URL |
The file URL when creating a resource is invalid. |
422 |
INVALID_IMAGE_DPI |
DPI must be at least 300. |
422 |
INVALID_INTERNATIONAL_FEATURE |
The specified product cannot be sent to the destination. |
422 |
INVALID_PERFORATION_RETURN_ENVELOPE |
Both `return_envelope` and `perforation` must be used together. |
422 |
INVALID_TEMPLATE_HTML |
The provided HTML is invalid. |
422 |
MERGE_VARIABLE_REQUIRED |
A required merge variable is missing. |
422 |
MERGE_VARIABLE_WHITESPACE |
Merge variable names cannot contain whitespace. |
422 |
PDF_ENCRYPTED |
An encrypted PDF was provided. |
422 |
SPECIAL_CHARACTERS_RESTRICTED |
Cannot use special characters for merge variable names. |
422 |
UNEMBEDDED_FONTS |
The provided PDF contains non-standard unembedded fonts. See description for details. |
- name: Events
description: |
When various notable things happen within the Lob architecture, Events will be created. To get these events sent to your server
automatically when they occur, you can set up [Webhooks](#tag/Webhooks).
EVENT TYPE |
LIVE-ONLY |
WHEN EVENT TYPE OCCURS |
postcard.created |
false |
A postcard is successfully created (Lob returns a 200 status code). |
postcard.rendered_pdf |
false |
A postcard's PDF proof is successfully rendered. |
postcard.rendered_thumbnails |
false |
A postcard's thumbnails are successfully rendered. |
postcard.deleted |
false |
A postcard is successfully canceled. |
postcard.mailed |
true |
A postcard receives a "Mailed" tracking event. Only enabled for certain Print & Mail Editions. |
postcard.in_transit |
true |
A postcard receives an "In Transit" tracking event. |
postcard.in_local_area |
true |
A postcard receives an "In Local Area" tracking event. |
postcard.processed_for_delivery |
true |
A postcard receives a "Processed for Delivery" tracking event. |
postcard.re-routed |
true |
A postcard receives a "Re-Routed" tracking event. |
postcard.returned_to_sender |
true |
A postcard receives a "Returned to Sender" tracking event. |
EVENT TYPE |
LIVE-ONLY |
WHEN EVENT TYPE OCCURS |
self_mailer.created |
false |
A self_mailer is successfully created (Lob returns a 200 status code). |
self_mailer.rendered_pdf |
false |
A self_mailer's PDF proof is successfully rendered. |
self_mailer.rendered_thumbnails |
false |
A self_mailer's thumbnails are successfully rendered. |
self_mailer.deleted |
false |
A self_mailer is successfully canceled. |
self_mailer.mailed |
true |
A self_mailer receives a "Mailed" tracking event. Only enabled for certain [Print & Mail Editions](https://dashboard.lob.com/#/settings/editions). |
self_mailer.in_transit |
true |
A self_mailer receives an "In Transit" tracking event. |
self_mailer.in_local_area |
true |
A self_mailer receives an "In Local Area" tracking event. |
self_mailer.processed_for_delivery |
true |
A self_mailer receives a "Processed for Delivery" tracking event. |
self_mailer.re-routed |
true |
A self_mailer receives a "Re-Routed" tracking event. |
self_mailer.returned_to_sender |
true |
A self_mailer receives a "Returned to Sender" tracking event. |
EVENT TYPE |
LIVE-ONLY |
WHEN EVENT TYPE OCCURS |
letter.created |
false |
A letter is successfully created (Lob returns a 200 status code). |
letter.rendered_pdf |
false |
A letter's PDF proof is successfully rendered. |
letter.rendered_thumbnails |
false |
A letter's thumbnails are successfully rendered. |
letter.deleted |
false |
A letter is successfully canceled. |
letter.mailed |
true |
A letter receives a "Mailed" tracking event. Only enabled for certain [Print & Mail Editions](https://dashboard.lob.com/#/settings/editions). |
letter.in_transit |
true |
A letter receives an "In Transit" tracking event. |
letter.in_local_area |
true |
A letter receives an "In Local Area" tracking event. |
letter.processed_for_delivery |
true |
A letter receives a "Processed for Delivery" tracking event. |
letter.re-routed |
true |
A letter receives a "Re-Routed" tracking event. |
letter.returned_to_sender |
true |
A letter receives a "Returned to Sender" tracking event. |
letter.certified.mailed |
true |
A certified letter receives a "Mailed" tracking event. Only enabled for certain [Print & Mail Editions](https://dashboard.lob.com/#/settings/editions). |
letter.certified.in_transit |
true |
A certified letter receives an "In Transit" tracking event. |
letter.certified.in_local_area |
true |
A certified letter receives an "In Transit" tracking event. |
letter.certified.in_local_area |
true |
A certified letter receives an "In Local Area" tracking event. |
letter.certified.processed_for_delivery |
true |
A certified letter receives a "Processed for Delivery" tracking event. |
letter.certified.re-routed |
true |
A certified letter receives a "Re-Routed" tracking event. |
letter.certified.returned_to_sender |
true |
A certified letter receives a "Returned to Sender" tracking event. |
letter.certified.delivered |
true |
A certified letter receives a "Delivered" tracking event. |
letter.certified.pickup_available |
true |
A certified letter receives a "Pickup Available" tracking event. |
letter.certified.issue |
true |
A certified letter receives an "Issue" tracking event. |
letter.return_envelope.created |
false |
A return envelope is created (occurs simultaneously with letter creation). |
letter.return_envelope.in_transit |
true |
A return envelope receives an "In Transit" tracking event. |
letter.return_envelope.in_local_area |
true |
A return envelope receives an "In Local Area" tracking event. |
letter.return_envelope.processed_for_delivery |
true |
A return envelope receives a "Processed for Delivery" tracking event. |
letter.return_envelope.re-routed |
true |
A return envelope receives a "Re-Routed" tracking event. |
letter.return_envelope.returned_to_senders |
true |
A return envelope receives a "Returned to Sender" tracking event. |
EVENT TYPE |
LIVE-ONLY |
WHEN EVENT TYPE OCCURS |
check.created |
false |
A check is successfully created (Lob returns a 200 status code). |
check.rendered_pdf |
false |
A check's PDF proof is successfully rendered. |
check.rendered_thumbnails |
false |
A check's thumbnails are successfully rendered. |
check.deleted |
false |
A check is successfully canceled. |
check.mailed |
true |
A check receives a "Mailed" tracking event. Only enabled for certain [Print & Mail Editions](https://dashboard.lob.com/#/settings/editions). |
check.in_transit |
true |
A check receives an "In Transit" tracking event. |
check.in_local_area |
true |
A check receives an "In Local Area" tracking event. |
check.processed_for_delivery |
true |
A check receives a "Processed for Delivery" tracking event. |
check.re-routed |
true |
A check receives a "Re-Routed" tracking event. |
check.returned_to_sender |
true |
A check receives a "Returned to Sender" tracking event. |