Administration
Work with API

Python connector

8min

Installation

Your Python version should be 3.10 or higher

Shell


Credentials

The following credentials are required:

  • host — API server address, e.g. https://.../api/v4;
  • api_key — Your API key for authentication (Settings and users API Settings);
  • master_password — Client encryption key. Specify only if client encryption is enabled.

The login() method in an instance of the PassworkAPI class is used to get a temporary API token. The received API token is stored as an instance variable named session_options inside the PassworkAPI class and then sent in an HTTP header. 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 validity period of the API token can be configured in Passwork settings.

Action examples

Creating a session (common step for all operations)

Create an instance of the API connection and open a session:

Python

Python


download_attachments_path is not a required argument, without it attachments will be saved in the downloaded_attachments/{password_id} folder.

Python


If vault_id is specified, the password_id variable can be empty. Parameter description — add_password

Python

Python