Skip to main content

Keymint Python

A professional, production-ready SDK for integrating with the Keymint API in Python. Provides robust access to all major Keymint features, with type hints and modern error handling.

Features

  • Type hints: Full type hint support for better IDE integration and code safety.
  • Comprehensive: Complete API coverage for all Keymint endpoints.
  • Consistent error handling: All API errors are returned as structured objects or exceptions.
  • Machine Identity: Built-in utilities for hardware fingerprinting and stable installation IDs.

Installation

Add the SDK to your project:

pip install keymint

Usage

import os
from keymint import KeyMint, identity

api_key = os.environ.get('KEYMINT_API_KEY')
product_id = os.environ.get('KEYMINT_PRODUCT_ID')

if not api_key or not product_id:
    raise ValueError('Please set the KEYMINT_API_KEY and KEYMINT_PRODUCT_ID environment variables.')

sdk = KeyMint(api_key)

# 1. Get a stable, unique ID for this machine
host_id = identity.get_or_create_installation_id()

# 2. Create a key authorized only for this machine
result = sdk.create_key({ 
    'productId': product_id,
    'allowedHosts': [host_id]
})

if result and 'key' in result:
    print(f"Created Key: {result['key']}")

Machine Identity

Keymint provides utilities to uniquely identify machines for node-locking:

  • identity.get_or_create_installation_id(): Recommended. Generates a stable UUID anchored to hardware and persists it to ~/.keymint/installation-id.
  • identity.get_machine_id(): Generates a SHA-256 fingerprint based on BIOS UUID, OS machine ID, and MAC address.

API Methods

License Key Management

Method Description
create_key Creates a new license key.
activate_key Activates a license key for a device.
deactivate_key Deactivates a device from a license key.
get_key Retrieves detailed information about a key.
update_key Updates an existing license key.
block_key Blocks a license key.
unblock_key Unblocks a previously blocked license key.
sign_key Signs a key for offline validation using an admin API key.
floating_checkout Checks out a floating license seat.
floating_heartbeat Sends a heartbeat to keep a session alive.
floating_checkin Checks in a session, releasing the seat.

Customer Management

Method Description
create_customer Creates a new customer.
get_all_customers Retrieves all customers.
get_customer_by_id Gets a specific customer by ID.
get_customer_with_keys Gets a customer along with their license keys.
update_customer Updates customer information.
toggle_customer_status Toggles customer active status.
delete_customer Permanently deletes a customer and their keys.

Webhook Verification

Method Description
verify_webhook_signature Verifies the signature of a webhook request payload.

Idempotency

All mutating SDK methods support idempotency keys to safely retry requests in case of network drops. Pass a unique string (recommended: UUID v4) as the optional idempotency_key keyword argument:

result = sdk.create_key({ 
    'productId': product_id,
}, idempotency_key='9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d')

License

MIT

Support

For help, see Keymint API docs or open an issue.

Metadata

Release files for keymint 2.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keymint 2.5.0
File Size Uploaded
keymint-2.5.0.tar.gz 13.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for keymint 2.5.0
File Interpreter ABI Platform
keymint-2.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.8 kB

Release files / keymint-2.5.0.tar.gz

Download URL keymint-2.5.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2371de7d3a0670ef23992cfb810e76eba26290c0c5e4381d13cd08c0fbdd65f5
BLAKE2b-256 checksum
How to use checksums
be345d4314c6024d31b177a9289d6e35b9944fb2fcbc9ac1f971cc9ea7ba5c36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / keymint-2.5.0-py3-none-any.whl

Download URL keymint-2.5.0-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b294278dd45ccb53c980822b0dc5e9f6ff656c09553e6cb0deacc82f963e9d64
BLAKE2b-256 checksum
How to use checksums
dcef716a5133977cb7fc944ae9b685147004919c12fb1664a3ee752cd6c5a1c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.5.0 This release

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page