Postman & similar tools
Last updated
Last updated
Postman is a great way for developers to get started on using Lob’s APIs. Our public workspace allows you and your team to collaborate and make sure you have everything you need to get familiar with Lob’s APIs.
Watch the video below for an overview or read through the tutorial below.
The following will guide you through the process of using Postman to create and test requests for Lob's API and then export the source code in your chosen programming language.
Lob provides an API for automating the sending of postcards, letters, checks, and more. With the help of Postman, we can easily test Lob's API endpoints, understand their behavior, and assist with the development of a custom Lob integration by exporting source code in any modern programming language.
Your Lob API key - Can be located under Account settings in your Lob dashboard
Once you’ve downloaded Postman, follow the installation instructions and launch the app once it’s ready.
Click on the "New" button located in the top left corner of the application.
From the modal that appears, select "HTTP".
Once you’ve configured your request using the instructions below, you can used the “Save” button to select a name and save the request to a collection.
You will see a new tab open in Postman.
From the dropdown menu on the left of the URL bar, select the required HTTP method (GET, POST, DELETE, etc.).
Input the desired Lob API endpoint into the URL field (e.g., https://api.lob.com/v1/postcards
).
To authenticate, click on the Authorization tab below the URL field. Choose “Basic Auth” ****from the Type dropdown menu. In the Username field, enter your Lob API key, leave the Password field blank.
Depending on the request type, you may need to include additional information. For example, for POST requests, navigate to the "Body" tab, select "raw" and choose "JSON" from the dropdown menu (defaulted to “Text”). Here, you can input the data for your request in JSON format.
For fields that are intended to accept only string values, submitting JSON objects in string format (stringified JSON objects) is not supported. Our system automatically parses and validates incoming data according to their expected types. As a result, providing a stringified JSON object in a field designated for string input can cause parsing errors or lead to unexpected validation results.
If you’d like to send a file in your API request (for example, a PDF file), you can do so by following the instructions below. If you do not need to send a file (e.g. if you are not sending a POST request or you are using HTML templates), you can skip this step.
a. Select the “Body” tab and toggle into “form-data”.
b. From here, you should see a table with columns labelled “Key”, “Value”, and “Description”. In the first empty row, hover on the “Key” field cell to display a dropdown selector with the default datatype option “Text” selected. Click on this dropdown and select “File”.
c. You should se a button labelled “Select Files” appear in the “Value” field cell. Click this button to open the file browser and select the file you’d like to send.
d. Ensure the “Key” cell contains the value “file” (if creating a letter) or “front”/”back” (If creating a postcard or self-mailer).
Click on the blue "Send" button to the right of the URL bar.
The response will be displayed in the section below the request fields.
You can review the status, time, size, and headers of the response.
Click on the "Code" button located on the far right side (it should look like an empty HTML tag, i.e., ”</>”).
In the Code snippets panel that appears, select your preferred language from the dropdown on the left side.
The right side will display the request code in the selected language.
Click "Copy snippet" or manually select and copy the code.
That’s all you need to test requests for Lob's API, and export the source code in your chosen programming language!
Postman can be an invaluable part of your API development and testing workflows. Always refer to the Lob API documentation for any API-specific information and requirements.
Usage
cURL is used in command lines or scripts to transfer data. We've included cURL code snippets in our documentation for each resource. By including your API key, you can run these commands from the terminal and see the response from Lob's API.
Explore Lob's API documentation for more cURL examples.