Skip to main content

Typed Python SDK for the LicenseKit licensing API

Project description

licensekit-sdk

First-party Python SDK for licensekit.dev.

This package exposes Management, Runtime, and System clients over the LicenseKit licensing API at https://api.licensekit.dev, including reporting and frozen export operations, along with least-privilege scope metadata and Ed25519 runtime-signature verification helpers for activation, validation, metering, and offline-aware license flows.

Why use it

  • Typed ManagementClient, RuntimeClient, and SystemClient surfaces.
  • Runtime signature verification helpers backed by PyNaCl.
  • Least-privilege scope discovery derived from the OpenAPI contract.
  • Hosted and self-hosted support through a configurable base_url.

Links:

Install

pip install licensekit-sdk

Quick Start

from licensekit import (
    ManagementClient,
    PublicKeyStore,
    RuntimeClient,
    SystemClient,
    verify_runtime_result,
)

base_url = "https://api.licensekit.dev"

system = SystemClient(base_url=base_url)
health = system.health()
print(health["data"]["status"])

management = ManagementClient(
    base_url=base_url,
    token="lkm_..."
)

product = management.create_product(
    body={
        "name": "Example App",
        "code": "example-app",
    }
)

runtime = RuntimeClient(
    base_url=base_url,
    license_key="lsk_..."
)

result = runtime.validate_license(
    body={
        "fingerprint": "host-123",
    }
)

public_keys = system.list_public_keys()
verified = verify_runtime_result(
    result,
    PublicKeyStore(public_keys["data"]),
)

print(product["data"]["id"], verified.ok)

Package Shape

  • ManagementClient Uses Authorization: Bearer <token> for /api/v1/... management operations, including /api/v1/activities and /api/v1/reports/....
  • RuntimeClient Uses Authorization: License <license-key> for /api/v1/license/... runtime operations.
  • SystemClient Unauthenticated access to /health, /healthz, /readyz, /metrics, and /api/v1/system/public-keys.

Hosted deployments should prefer /health for liveness checks behind api.licensekit.dev. /healthz remains available for local and self-hosted compatibility.

Scope Metadata

from licensekit import get_required_scopes, has_required_scopes

scopes = get_required_scopes("createProduct")
allowed = has_required_scopes("createProduct", ["product:write"])

Raw Response Access

Each client exposes a .raw companion for callers that need status codes and headers.

from licensekit import SystemClient

system = SystemClient(base_url="https://api.licensekit.dev")
ready = system.raw.readyz()

print(ready.status, ready.data["data"]["status"])

management.download_report_export() returns raw bytes so JSON, CSV, and PDF report snapshots can be handled without assuming a single response shape. Use management.raw.download_report_export() when you also need the response headers to branch on Content-Type.

Development

python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
python scripts/generate_from_openapi.py
pytest
python -m build
python -m twine check dist/*

Generation uses the checked-in OpenAPI snapshot at openapi/openapi.yaml.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

licensekit_sdk-1.0.0.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

licensekit_sdk-1.0.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file licensekit_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: licensekit_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for licensekit_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2f94261e6d48450fbec8f20a40752d4612570a7d0e90e3587790bdf723c922b4
MD5 72f66a83b3172ed3c814d264b457ca81
BLAKE2b-256 1611e2722e5cee891c8c4a9546bdf769c13ecb5bc50d3b42de81fd4617d9803b

See more details on using hashes here.

Provenance

The following attestation bundles were made for licensekit_sdk-1.0.0.tar.gz:

Publisher: sdk-release.yml on drmain1/open_license

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file licensekit_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: licensekit_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for licensekit_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7977d2b6fa88ce8ad4eee15cd535cbed6db6654351f386b7276b9bdb550248c3
MD5 8185e460f41346065648b07c4996bcfe
BLAKE2b-256 8ed560e2be4ebbcbbbbb3717cd947511395e0306546387ac806129d97e2074fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for licensekit_sdk-1.0.0-py3-none-any.whl:

Publisher: sdk-release.yml on drmain1/open_license

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page