LastPass provides a Postman collection (a group of saved API requests) to assist with building workflows and simplifying admin tasks (such as provisioning, updating, and deleting users). The "LastPass Enterprise API" Postman collection contains commonly used API requests, which you can issue at the click of a button. Once a request has been sent, the response (data you requested, a status message, or an error message) is displayed within the Postman application itself for easy viewing.
Before you begin: Make sure you have downloaded Postman from
https://www.postman.com/downloads/ and installed it on your computer. Alternatively, you can sign up to use the web version of Postman at
https://www.postman.com/.
Note: The example screenshots displayed in this article use the Windows version of Postman.
Import the "LastPass Enterprise API" Postman collection into Postman.
- Download the Postman collection from here: LastPass Enterprise API Postman Collection (ZIP)
- Unzip the file so you have a .json file called LastPass Enterprise API.postman_collection.json.
- Open the Postman application, and select Import.
Result: The Import dialog box pops up.
- On the File tab, select Upload Files.
- Browse your computer and select the unzipped LastPass Enterprise API.postman_collection.json file, then select Open.
- Select Import.
Result: The "LastPass Enterprise API" Postman collection has now been imported into Postman.
In the left navigation, select Collections, and expand LastPass Enterprise API. All the API requests in the collection are displayed.
Set up variables in Postman for your company's account number (CID) and provisioning hash (API secret).
- Retrieve and save your company's account number (CID) and provisioning hash (API secret) from LastPass. To obtain your LastPass account number and provisioning hash, follow instructions in this article: Where can I find the CID (account number) and API secret?
Note: As soon as you navigate away from or refresh the page showing your provisioning hash, it will be gone. Make sure your copy the information while it is visible, and then save it as a secure note in the LastPass vault.
- In Postman, select the "Environment quick look" eye icon
in the top right corner. In the Globals section, select Add.
Result: The Globals table is displayed.
- In the Globals table:
- In the VARIABLE column, in the first row, enter CID.
Note: The variable name is case-sensitive so make sure you enter it exactly as it is indicated here.
- Leave TYPE as default.
- In the INITIAL VALUE column, in the first row, enter your company's account number (CID) that you have just retrieved from LastPass.
- In the Globals table:
- In the VARIABLE column, in the second row, enter ProvisionHash.
Note: The variable name is case-sensitive so make sure you enter it exactly as it is indicated here.
- Leave TYPE as default.
- In the INITIAL VALUE column, in the second row, enter the provisioning hash (API secret) that you have just retrieved from LastPass.
- Select Save, and close the Globals tab.
Result: You have set up variables for your company's account number (CID) and provisioning hash (API secret). From now on, these will be automatically populated in the relevant fields of any API request that you execute from the Postman collection.
Make a test API call to see if everything works as expected.
- In the LastPass Enterprise API collection on the left, select an API request.
Details of the request are displayed on the right. For example, the
Body tab displays the body of your request, including the
cid and
provhash values, which are retrieved from the variables you set up earlier.
- Make any required changes in the body of the request. For example, if you wish to use the "Get User Data" request for testing, change the value of "username" to a known username.
- Click Send.
- To check the response, click the Body tab in the bottom half of the screen.
Depending on the request you issued, you will either get the requested data in the response or information abut the outcome of your request (for example, {"status": "OK"}).
Results: You are now ready to use the "LastPass Enterprise API" Postman collection.