JS connector
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
mkdir js-connector
Use git to clone the connector repository:
- shell
git clone https://github.com/passwork-me/js-connector.git .
Install the project dependencies listed in the package.json file:
- shell
npm install
API key
Perform the following steps:
- Authorise in the desktop version of Passwork;
- Go to Settings and Users → API Settings;
- Enter your password and get the API key.

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
const Passwork = require('./src/passwork-api');
/** @type PassworkAPI */
const passwork = new Passwork("https://passwork/api/v4");
(async () => {
await passwork.login("api-key");
// or expect passwork.login("api-key", "master password"); if you are using client-side encryption
// Specify requests to Passwork
await passwork.logout();
})();
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
const Passwork = require('./src/passwork-api');
const passwork = new Passwork("https://passwork/api/v4");
(async () => {
await passwork.login("api-key");
let password = await passwork.getPassword("password-id");
await passwork.logout();
})();