Administration
Work with API

JS connector

5min

The Passwork API allows you to retrieve, create and update passwords, folders and vaults. It is an easy way to integrate Passwork into your infrastructure. The API works on behalf of the user for whom the API key is used.

Installation example

Create a directory to clone the repository:

shell


Use git to slope the connector repository:

shell


Install the project dependencies listed in the file — package.json:

shell


API key

Perform the following steps:

  • Authorise in the Passwork web interface;
  • Go to "Settings and Users" → "API Settings";
  • Enter the user password and get the API key.
Document image


To work with APIs, it is important to ensure the security of the API key. It should be kept secret and not shared with third parties. To get a temporary API token, use the login(...) method. This token is valid for the duration of the session, i.e. as long as requests to the API are made. When the token expires, you need to log in again to generate a new one. The lifetime of the token can be configured in Passwork. This allows you to adjust how long the token will be valid. Once received, the token is stored and automatically passed in HTTP request headers, making it easy to work with the API.

Check for all available API methods in Passwork.

Examples

Open session:

js


The session is valid for 10 minutes (can be changed). Thus, you can perform multiple actions within one session without logging in.

Obtain a password using the ID:

js