Legacy
...
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 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(); })(); more examples