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, 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.
  • 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"])

Development

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

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-0.1.0a1.tar.gz (25.4 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-0.1.0a1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file licensekit_sdk-0.1.0a1.tar.gz.

File metadata

  • Download URL: licensekit_sdk-0.1.0a1.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for licensekit_sdk-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 d9a1a8fb7d7c8972edc07e5b5c1246fbb6134bfc127526a52d280197e7c0b654
MD5 3fa8f510788b327de3d061d10a7eacae
BLAKE2b-256 25531151a50fcb5b3f06c2624ecbd588c26ddd6966045a19dbced60ba0e0c11e

See more details on using hashes here.

File details

Details for the file licensekit_sdk-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for licensekit_sdk-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d358ba36189484bae3d86333be6ab97087f0b648034c50e899339ab215ffcb8
MD5 81a0b7d2298157b50f1e8d3e8157df19
BLAKE2b-256 b7672d840d50738df4c0abface91f8fbfd06a4041070a6bc1a017d025e9340a4

See more details on using hashes here.

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