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.
<p>
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.
<table>
<tr>
<th style="white-space: nowrap">ATTRIBUTE</th>
<th style="white-space: nowrap">DESCRIPTION</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>code</code></td>
<td style="white-space: nowrap">A consistent machine-keyable string identifying the error</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>status_code</code></td>
<td style="white-space: nowrap">A conventional HTTP status code</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>message</code></td>
<td style="white-space: nowrap">A human-readable, subject-to-change message with more details about the error</td>
</tr>
</table>
### HTTP Status Code Summary
<table>
<tr>
<th style="white-space: nowrap">CODE</th>
<th style="white-space: nowrap">STATUS_CODE</th>
<th style="white-space: nowrap">MESSAGE</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>200</code></td>
<td style="white-space: nowrap">SUCCESS</td>
<td style="white-space: nowrap">Successful API request</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>401</code></td>
<td style="white-space: nowrap">UNAUTHORIZED</td>
<td style="white-space: nowrap">Authorization error with your API key or account</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>403</code></td>
<td style="white-space: nowrap">FORBIDDEN</td>
<td style="white-space: nowrap">Forbidden error with your API key or account</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>404</code></td>
<td style="white-space: nowrap">NOT FOUND</td>
<td style="white-space: nowrap">The requested item does not exist</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">BAD REQUEST</td>
<td style="white-space: nowrap">The query or body parameters did not pass validation</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>429</code></td>
<td style="white-space: nowrap">TOO MANY REQUESTS</td>
<td style="white-space: nowrap">Too many requests have been sent with an API key in a given amount of time</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>500</code></td>
<td style="white-space: nowrap">SERVER ERROR</td>
<td style="white-space: nowrap">An internal server error occurred, please contact support@lob.com</td>
</tr>
</table>
### Error Codes - Generic
<table>
<tr>
<th style="white-space: nowrap">CODE</th>
<th style="white-space: nowrap">STATUS_CODE</th>
<th style="white-space: nowrap">MESSAGE</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">BAD_REQUEST</td>
<td style="white-space: nowrap">An invalid request was made. See error message for details.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>409/422</code></td>
<td style="white-space: nowrap">CONFLICT</td>
<td style="white-space: nowrap">This operation would leave data in a conflicted state.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>403</code></td>
<td style="white-space: nowrap">FEATURE_LIMIT_REACHED</td>
<td style="white-space: nowrap">The account has reached its resource limit and requires upgrading to add more.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>500</code></td>
<td style="white-space: nowrap">INTERNAL_SERVER_ERROR</td>
<td style="white-space: nowrap">An error has occured on Lob's servers. Please try request again.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID</td>
<td style="white-space: nowrap">An invalid request was made. See error message for details.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">NOT_DELETABLE</td>
<td style="white-space: nowrap">An attempt was made to delete a resource, but the resource cannot be deleted.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>404</code></td>
<td style="white-space: nowrap">NOT_FOUND</td>
<td style="white-space: nowrap">The requested resource was not found.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>408</code></td>
<td style="white-space: nowrap">REQUEST_TIMEOUT</td>
<td style="white-space: nowrap">The request took too long. Please try again.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>503</code></td>
<td style="white-space: nowrap">SERVICE_UNAVAILABLE</td>
<td style="white-space: nowrap">The Lob servers are temporarily unavailable. Please try again.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>404</code></td>
<td style="white-space: nowrap">UNRECOGNIZED_ENDPOINT</td>
<td style="white-space: nowrap">The requested endpoint doesn't exist.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">UNSUPPORTED_LOB_VERSION</td>
<td style="white-space: nowrap">An unsupported Lob API version was requested.</td>
</tr>
</table>
### Error Codes - Authentication
<table>
<tr>
<th style="white-space: nowrap">CODE</th>
<th style="white-space: nowrap">STATUS_CODE</th>
<th style="white-space: nowrap">MESSAGE</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>401</code></td>
<td style="white-space: nowrap">EMAIL_REQUIRED</td>
<td style="white-space: nowrap">Account must have a verified email address before creating live resources.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>401</code></td>
<td style="white-space: nowrap">UNAUTHORIZED</td>
<td style="white-space: nowrap">The request isn't authorized.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>401</code></td>
<td style="white-space: nowrap">UNAUTHORIZED_TOKEN</td>
<td style="white-space: nowrap">Token isn't authorized.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>401/403</code></td>
<td style="white-space: nowrap">INVALID_API_KEY</td>
<td style="white-space: nowrap">The API key is invalid.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>403</code></td>
<td style="white-space: nowrap">PUBLISHABLE_KEY_NOT_ALLOWED</td>
<td style="white-space: nowrap">The requested operation needs a secret key, not a publishable key. See [API Keys](#tag/API-Keys) for more information.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>429</code></td>
<td style="white-space: nowrap">RATE_LIMIT_EXCEEDED</td>
<td style="white-space: nowrap">Requests were sent too quickly and must be slowed down.</td>
</tr>
</table>
### Error Codes - Advanced
<table>
<tr>
<th style="white-space: nowrap">CODE</th>
<th style="white-space: nowrap">STATUS_CODE</th>
<th style="white-space: nowrap">MESSAGE</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>401</code></td>
<td style="white-space: nowrap">PAYMENT_METHOD_UNVERIFIED</td>
<td style="white-space: nowrap">You must have a verified bank account or credit card to submit live requests.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>404</code></td>
<td style="white-space: nowrap">DELETED_BANK_ACCOUNT</td>
<td style="white-space: nowrap">Checks cannot be created with a deleted bank account.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">ADDRESS_LENGTH_EXCEEDS_LIMIT</td>
<td style="white-space: nowrap">The sum of to.address_line1 and to.address_line2 cannot surpass 50 characters.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">BANK_ACCOUNT_ALREADY_VERIFIED</td>
<td style="white-space: nowrap">The bank account has already been verified.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">BANK_ERROR</td>
<td style="white-space: nowrap">There's an issue with the bank account.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">CUSTOM_ENVELOPE_INVENTORY_DEPLETED</td>
<td style="white-space: nowrap">Custom envelope inventory is depleted, and more will need to be ordered.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">FAILED_DELIVERABILITY_STRICTNESS</td>
<td style="white-space: nowrap">The to address doesn't meet strictness requirements. See [Account Settings](https://dashboard.lob.com/#/settings/account) to configure strictness.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">FILE_PAGES_BELOW_MIN</td>
<td style="white-space: nowrap">Not enough pages.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">FILE_PAGES_EXCEED_MAX</td>
<td style="white-space: nowrap">Too many pages.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">FILE_SIZE_EXCEEDS_LIMIT</td>
<td style="white-space: nowrap">The file size is too large. See description for details.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">FOREIGN_RETURN_ADDRESS</td>
<td style="white-space: nowrap">The 'from' address must be a US address.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INCONSISTENT_PAGE_DIMENSIONS</td>
<td style="white-space: nowrap">All pages of the input file must have the same dimensions.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_BANK_ACCOUNT</td>
<td style="white-space: nowrap">The provided bank routing number is invalid.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_BANK_ACCOUNT_VERIFICATION</td>
<td style="white-space: nowrap">Verification amounts do not match.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_CHECK_INTERNATIONAL</td>
<td style="white-space: nowrap">Checks cannot be sent internationally.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_COUNTRY_COVID</td>
<td style="white-space: nowrap">The postal service in the specified country is currently unable to process the request due to COVID-19 restrictions.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_FILE</td>
<td style="white-space: nowrap">The file is invalid.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_FILE_DIMENSIONS</td>
<td style="white-space: nowrap">File dimensions are incorrect for the selected mail type.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_FILE_DOWNLOAD_TIME</td>
<td style="white-space: nowrap">File download from remote server took too long.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_FILE_URL</td>
<td style="white-space: nowrap">The file URL when creating a resource is invalid.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_IMAGE_DPI</td>
<td style="white-space: nowrap">DPI must be at least 300.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_INTERNATIONAL_FEATURE</td>
<td style="white-space: nowrap">The specified product cannot be sent to the destination.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_PERFORATION_RETURN_ENVELOPE</td>
<td style="white-space: nowrap">Both `return_envelope` and `perforation` must be used together.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">INVALID_TEMPLATE_HTML</td>
<td style="white-space: nowrap">The provided HTML is invalid.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">MERGE_VARIABLE_REQUIRED</td>
<td style="white-space: nowrap">A required merge variable is missing.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">MERGE_VARIABLE_WHITESPACE</td>
<td style="white-space: nowrap">Merge variable names cannot contain whitespace.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">PDF_ENCRYPTED</td>
<td style="white-space: nowrap">An encrypted PDF was provided.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">SPECIAL_CHARACTERS_RESTRICTED</td>
<td style="white-space: nowrap">Cannot use special characters for merge variable names.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>422</code></td>
<td style="white-space: nowrap">UNEMBEDDED_FONTS</td>
<td style="white-space: nowrap">The provided PDF contains non-standard unembedded fonts. See description for details.</td>
</tr>
</table>
- 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).
<h3>Postcards</h3>
<table>
<tr>
<th style="white-space: nowrap">EVENT TYPE</th>
<th style="white-space: nowrap">LIVE-ONLY</th>
<th style="white-space: nowrap">WHEN EVENT TYPE OCCURS</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.created</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A postcard is successfully created (Lob returns a 200 status code).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.rendered_pdf</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A postcard's PDF proof is successfully rendered.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.rendered_thumbnails</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A postcard's thumbnails are successfully rendered.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.deleted</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A postcard is successfully canceled.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.mailed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A postcard receives a "Mailed" <a href='#operation/tracking_event'>tracking event</a>. Only enabled for certain <a href='https://dashboard.lob.com/#/settings/editions'>Print & Mail Editions</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.in_transit</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A postcard receives an "In Transit" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.in_local_area</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A postcard receives an "In Local Area" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.processed_for_delivery</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A postcard receives a "Processed for Delivery" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.re-routed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A postcard receives a "Re-Routed" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>postcard.returned_to_sender</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A postcard receives a "Returned to Sender" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
</table>
<h3>Self Mailers</h3>
<table>
<tr>
<th style="white-space: nowrap">EVENT TYPE</th>
<th style="white-space: nowrap">LIVE-ONLY</th>
<th style="white-space: nowrap">WHEN EVENT TYPE OCCURS</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.created</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A self_mailer is successfully created (Lob returns a 200 status code).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.rendered_pdf</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A self_mailer's PDF proof is successfully rendered.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.rendered_thumbnails</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A self_mailer's thumbnails are successfully rendered.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.deleted</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A self_mailer is successfully canceled.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.mailed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A self_mailer receives a "Mailed" <a href='#operation/tracking_event'>tracking event</a>. Only enabled for certain [Print & Mail Editions](https://dashboard.lob.com/#/settings/editions).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.in_transit</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A self_mailer receives an "In Transit" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.in_local_area</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A self_mailer receives an "In Local Area" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.processed_for_delivery</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A self_mailer receives a "Processed for Delivery" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.re-routed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A self_mailer receives a "Re-Routed" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>self_mailer.returned_to_sender</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A self_mailer receives a "Returned to Sender" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
</table>
<h3>Letters</h3>
<table>
<tr>
<th style="white-space: nowrap">EVENT TYPE</th>
<th style="white-space: nowrap">LIVE-ONLY</th>
<th style="white-space: nowrap">WHEN EVENT TYPE OCCURS</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.created</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A letter is successfully created (Lob returns a 200 status code).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.rendered_pdf</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A letter's PDF proof is successfully rendered.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.rendered_thumbnails</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A letter's thumbnails are successfully rendered.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.deleted</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A letter is successfully canceled.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.mailed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A letter receives a "Mailed" <a href='#operation/tracking_event'>tracking event</a>. Only enabled for certain [Print & Mail Editions](https://dashboard.lob.com/#/settings/editions).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.in_transit</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A letter receives an "In Transit" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.in_local_area</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A letter receives an "In Local Area" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.processed_for_delivery</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A letter receives a "Processed for Delivery" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.re-routed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A letter receives a "Re-Routed" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.returned_to_sender</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A letter receives a "Returned to Sender" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.mailed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives a "Mailed" <a href='#operation/tracking_event'>tracking event</a>. Only enabled for certain [Print & Mail Editions](https://dashboard.lob.com/#/settings/editions).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.in_transit</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives an "In Transit" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.in_local_area</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives an "In Transit" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.in_local_area</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives an "In Local Area" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.processed_for_delivery</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives a "Processed for Delivery" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.re-routed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives a "Re-Routed" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.returned_to_sender</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives a "Returned to Sender" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.delivered</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives a "Delivered" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.pickup_available</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives a "Pickup Available" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.certified.issue</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A certified letter receives an "Issue" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.return_envelope.created</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A return envelope is created (occurs simultaneously with letter creation).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.return_envelope.in_transit</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A return envelope receives an "In Transit" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.return_envelope.in_local_area</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A return envelope receives an "In Local Area" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.return_envelope.processed_for_delivery</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A return envelope receives a "Processed for Delivery" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.return_envelope.re-routed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A return envelope receives a "Re-Routed" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>letter.return_envelope.returned_to_senders</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A return envelope receives a "Returned to Sender" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
</table>
<h3>Checks</h3>
<table>
<tr>
<th style="white-space: nowrap">EVENT TYPE</th>
<th style="white-space: nowrap">LIVE-ONLY</th>
<th style="white-space: nowrap">WHEN EVENT TYPE OCCURS</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.created</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A check is successfully created (Lob returns a 200 status code).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.rendered_pdf</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A check's PDF proof is successfully rendered.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.rendered_thumbnails</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A check's thumbnails are successfully rendered.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.deleted</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A check is successfully canceled.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.mailed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A check receives a "Mailed" <a href='#operation/tracking_event'>tracking event</a>. Only enabled for certain [Print & Mail Editions](https://dashboard.lob.com/#/settings/editions).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.in_transit</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A check receives an "In Transit" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.in_local_area</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A check receives an "In Local Area" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.processed_for_delivery</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A check receives a "Processed for Delivery" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.re-routed</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A check receives a "Re-Routed" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>check.returned_to_sender</code></td>
<td style="white-space: nowrap"><code>true</code></td>
<td style="white-space: nowrap">A check receives a "Returned to Sender" <a href='#operation/tracking_event'>tracking event</a>.</td>
</tr>
</table>
<h3>Addresses</h3>
<table>
<tr>
<th style="white-space: nowrap">EVENT TYPE</th>
<th style="white-space: nowrap">LIVE-ONLY</th>
<th style="white-space: nowrap">WHEN EVENT TYPE OCCURS</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>address.created</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">An address is successfully created (Lob returns a 200 status code).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>address.deleted</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">An address is successfully deleted.</td>
</tr>
</table>
<h3>Bank Accounts</h3>
<table>
<tr>
<th style="white-space: nowrap">EVENT TYPE</th>
<th style="white-space: nowrap">LIVE-ONLY</th>
<th style="white-space: nowrap">WHEN EVENT TYPE OCCURS</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>bank_account.created</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A bank account is successfully created (Lob returns a 200 status code).</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>bank_account.deleted</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A bank account is successfully deleted.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>bank_account.verified</code></td>
<td style="white-space: nowrap"><code>false</code></td>
<td style="white-space: nowrap">A bank account is successfully verified.</td>
</tr>
</table>
- name: Getting Started
x-traitTag: true
description: |
### 1. Get Setup
* Create an account at <a href="https://dashboard.lob.com/#/register">Lob.com</a>
* Obtain your API keys in the Lob dashboard <a href="https://dashboard.lob.com/#/settings/keys">settings</a>
* You'll use the format, `test_*.` for your Test API key and `live_*.` for your Live API key.
### 2. Explore
* Try out in Postman:
<div class="postman-run-button"
data-postman-action="collection/fork"
data-postman-var-1="16169677-975ecb9f-ea22-4d8f-a4f9-53a42f2aee03"
data-postman-collection-url="entityId=16169677-975ecb9f-ea22-4d8f-a4f9-53a42f2aee03&entityType=collection&workspaceId=5404d3a5-5a84-4df6-b078-a1547e1a68a7"
style="background:#0099d7;color: white;display: flex;justify-content: center;align-items: center;">
Run in Postman
</div>
<script type="text/javascript">
(function (p,o,s,t,m,a,n) {
!p[s] && (p[s] = function () { (p[t] || (p[t] = [])).push(arguments); });
!o.getElementById(s+t) && o.getElementsByTagName("head")[0].appendChild((
(n = o.createElement("script")),
(n.id = s+t), (n.async = 1), (n.src = m), n
));
}(window, document, "_pm", "PostmanRunObject", "https://run.pstmn.io/button.js"));
</script>
* Launch your terminal and copy/paste a CURL command.
```bash
curl https://api.lob.com/v1/addresses \
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc:
```
* Download a [Lob SDK](#tag/SDKs-and-Tools) into your favorite IDE (integrated development environment)
### 3. Learn more
Review our "Getting Started" guides for more details on use cases:
* [Postcards](https://www.lob.com/guides#getting_started)
* [Self-Mailers](https://www.lob.com/guides#getting_started_selfmailers)
* [Letters](https://www.lob.com/guides#getting_started_letters)
* [Checks](https://www.lob.com/guides#getting_started_checks)
* [Address Verification Elements](https://www.lob.com/guides#av-elements-quickstart)
- name: Intl Verifications
description: |
Address verification for non-US addresses
## Intl Verifications Test Env
When verifying international addresses, you'll likely want to test against
a wide array of addresses to ensure you're handling responses correctly.
With your test API key, requests that use specific values for `primary_line`
let you explore the responses to many types of addresses:
<table>
<tr>
<th style="white-space: nowrap">DELIVERABILITY OF SAMPLE RESPONSE</th>
<th style="white-space: nowrap">SET <code>primary_line</code> TO</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap">deliverable</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>deliverable_missing_info</code></td>
<td style="white-space: nowrap">deliverable missing info</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>undeliverable</code></td>
<td style="white-space: nowrap">undeliverable</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>no_match</code></td>
<td style="white-space: nowrap">no match</td>
</tr>
</table>
See the `test` request & response examples under [Intl Verification Examples](#operation/intl_verification) within the
"Verify an international address section" in Intl Verifications.
You can rely on the response from these examples generally matching the response
you'd see in the live environment with an address of that type (excluding the `recipient` field).
The test API key does not perform any verification, automatic correction, or standardization
for addresses. If you wish to try these features out, use our [live demo](https://lob.com/address-verification)
or the free plan (see [our pricing](https://lob.com/pricing/address-verification) for details).
- name: Introduction
x-traitTag: true
description: |
Lob’s Print & Mail and Address Verification APIs help companies transform outdated,
manual print-and-mail processes; save 1,000s of hours in processing time by sending mail much more
quickly; and increase ROI on offline communications.
Automate direct mail by triggering on-demand postcards, letters, and checks directly from your
CRM or customer data systems.
Address Verification corrects, standardizes, and cleanses address data for assured delivery with
instant verification across 240+ countries and territories.
Lob's print delivery network eliminates the hassle of vendor management with automated
production and postage across a global network of vetted commercial printers.
Tracking & Analytics gives you complete visibility of production and delivery for each piece of
mail you send to meet compliance requirements and measure campaign performance.
- name: Letters
description: |
The letters endpoint allows you to easily print and mail letters. The API provides endpoints for
creating letters, retrieving individual letters, canceling letters, and retrieving a list of letters.
- name: Manage Mail
x-traitTag: true
description: |
## Cancellation Windows
By default, all new accounts have a 5 minute cancellation window for postcards,
self mailers, letters, and checks. Within that timeframe, you can cancel
mailings from production, free of charge. Once the window has passed for a
postcard, self mailer, letter, or check, the mailing is no longer cancelable.
In addition, certain customers can customize their cancellation windows by
product in their [Dashboard Settings](https://dashboard.lob.com/#). Upgrade to
the appropriate [Print & Mail Edition](https://dashboard.lob.com/#/settings/editions)
to automatically gain access to this ability. For more details on this feature,
check out our [Cancellation Guide](https://lob.com/guides#cancellation_windows).
If you schedule a postcard, self mailer, letter, or check for up to 180 days
in the future by supplying the `send_date` parameter, that will override any
cancellation window you may have for that product.
## Scheduled Mailings
Postcards, self mailers, letters, and checks can be scheduled to be sent up
to 180 days in advance. You can use this feature to:
- Create automated drip campaigns (e.g. send a postcard at 15, 30, and 60
days)
- Schedule recurring sends
- Plan your mailing schedule ahead of time
Up until the time a mailing is scheduled for, it can also be canceled.
If you use this feature in conjunction with [a cancellation window](
index.html#section/Cancellation-Windows), the `send_date` parameter will always
take precedence.
For implementation details, see documentation below for each respective
endpoint. For more help, see our [Scheduled Mailings Guide](https://lob.com/guides#scheduled_mailing).
This feature is exclusive to certain customers. Upgrade to the appropriate
[Print & Mail Edition](https://dashboard.lob.com/#/settings/editions) to
gain access.
### Example Create Request using Send Date
```bash
curl https://api.lob.com/v1/postcards \
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
-d "description=Demo Future Postcard" \
-d "to=adr_bae820679f3f536b" \
-d "from=adr_210a8d4b0b76d77b" \
-d "front=tmpl_b846a20859ae11a" \
-d "back=tmpl_01b0d396a10c268" \
-d "merge_variables[name]=Harry" \
-d "send_date=2021-07-26"
```
- name: National Change of Address
x-traitTag: true
description: |
National Change of Address (NCOA) is a service offered by the USPS, which allows individuals
or businesses who have recently moved to have any mail forwarded from their previous address
to their new address.
As a CASS-certified Address Verification Provider, Lob also offers NCOA
functionality to our Print & Mail customers. With the Lob NCOA feature enabled, Postcards,
Letters, Checks and Addresses can automatically be corrected to reflect an individual's or business's
new address in the case that they have moved (only if they have registered for NCOA with the USPS).
Due to privacy concerns and USPS constraints, for customers with NCOA enabled, our API responses
for a limited set of endpoints differ slightly in the case when an address has been changed through NCOA.
**NOTE**: This feature is exclusive to certain customers. Upgrade to the appropriate <a href='https://dashboard.lob.com/#/settings/editions'>Print & Mail Editions</a> to gain access.
For more information, see our [NCOA guide](https://lob.com/guides#national_change).
## NCOA Live Environment
Though there are no changes to API requests, there are significant changes to our API responses, but
only in the event that an address has been changed through NCOA. If an address has not been changed
through NCOA, the response would be identical to our standard responses, except the addition of a
`recipient_moved` field, which is `false` for unchanged addresses.
If an address has been changed through NCOA, we are required to suppress the following response
fields for that address:
- `address_line1`
- `address_line2`
- The +4 portion of the ZIP+4 (5-digit ZIP code will still be present)
See the `ncoa_us_live` example under [Response samples](#operation/address_create) within the "Create an Address" section in Addresses
## NCOA Test Environment
In addition to sending live requests, you may also want to simulate what an NCOA response might
look like so that you can ensure your application behaves as expected. The behavior of NCOA in
Lob's Test Environment is very similar to our [US Verifications Test Mode](#section/US-Verifications-Test-Env).
To simulate an NCOA request, send a POST request to any of the four endpoints below with an `address_line1` field equal to `NCOA`:
- `POST /v1/addresses`
- `POST /v1/checks`
- `POST /v1/letters`
- `POST /v1/postcards`
- `POST /v1/self_mailers`
A static address will always be returned, as documented in the `ncoa_us_test` example under [Response samples](#operation/address_create) within the "Create an Address"
section in Addresses (along with the corresponding request under "Request samples").
- name: Postcards
description: |
The postcards endpoint allows you to easily print and mail postcards. The API provides endpoints for creating postcards,
retrieving individual postcards, canceling postcards, and retrieving a list of postcards.
- name: Rate Limiting
x-traitTag: true
description: >-
To prevent misuse, we enforce a rate limit on an API Key and endpoint basis,
similar to the way many other APIs enforce rate limits. By default, all accounts
and their corresponding Test and Live API Keys have a rate limit of 150 requests
per 5 seconds per endpoint. The `POST /v1/us_verifications` and `POST /v1/us_autocompletions`
endpoints have a limit of 300 requests per 5 seconds for all accounts.
When your application exceeds the rate limit for a given API endpoint, the
Lob API will return an HTTP 429 "Too Many Requests" response code instead of
the variety of codes you would find across the other API endpoints.
**HTTP Headers**
HTTP headers are returned on each request to a rate limited endpoint. Ensure
that you inspect these headers during your requests as they provide relevant
data on how many more requests your application is allowed to make for the
endpoint you just utilized.
While the headers are documented here in titlecase, HTTP headers are case
insensitive and certain libraries may transform them to lowercase. Please
inspect your headers carefully to see how they will be represented in your
chosen development scenario.
<table>
<tbody>
<tr>
<td>X-Rate-Limit-Limit:</td>
<td>the rate limit ceiling for a given request</td>
</tr>
<tr>
<td>X-Rate-Limit-Remaining:</td>
<td>the number of requests remaining in this window</td>
</tr>
<tr>
<td>X-Rate-Limit-Reset:</td>
<td>the time at which the rate limit window resets (in <a href="https://en.wikipedia.org/wiki/Unix_time" target="_blank">UTC epoch seconds</a>)
</td>
</tr>
</tbody>
</table>
### Example HTTP Headers
```bash
X-Rate-Limit-Limit:150
X-Rate-Limit-Remaining:100
X-Rate-Limit-Reset:1528749846
```
### Example Response
If you hit the rate limit on a given endpoint, this is the body of the HTTP
429 message that you will see:
```javascript
{
"error": {
"message": "Rate limit exceeded. Please wait 5 seconds and try your request again.",
"code": "rate_limit_exceeded",
"status_code": 429
}
}
```
- name: Requests and Responses
x-traitTag: true
description: |
## Asset URLs
All asset URLs returned by the Lob API (postcards, letters, thumbnails,
etc) are signed links served over HTTPS. All links returned will expire in
30 days to prevent mis-sharing. Each time a GET request is initiated, a
new signed URL will be generated.
## Idempotent Requests
Lob supports idempotency for safely retrying `POST` requests to create
postcards, self mailers, letters, and checks without accidentally creating
duplicates.
For example, if a request to create a check fails due to a network error,
you can safely retry the same request with the same idempotency key and
guarantee that only one check will ultimately be created and sent. When a
request is sent with an idempotency key for an already created resource,
the response object for the existing resource will be returned.
To perform an idempotent `POST` request to one of the mailpiece product
endpoints, provide an additional `Idempotency-Key` header or an `idempotency_key`
query parameter to the request. If multiple idempotency keys are provided,
the request will fail. How you create unique keys is up to you, but we
suggest using random values, such as V4 UUIDs. Idempotency keys are intended
to prevent issues over a short periods of time, therefore keys expire after
24 hours. Keys are unique by mode (Test vs. Live) as well as by resource
(postcard vs. letter, etc.).
By default, all `GET` and `DELETE` requests are idempotent by nature, so
they do not require an additional idempotency key.
For more help integrating idempotency keys, refer to our
[implementation guide](https://lob.com/guides#idempotent_request).
**Headers**
<table>
<tbody>
<tr>
<td>Idempotency-Key:</td>
<td>
optional
<p style="color:#888;margin-top:0px;">
<font size="-1">
A string of no longer than 256 characters
that uniquely identifies this resource.
</font>
</p>
</td>
</tr>
</tbody>
</table>
**Query Parameters**
<table>
<tbody>
<tr>
<td>idempotency-key:</td>
<td>
optional
<p style="color:#888;margin-top:0px;">
<font size="-1">
A string of no longer than 256 characters
that uniquely identifies this resource.
</font>
</p>
</td>
</tr>
</tbody>
</table>
### Example Request
```bash
curl https://api.lob.com/v1/postcards \
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
-H "Idempotency-Key: 026e7634-24d7-486c-a0bb-4a17fd0eebc5" \
-d "to=adr_bae820679f3f536b" \
-d "from=adr_210a8d4b0b76d77b" \
--data-urlencode "front=<html style='margin: 130px; font-size: 50;'>Front HTML for {{name}}</html>" \
--data-urlencode "back=<html style='margin: 130px; font-size: 50;'>Back HTML</html>" \
-d "merge_variables[name]=Harry"
```
## Metadata
When creating any Lob object, you can include a metadata object with up to 20 key-value pairs of
custom data. You can use metadata to store information like `metadata[customer_id] = "987654"` or
`metadata[campaign] = "NEWYORK2015"`. This is especially useful for filtering and matching to internal
systems.
Each metadata key must be less than 40 characters long and values must be less than 500 characters.
Metadata does not support nested objects.
### Example Create Request with Metadata
```bash
curl https://api.lob.com/v1/postcards \
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
-d "description=Demo Postcard job" \
-d "metadata[campaign]=NEWYORK2015" \
-d "to=adr_bae820679f3f536b" \
-d "from=adr_210a8d4b0b76d77b" \
--data-urlencode "front=<html style='margin: 130px; font-size: 50;'>Front HTML for {{name}}</html>" \
--data-urlencode "back=<html style='margin: 130px; font-size: 50;'>Back HTML</html>" \
-d "merge_variables[name]=Harry"
```
### Example List Request with Metadata Filter
```bash
curl -g "https://api.lob.com/v1/postcards?metadata[campaign]=NEWYORK2015&limit=2" \
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc:
```
## Request Body
When manually sending a POST HTTP request directly to the Lob API, without
the use of a library, you may represent the body as either a Form URL
Encoded request, a JSON document, or a Multipart Form Data request.
However, if you're using one of our [SDKs](#tag/SDKs-and-Tools),
the generation of the request bodies is done for you automatically and you don't
need to worry about the format.
### Form URL Encoded
This request body encoding is accompanied with the
`Content-Type: application/x-www-form-urlencoded` header. The content is an
example of what the [Verify a US address](index.html#operation/us_verification)
endpoint accepts. An example of a request body encoded in this format follows.
```javascript
primary_line=210 King Street&city=San Francisco&state=CA&zip_code=94107
```
### JSON
This request body encoding is accompanied with the `Content-Type: application/json` header.
The content is an example of what the [Verify a US address endpoint](index.html#operation/us_verification)
accepts. An example of a request body encoded in this format follows.
```javascript
{
"primary_line": "210 King Street",
"city": "San Francisco",
"state": "CA",
"zip_code": "94107"
}
```
### Multipart Form Data
This request body encoding is accompanied with the `Content-Type: multipart/form-data`
header. This is the only format that can be used for uploading a file to the API. The
content is an example of what the [Create a check](index.html#operation/check_create)
endpoint accepts. An example of a request body encoded in this format follows.
```javascript
--------------------------7015ebe79c0a5f8c
Content-Disposition: form-data; name="description"
Demo Letter
--------------------------7015ebe79c0a5f8c
Content-Disposition: form-data; name="to"
adr_bae820679f3f536b
--------------------------7015ebe79c0a5f8c
Content-Disposition: form-data; name="from"
adr_210a8d4b0b76d77b
--------------------------7015ebe79c0a5f8c
Content-Disposition: form-data; name="file"; filename="file.pdf"
Content-Type: application/pdf
<FILE CONTENT>
--------------------------7015ebe79c0a5f8c
Content-Disposition: form-data; name="color"
true
--------------------------7015ebe79c0a5f8c--
```
- name: Reverse Geocode Lookups
description: >
Find a list of zip codes associated with a valid US location via latitude and longitude.
- name: SDKs and Tools
x-traitTag: true
description: |
Please visit our [Github](https://www.github.com/lob) for a list of our supported libraries.
- [Ruby](https://github.com/lob/lob-ruby)
- [PHP](https://github.com/lob/lob-php)
- [Node.js](https://github.com/lob/lob-node)
- [Python](https://github.com/lob/lob-python)
- [Java](https://github.com/lob/lob-java)
- [Elixir](https://github.com/lob/lob-elixir)
- name: Self Mailers
description: |
The self mailer endpoint allows you to easily print and mail self mailers. The API provides endpoints
for creating self mailers, retrieving individual self mailers, canceling self mailers, and retrieving a list of self mailers.
- name: Template Design
x-traitTag: true
description: |
## HTML Templates
You can save commonly used HTML as templates within Lob to more easily manage them. You can reference
your saved templates in postcard, letter, and check requests instead of having to pass a long HTML
string on each request. Additionally, you can make changes to your HTML templates and update them
independently, without having to touch your API integration. Templates can be created, edited,
and viewed on your [Dashboard](https://dashboard.lob.com/#/templates). To use a template in a postcard,
letter, or check, see the documentation for each endpoint below. For help using templates, check out our
[HTML Templates Guide](https://lob.com/guides#html_templates) or get started with a
[pre-designed template from our gallery](https://lob.com/template-gallery). In Live mode, you can only have
as many templates as allotted in your current
[Print & Mail Edition](https://dashboard.lob.com/#/settings/editions). There is no limit in Test mode.
If you'd like to interact with templates programmatically, check out our Beta Program for API access
to the [HTML Templates Endpoints](#tag/Templates).
### Example Create Request using HTML Templates
```bash
curl https://api.lob.com/v1/postcards \
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
-d "description=Demo Postcard job" \
-d "to=adr_78c304d54912c502" \
-d "from=adr_61a0865c8c573139" \
-d "front=tmpl_b846a20859ae11a" \
-d "back=tmpl_01b0d396a10c268" \
-d "merge_variables[name]=Harry"
```
## HTML Examples
Use a pre-designed template from our [gallery](https://lob.com/resources/template-gallery) or follow these
basic [guidelines](https://github.com/lob/examples) as starting points for creating custom Postcards,
Self Mailers, Letters, and Checks.
Please follow the standards used in these templates, such as:
- For any linked assets, you must use a performant file hosting provider with no rate limits such as Amazon
S3.
- Use inline styles or an internal stylesheet, do not link to external stylesheets.
- Link to images that are 300DPI and sized at the final desired size on the physical mailing. For example,
for a photo that is desired to be 1in x 1in on the final postcard, the image asset should be sized at 1in
x 1in at 300DPI (which equates to 300px by 300px).
- The sum of all linked assets should not exceed 5MB in file size.
- Use `-webkit` prefixes for CSS properties when recommended [here](http://shouldiprefix.com/).
Because different browsers have varying user-agent styles, the HTML you see in your browser will not
always look identical to what is produced through the API. It is **strongly** recommended that you test all
HTML requests by reviewing the final PDF files in your Test Environment, as these are the files that will be
printed.
## Image Prepping
Currently we support the following file types for all endpoints:
- PDF
- PNG
- JPEG
**Templates**
You can find pre-made templates that already adhere to all of these guidelines here:
- [Postcards](#tag/Postcards)
- [Letters](#tag/Letters)
- [Checks](#tag/Checks)
- [Self Mailers](#tag/Self-Mailers)
**Prepping All Images**
The following guidelines apply to image types:
- Images should be 300 dpi or higher - PNG/JPEG files with less than 300 dpi will be rejected.
- Your artwork should include a 1/8" border around the final trim size. This means your final file size will be a total of 0.25" larger than your expected printed piece (ie, a 4"x6" postcard should be submitted as 4.25"x6.25"). There is no need to include crop marks in your submitted content.
- Include a safe zone – make sure no critical elements are within 1/8" from the edge of the final size.
- Do not include any additional postage marks or indicia.
- File sizes should be no larger than 5MB.
**Prepping PDFs**
To ensure that you are producing PDF's correctly please follow the guidelines below:
- [Make sure all non-standard fonts are embedded.](#section/Standard-PDF-Fonts)
- Generated PDF's need to be be PDF/A compliant.
**Prepping PNGs/JPEGs**
To ensure that you are producing PNG's/JPEG's correctly please follow the guidelines below:
- Minimum 300 dpi. The dpi is calculated as (width of image in pixels) / (width of product in inches) and (length of image in pixels) / (length of product in inches). For Example: 1275px x 1875px image used to create a 4.25" x 6.25" postcard has a dpi of 300.
- Submitted images must have the same length to width ratio as the chosen product. Images will not be cropped or stretched by the API.
## Standard PDF Fonts
Ideally, all fonts in provided PDFs should be embedded. Embedding a font in a PDF ensures that the final
printed product will look as it was designed. Fonts can vary greatly in size and shape, even within the
same family. If the exact font that was used to design the artwork is not used to print, the look and
placement of the text is not guaranteed to be the same.
In general, requests that provide PDFs with un-embedded fonts will be rejected. We make an exception for
"standard fonts", a set of fonts that we have identified as being common. PDFs that contain un-embedded
fonts that are found in the list, and match the accepted [font type](https://en.wikipedia.org/wiki/Category:Font_formats)
will be accepted. Otherwise, the request will be rejected.
Font embedding is an essential part of standard PDF workflows. Fonts should be embedded automatically by
PDF editing software that are compliant with PDF standards.
<table>
<tr>
<th style="white-space: nowrap">FONT NAME</th>
<th style="white-space: nowrap">TYPES</th>
</tr>
<tr>
<td style="white-space: nowrap"><code>Arial</code></td>
<td style="white-space: nowrap">Type 1, TrueType, CID TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Arial,Bold</code></td>
<td style="white-space: nowrap">Type 1, TrueType, CID TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Arial,BoldItalic</code></td>
<td style="white-space: nowrap">Type 1, TrueType, CID TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Arial,Italic</code></td>
<td style="white-space: nowrap">TrueType, CID TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>ArialMT</code></td>
<td style="white-space: nowrap">TrueType, CID TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Arial-BoldMT</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Arial-BoldItalicMT</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Arial-ItalicMT</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>ArialNarrow</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>ArialNarrow-Bold</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Calibri</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Calibri-Bold</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Calibri-Italic</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Candara-Bold</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Courier</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Courier-Oblique</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Courier-Bold</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Courier-BoldOblique</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>CourierNewPSMT</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>CourierNewPS-ItalicMT</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>CourierNewPS-BoldMT</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Helvetica</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Helvetica-Bold</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Helvetica-BoldOblique</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Helvetica-Oblique</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>LucidaConsole</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>MsSansSerif</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>MsSansSerif,Bold</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Symbol</code></td>
<td style="white-space: nowrap">Type 1, TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Tahoma</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Tahoma-Bold</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Times-Bold</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Times-BoldItalic</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Times-Italic</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Times-Roman</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>TimesNewRomanPS-BoldItalicMT</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>TimesNewRomanPS-BoldMT</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>TimesNewRomanPS-ItalicMT</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>TimesNewRomanPSMT</code></td>
<td style="white-space: nowrap">TrueType, CID TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>TimesNewRomanPSMT,Bold</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>TrebuchetMS</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Verdana</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Verdana-Bold</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Verdana,Bold</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>Verdana,Italic</code></td>
<td style="white-space: nowrap">TrueType</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>ZapfDingbats</code></td>
<td style="white-space: nowrap">Type 1</td>
</tr>
</table>
- name: Template Versions
description: |
These API endpoints allow you to create, retrieve, update and delete versions of reusable HTML templates for use with the Print & Mail API.
- name: Templates
description: |
These API endpoints allow you to create, retrieve, update and delete reusable HTML templates for use with the Print & Mail API.
- name: Test and Live Environments
x-traitTag: true
description: |
To make the API as explorable as possible, accounts have test and live
environment API keys. You're not charged any fees in the test environment,
so we encourage you to use it to try out services, perform quality
assurance, and run automated testing. Objects―addresses, letters, checks,
etc―in one environment cannot be manipulated by objects in the other.
In general, a payment method (either credit card or ACH account) must be
added to your account to make live API requests. However, a payment method
is not required for the first 300 live requests per month to the
`/v1/us_verifications` endpoint. After the first 300 requests, you will
begin receiving errors with status code `403`.
Requests made in the test environment always validate request arguments,
simulate live environment behavior, and enforce rate limits. _They never
print, mail nor, for verification services, verify addresses._ The US &
International verification services trigger behavior with specific
argument values, and, if you plan on using those, we recommend reading
[US Verification Test Environment](#tag/US-Verifications-Test-Environment)
and [Intl Verification Test Environment](#tag/Intl-Verifications-Test-Environment).
To switch between environments, use the appropriate key for that
environment when performing a request. You can find each environment's API
key in your dashboard under Settings; test API keys are always prefixed
with `test_` and production API keys with `live_`.
- name: Tracking Events
description: |
As mailpieces travel through the mail stream, USPS scans their unique barcodes, and Lob processes these mail scans to generate tracking events.
<h3>Certified Tracking Event Details</h3>
Letters sent with USPS Certified Mail are fully tracked by USPS, and
therefore their [tracking events](#operation/tracking_event) have an
additional `details` object with more detailed information about the
tracking event. The following table shows the potential values for
the fields in the `details` object mapped to the tracking event `name`.
<table>
<tr>
<th style="white-space: nowrap">NAME</th>
<th style="white-space: nowrap">EVENT</th>
<th style="white-space: nowrap">DESCRIPTION</th>
<th style="white-space: nowrap">ACTION REQUIRED</th>
</tr>
<tr>
<td style="white-space: nowrap">Mailed</td>
<td style="white-space: nowrap"><code>package_accepted</code></td>
<td>Package has been accepted into the carrier network for delivery.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">In Transit</td>
<td style="white-space: nowrap"><code>package_arrived</code></td>
<td>Package has arrived at an intermediate location in the carrier network.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">In Transit</td>
<td style="white-space: nowrap"><code>package_departed</code></td>
<td>Package has departed from an intermediate location in the carrier network.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">In Transit</td>
<td style="white-space: nowrap"><code>package_processing</code></td>
<td>Package is processing at an intermediate location in the carrier network.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">In Transit</td>
<td style="white-space: nowrap"><code>package_processed</code></td>
<td>Package has been processed at an intermediate location.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">In Local Area</td>
<td style="white-space: nowrap"><code>package_in_local_area</code></td>
<td>Package is at a location near the end destination.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Processed For Delivery</td>
<td style="white-space: nowrap"><code>delivery_scheduled</code></td>
<td>Package is scheduled for delivery.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Processed For Delivery</td>
<td style="white-space: nowrap"><code>out_for_delivery</code></td>
<td>Package is out for delivery.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Pickup Available</td>
<td style="white-space: nowrap"><code>pickup_available</code></td>
<td>Package is available for pickup at carrier location.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Delivered</td>
<td style="white-space: nowrap"><code>delivered</code></td>
<td>Package has been delivered.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Re-Routed</td>
<td style="white-space: nowrap"><code>package_forwarded</code></td>
<td>Package has been forwarded.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Returned to Sender</td>
<td style="white-space: nowrap"><code>returned_to_sender</code></td>
<td>Package is to be returned to sender.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>address_issue</code></td>
<td>Address information is incorrect. Contact carrier to ensure delivery.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>contact_carrier</code></td>
<td>Contact the carrier for more information.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>delayed</code></td>
<td>Delivery of package is delayed.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>delivery_attempted</code></td>
<td>Delivery of package has been attempted. Contact carrier to ensure delivery.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>delivery_rescheduled</code></td>
<td>Delivery of package has been rescheduled.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>location_inaccessible</code></td>
<td>Delivery location inaccessible to carrier. Contact carrier to ensure delivery.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>notice_left</code></td>
<td>Carrier left notice during attempted delivery. Follow carrier instructions on notice.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>package_damaged</code></td>
<td>Package has been damaged. Contact carrier for more details.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>package_disposed</code></td>
<td>Package has been disposed.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>package_held</code></td>
<td>Package held at carrier location. Contact carrier for more details.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>package_lost</code></td>
<td>Package has been lost. Contact carrier for more details.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>package_unclaimed</code></td>
<td>Package is unclaimed.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>package_undeliverable</code></td>
<td>Package is not able to be delivered.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>reschedule_delivery</code></td>
<td>Contact carrier to reschedule delivery.</td>
<td style="white-space: nowrap"><code>true</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Issue</td>
<td style="white-space: nowrap"><code>other</code></td>
<td>Unrecognized carrier status.</td>
<td style="white-space: nowrap"><code>false</code></td>
</tr>
</table>
- name: US Autocompletions
description: >
Given partial address information, this endpoint returns up to 10 address suggestions.
## Autocompletion Test Env
Your test API key does not autocomplete US addresses and is used to simulate
behavior. With your test API key, requests with specific values for `address_prefix`
return predetermined values. When `address_prefix` is set to:
- `0 suggestions` - Returns no suggestions
- `[PRIMARY NUMBER] s[uggestion]` - Returns a maximum of ten predefined suggested addresses.
`[PRIMARY NUMBER]` does not have to be a valid primary number when sending a test request.
Each additional letter in `suggestion` reduces the number of suggestions by one (e.g.
`1 su` returns 9 suggested addresses). `[PRIMARY NUMBER]` does not affect the number of
suggestions returned.
City and state filters work as expected and filter the list of predetermined suggested addresses.
See the `test` request & response examples under [Autocomplete Examples](#operation/autocompletion) within the "Autocomplete
a partial address" section in US Autocompletions.
- name: US Verification Types
x-traitTag: true
description: |
These are detailed definitions for various fields in the [US verification object](#operation/us_verification).
<h3>ZIP Code Types - <code>components[zip_code_type]</code></h3>
<table>
<tbody>
<tr>
<td style="white-space: nowrap"><code>standard</code></td>
<td>The default ZIP code type. Used when none of the other types apply.</td>
</tr>
<tr>
<td><code>po_box</code></td>
<td>The ZIP code contains only PO Boxes.</td>
</tr>
<tr>
<td><code>unique</code></td>
<td>The ZIP code is uniquely assigned to a single organization (such as a government agency) that receives a large volume of mail.</td>
</tr>
<tr>
<td><code>military</code></td>
<td>The ZIP code contains military addresses.</td>
</tr>
<tr>
<td><i>empty string</i></td>
<td>A match could not be made with the provided inputs.</td>
</tr>
</tbody>
</table>
<h3>Record Types - <code>components[record_type]</code></h3>
<table>
<tbody>
<tr>
<td><code>street</code></td>
<td>The default address type.</td>
</tr>
<tr>
<td><code>highrise</code></td>
<td>The address is a commercial building, apartment complex, highrise, etc.</td>
</tr>
<tr>
<td><code>firm</code></td>
<td>The address is of an organizational entity which receives a minimum number of mailpieces per day.</td>
</tr>
<tr>
<td><code>po_box</code></td>
<td>The address is a PO Box.</td>
</tr>
<tr>
<td><code>rural_route</code></td>
<td>The address exists on a Rural Route. This is an older system of mail delivery which is still used in some parts of the country.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>general_delivery</code></td>
<td>The address is part of the USPS General Delivery service, which allows individuals without permanent addresses to receive mail.</td>
</tr>
<tr>
<td><i>empty string</i></td>
<td>A match could not be made with the provided inputs.</td>
</tr>
</tbody>
</table>
<h3>Carrier Route Types - <code>components[carrier_route_type]</code></h3>
<table class="table-docs table-docs-code">
<tbody>
<tr>
<td><code>city_delivery</code></td>
<td>The default carrier route type. Used when none of the other types apply.</td>
</tr>
<tr>
<td><code>rural_route</code></td>
<td>The carrier route is a Rural Route. This is an older system of mail delivery which is still used in some parts of the country.</td>
</tr>
<tr>
<td><code>highway_contract</code></td>
<td>The carrier route is a Highway Contract Route. This is an older system of mail delivery which is still used in some parts of the country.</td>
</tr>
<tr>
<td><code>po_box</code></td>
<td>The carrier route consists of PO Boxes.</td>
</tr>
<tr>
<td style="white-space: nowrap"><code>general_delivery</code></td>
<td>The carrier route is part of the USPS General Delivery service, which allows individuals without permanent addresses to receive mail.</td>
</tr>
<tr>
<td><i>empty string</i></td>
<td>A match could not be made with the provided inputs.</td>
</tr>
</tbody>
</table>
<h3>DPV Footnotes - <code>deliverability_analysis[dpv_footnotes]</code></h3>
<table class="table-docs table-docs-code">
<tbody>
<tr>
<td style="white-space: nowrap"><code>AA</code></td>
<td>Some parts of the address (such as the street and ZIP code) are valid.</td>
</tr>
<tr>
<td><code>A1</code></td>
<td>The address is invalid based on given inputs.</td>
</tr>
<tr>
<td><code>BB</code></td>
<td>The address is deliverable.</td>
</tr>
<tr>
<td><code>CC</code></td>
<td>The address is deliverable by removing the provided secondary unit designator.</td>
</tr>
<tr>
<td><code>N1</code></td>
<td>The address is deliverable but is missing a secondary information (apartment, unit, etc).</td>
</tr>
<tr>
<td><code>F1</code></td>
<td>The address is a deliverable military address.</td>
</tr>
<tr>
<td><code>G1</code></td>
<td>The address is a deliverable General Delivery address. General Delivery is a USPS service which allows individuals without permanent addresses to receive mail.</td>
</tr>
<tr>
<td><code>U1</code></td>
<td>The address is a deliverable unique address. A unique ZIP code is assigned to a single organization (such as a government agency) that receives a large volume of mail.</td>
</tr>
<tr>
<td><code>M1</code></td>
<td>The primary number is missing.</td>
</tr>
<tr>
<td><code>M3</code></td>
<td>The primary number is invalid.</td>
</tr>
<tr>
<td><code>P1</code></td>
<td>PO Box, Rural Route, or Highway Contract box number is missing.</td>
</tr>
<tr>
<td><code>P3</code></td>
<td>PO Box, Rural Route, or Highway Contract box number is invalid.</td>
</tr>
<tr>
<td><code>R1</code></td>
<td>The address matched to a <a href="https://en.wikipedia.org/wiki/Commercial_mail_receiving_agency" target="_blank">CMRA</a> and private mailbox information is not present.</td>
</tr>
<tr>
<td><code>R7</code></td>
<td>The address matched to a Phantom Carrier Route (<code>carrier_route</code> of <code>R777</code>), which corresponds to physical addresses that are not eligible for delivery.</td>
</tr>
<tr>
<td><code>RR</code></td>
<td>The address matched to a <a href="https://en.wikipedia.org/wiki/Commercial_mail_receiving_agency" target="_blank">CMRA</a> and private mailbox information is present.</td>
</tr>
</tbody>
</table>
- name: US Verifications
description: |
Validate, automatically correct, and standardize the addresses in your
address book based on USPS's [Coding Accuracy Support System (CASS)](https://postalpro.usps.com/certifications/cass).
## US Verifications Test Env
When verifying US addresses, you'll likely want to test against a wide array of addresses to
ensure you're handling responses correctly. With your test API key, requests that use specific
values for `address` or `primary_line` and (if using `primary_line`) an arbitrary five digit
number for `zip_code` (e.g. "11111") let you explore the responses to many types of addresses:
<table>
<tr>
<th style="white-space: nowrap">ADDRESS TYPE FOR SAMPLE RESPONSE</th>
<th style="white-space: nowrap">DELIVERABILITY</th>
<th style="white-space: nowrap">SET <code>primary_line</code> OR <code>address</code> TO</th>
</tr>
<tr>
<td style="white-space: nowrap">Commercial highrise</td>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap"><code>commercial highrise</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Residential highrise</td>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap"><code>residential highrise</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Residential house</td>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap"><code>residential house</code></td>
</tr>
<tr>
<td style="white-space: nowrap">PO Box</td>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap"><code>po box</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Rural route</td>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap"><code>rural route</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Puerty Rico address w/ urbanization</td>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap"><code>puerto rico</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Military address</td>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap"><code>military</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Department of state</td>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap"><code>department of state</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Generic deliverable</td>
<td style="white-space: nowrap"><code>deliverable</code></td>
<td style="white-space: nowrap"><code>deliverable</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Missing a suite number</td>
<td style="white-space: nowrap"><code>deliverable_missing_unit</code></td>
<td style="white-space: nowrap"><code>missing unit</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Suite number doesn't exist</td>
<td style="white-space: nowrap"><code>deliverable_incorrect_unit</code></td>
<td style="white-space: nowrap"><code>incorrect unit</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Residential house with unnecessary suite number</td>
<td style="white-space: nowrap"><code>deliverable_unnecessary_unit</code></td>
<td style="white-space: nowrap"><code>unnecessary unit</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Undeliverable and block matched</td>
<td style="white-space: nowrap"><code>undeliverable</code></td>
<td style="white-space: nowrap"><code>undeliverable block match</code></td>
</tr>
<tr>
<td style="white-space: nowrap">Undeliverable and no block matched</td>
<td style="white-space: nowrap"><code>undeliverable</code></td>
<td style="white-space: nowrap"><code>undeliverable no match</code></td>
</tr>
</table>
See the `test` request & response examples under [US Verification Examples](#operation/us_verification) within the
"Verify a US or US territory address" section in US Verifications.
You can rely on the response from these examples generally matching the response you'd see in the live environment with an
address of that type (excluding the `recipient` field).
The test API key does not perform any verification, automatic correction, or standardization for addresses. If you wish to
try these features out, use our [live demo](https://lob.com/address-verification) or the free plan (see [our pricing](https://lob.com/pricing/address-verification) for details).
- name: Versioning and Changelog
x-traitTag: true
description: |
### API Versioning
When backwards-incompatible changes are made to the API, a new dated version
is released. The latest version of the API is version **2020-02-11**. You can
view your version and upgrade to the latest version in your
[Dashboard Settings](https://dashboard.lob.com/#/settings/keys). You will
only need to specify a version if you would like to test a newer version of
the API without doing a full upgrade. The API will return an error if a
version older than your current one is passed in. See
[API Changelog](#tag/Versioning-and-Changelog) for a full list of breaking changes.
### Example Request
```bash
curl https://api.lob.com/v1/addresses \
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
-H "Lob-Version: 2020-02-11"
```
### Specification Versioning
You might be wondering why our API and specification use different versioning schemes.
Lob's API predates our specification and follows the [Stripe versioning](https://stripe.com/blog/api-versioning)
approach. This works well to manage backwards-incompatible changes to our API.
For our API specification (used to create this documentation), we've chosen [semantic
versioning](https://semver.org/). This versioning reflects the backward-compatible
changes that do not require a versioning of Lob's API.
Lob's API specification will be used to generate artifacts like documentation, client SDKs,
and other developer tooling. Semantic versioning of our specification will inform how we
version those artifacts like SDKs. It is helpful to know the version of a specification
used to produce an artifact in order reference the specification release notes.
### Changelog
**2020-02-11**
- renders merge_variables into HTML with syntax that supports objects, conditionals, and loops
**2019-06-01**
- changed pagination model of GET endpoints for postcards, letters, checks, addresses, bank accounts, templates, and template versions to a cursor-based model
- offset parameter on these endpoints has been removed
- previous_url and next_url response fields have been added
**2018-06-05**
- remove rate-limit headers
**2018-03-30**
- updated letter template which includes a white box behind the address block area to ensure deliverability
**2018-03-01**
- US verification deliverability value no_match deprecated and merged into undeliverable
- US verification deliverability value deliverable_extra_secondary is split into deliverable_unnecessary_unit and deliverable_incorrect_unit
- US verification deliverability value deliverable_missing_secondary renamed to deliverable_missing_unit
- US verifications zip_code special values deprecated in favor of more comprehensive primary_line special values
**2018-02-08**
- enforce 50 character limit on the sum of address_line1 and address_line2 for check recipients
**2017-11-08**
- split extra_secondary_information into extra_secondary_designator and extra_secondary_number for /v1/us_verifications
**2017-10-17**
- remove support for the /v1/states endpoint
- remove support for the /v1/countries endpoint
- remove support for the message field from the POST /v1/postcards endpoint
**2017-09-08**
- renames input parameters and restructures response object for /v1/intl_verifications
**2017-08-14**
- automatically standardizes and corrects US addresses created via POST /v1/addresses. non-US addresses will be standardized into uppercase only.
- automatically standardizes and corrects inline US addresses used in POST /v1/postcards, POST /v1/letters, and POST /v1/checks. non-US addresses will be standardized into uppercase only.
- enforce 40 character limit on name and company for all addresses
- enforce 64 character limit on address_line1 and address_line2 for US addresses
**2017-06-16**
- enforce 10,000 character limit on HTML strings
- rename data parameter for all products to merge_variables
**2017-05-17**
- discontinues the /v1/verify endpoint - please use /v1/us_verifications or /v1/intl_verifications instead
**2016-06-30** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- unnest tracking object from postcard, letter, and check response objects
**2016-05-02** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- adds address_placement parameter to letters that defaults to top_first_page, template is no longer allowed
**2016-03-21** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- removes tracking numbers that do not provide any consumer-facing tracking information
- removes link from tracking responses
- requires account_type when creating a bank account
**2016-01-19** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- renames the count parameter to limit for all list endpoints
- removes the next_url and previous_url from list responses
**2015-12-22** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- adds size parameter to postcards that defaults to 4x6, setting is no longer allowed
**2015-11-23** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- remove price from letters
- remove pages from letters
- remove price from postcards
- renamed file parameter to check_bottom for checks
**2015-11-06** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- remove bank_address from bank_accounts
- remove account_address from bank_accounts and add from to checks
- remove price from checks
**2015-10-21** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- use the new HTML renderer for all products
**2015-06-25** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- remove the status field from all endpoints
**2015-04-11** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- errors on all endpoints are now single objects instead of arrays
- full_bleed is no longer allowed for postcards, objects, and area mails - all products are now full_bleed by default
- template is no longer allowed for postcards - all postcards must adhere to the template
- name is no longer allowed for area mails, bank accounts, checks, jobs, objects, and postcards - it has been replaced by description
- setting ID's 100 and 101 are no longer supported for objects - please use the Simple Letter Service instead
- service is no longer supported for jobs
- all boolean parameters now return true/false instead of 1/0
- double_sided is no longer allowed for objects - all products are default double sided if more than one page is allowed
- template is no longer allowed for objects
**2014-12-18** <span style="background: #ebf2fb;color: #1878e0;text-transform: none;letter-spacing: 1px;font-weight: 500;border-radius: 100px;padding: 6px 16px;font-size: 14px;">Sunsetted</span>
- removed concept of packaging
- signatory is now a required field when creating a bank account
- bank_code is no longer an allowed field when creating a bank account
- service_id parameter replaced by service parameter in /jobs
- setting_id parameter replaced by setting parameter in /objects
- name: Webhooks
x-traitTag: true
description: |
Webhooks are an easy way to get notifications on events happening asynchronously
within Lob's architecture. For example, when a postcard gets a "Processed For
Delivery" tracking event, an event object of type `postcard.processed_for_delivery`
will be created. If you are subscribed to that event type in that Environment
(Test vs. Live), Lob will send that event to any URLs you've specified via an
HTTP POST request. In Live mode, you can only have as many webhooks as allotted
in your current [Print & Mail Edition](https://dashboard.lob.com/#/settings/editions).
There is no limit in Test mode.
You can view and create [webhooks](https://dashboard.lob.com/#/webhooks) on the
Lob Dashboard, as well as view your [events](https://dashboard.lob.com/#/events).
See our [Webhooks Integration Guide](https://lob.com/guides#webhooks_block) for more
details on how to integrate. Please see the full list of event types available for
subscription here.
- name: Zip Lookups
description: >
Find a list of cities, states and associated information about a US ZIP code.
x-tagGroups:
- name: Overview
tags:
- Introduction
- Authentication
- Getting Started
- SDKs and Tools
- name: Address Book
tags:
- Addresses
- National Change of Address
- name: Print and Mail API
tags:
- Postcards
- Self Mailers
- Letters
- Checks
- Bank Accounts
- Templates
- Template Versions
- Template Design
- Manage Mail
- name: Address Verification API
tags:
- US Verifications
- US Verification Types
- US Autocompletions
- Reverse Geocode Lookups
- Zip Lookups
- Intl Verifications
- name: Webhooks
tags:
- Webhooks
- Events
- Tracking Events
- name: Special Features
tags:
- Billing Groups
- Cards
- Card Orders
- name: Appendix
tags:
- Beta Program
- Errors
- Rate Limiting
- Requests and Responses
- Test and Live Environments
- Versioning and Changelog
components:
securitySchemes:
basicAuth:
type: http
scheme: basic
security:
- basicAuth: []
x-webhooks:
events:
post:
summary: Events
description: Information about an event
operationId: event
tags:
- Events
responses:
"200":
$ref: resources/events/responses/events.yml
tracking_events:
post:
summary: Tracking Events
description: Information about tracking events
operationId: tracking_event
tags:
- Tracking Events
responses:
"200":
$ref: shared/resources/tracking_events/responses/tracking_events.yml
paths:
/addresses:
$ref: resources/addresses/addresses.yml
/addresses/{adr_id}:
$ref: resources/addresses/address.yml
/bank_accounts/{bank_id}/verify:
$ref: resources/bank_accounts/bank_account_verify.yml
/bank_accounts/{bank_id}:
$ref: resources/bank_accounts/bank_account.yml
/bank_accounts:
$ref: resources/bank_accounts/bank_accounts.yml
/billing_groups/{bg_id}:
$ref: resources/billing_groups/billing_group.yml
/billing_groups:
$ref: resources/billing_groups/billing_groups.yml
/bulk/us_verifications:
$ref: resources/bulk_us_verifications/bulk_us_verifications.yml
/bulk/intl_verifications:
$ref: resources/bulk_intl_verifications/bulk_intl_verifications.yml
/cards:
$ref: resources/cards/cards.yml
/cards/{card_id}:
$ref: resources/cards/card.yml
/cards/{card_id}/orders:
$ref: resources/cards/card_orders/card_orders.yml
/checks/{chk_id}:
$ref: resources/checks/check.yml
/checks:
$ref: resources/checks/checks.yml
/intl_verifications:
$ref: resources/intl_verifications/intl_verifications.yml
/letters/{ltr_id}:
$ref: resources/letters/letter.yml
/letters:
$ref: resources/letters/letters.yml
/postcards/{psc_id}:
$ref: resources/postcards/postcard.yml
/postcards:
$ref: resources/postcards/postcards.yml
/self_mailers/{sfm_id}:
$ref: resources/self_mailers/self_mailer.yml
/self_mailers:
$ref: resources/self_mailers/self_mailers.yml
/templates/{tmpl_id}/versions/{vrsn_id}:
$ref: resources/templates/template_versions/template_version.yml
/templates/{tmpl_id}/versions:
$ref: resources/templates/template_versions/template_versions.yml
/templates/{tmpl_id}:
$ref: resources/templates/template.yml
/templates:
$ref: resources/templates/templates.yml
/us_autocompletions:
$ref: resources/us_autocompletions/us_autocompletions.yml
/us_reverse_geocode_lookups:
$ref: resources/reverse_geocode_lookups/reverse_geocode_lookups.yml
/us_verifications:
$ref: resources/us_verifications/us_verifications.yml
/us_zip_lookups:
$ref: resources/zip_lookups/zip_lookups.yml