Administration
Work with API

JS connector

6min

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. Actions performed with an API key will be executed on behalf of the user the API key belongs to.

Installation example

Create a directory you will clone the repository into:

shell


Use git to clone the connector repository:

shell


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

shell


API key

Perform the following steps:

  • Authorise in the desktop version of Passwork;
  • Go to Settings and UsersAPI Settings;
  • Enter your password and get the API key.
Document image


It is important to keep the API key secure. It should not be shared with any third parties. To get a temporary API token, use the login(...) method. Once received, the token is stored and automatically passed in HTTP request headers, making it easy to work with the API. 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 a token can be configured in Passwork settings

Action examples

See all available Passwork API methods

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