This project is now deprecated and will be removed soon. It is no longer maintained and may contain security vulnerabilities or compatibility issues with newer systems. Please switch to the official Passwork Python connector available at https://github.com/passwork-me/passwork-python for continued support, security updates, and additional features. All future development will happen in the official repository.
Passwork API lets you retrieve, create, update passwords, folders and vaults. It is an easy way how you can integrate Passwork with your infrastructure. Use our Passwork Python Connector to make the integration smoother. The API operates behalf of the user whom API Key is used. Check for all available methods in Passwork API Methods
pip install git+https://github.com/passwork-me/pip-connectorThe following credentials are required for operation:
host: The address of the API server, like https://.../api/v4
api_key: Your API key for authentication, instructions for obtaining below
master_password: Client-side encryption key. Only add it when client-side encryption is enabled
- Sign in to your Passwork
- Menu → API Settings
- Enter your authorization key and generate the API Key
Method login() on instance of PassworkAPI class is used to retrieve a temporary API Token.
An API token is a session token. It is valid as long as you are accessing the API. After it expires, you will need to log in again.
API Token Lifetime can be set up in your Passwork.
The retrieved API token is stored as an instance variable named session_options within the PassworkAPI class and is subsequently sent in an HTTP header.
- Create instance of API connection and open session.
from passwork.passwork_api import PassworkAPI
api = PassworkAPI(
host="https://.../api/v4",
api_key="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
master_password="master_password"
)- Fill data in
search_paramsdict template with searching parameters tosearch_passwordmethod
search_params = {
"query": "test",
"tags": [],
"colors": [],
"vaultId": None,
"includeShared": False,
"includeShortcuts": False,
}- Search password
from passwork.password_crud import search_password
found_passwords = search_password(api, search_params)NOTE password_id must contain the identifier of the target password, in the example a non-existent identifier is specified.
NOTE download_attachments_path is not a required argument, without specifying it, attachments will be saved to downloaded_attachments/{password_id} folder.
- Specify
password_idand get full password info
from passwork.password_crud import get_password
password_id = "0123456789abcdefghijklmn"
download_attachments_path = f"example_folder/{password_id}"
password_full_info = get_password(
api=api,
password_id=password_id,
download_attachments_path=download_attachments_path,
log_pretty_data=False,
)NOTE Without explicitly specifying inbox_password_id information about existing passwords in the inbox will be logged.
NOTE download_attachments_path is not a required argument, without specifying it, attachments will be saved to downloaded_inbox_attachments/{password_id} folder.
- Get full inbox password info
from passwork.password_crud import get_inbox_password
inbox_password_id = "0123456789abcdefghijklmn"
download_attachments_path = f"example_folder/{inbox_password_id}"
inbox_password_full_info = get_inbox_password(
api=api,
inbox_password_id=inbox_password_id,
download_attachments_path=download_attachments_path,
log_pretty_data=False,
)NOTE If vault_id is specified, the password_id variable may be empty.
Without specifying of vault_id, the identifier of the vault where the password with id = password_id is stored will be taken.
The identifiers password_id and vault_id in the example are non-existent.
- Fill data in
password_adding_fieldsdict template. Template is available in add_password function
password_adding_fields = {...}- Add password
from passwork.password_crud import add_password
vault_id = "0123456789abcdefghijklmn"
added_password_info = add_password(
api=api,
password_adding_fields=password_adding_fields,
vault_id=vault_id,
)NOTE password_id must contain the identifier of the target password, in the example a non-existent identifier is specified
- Delete a password by its id
from passwork.password_crud import delete_password
password_id = "0123456789abcdefghijklmn"
delete_password(api=api, password_id=password_id)This project is licensed under the terms of the MIT license.
