--- id: knockapi version: "1.29.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # knockapi — The official Python library for the knock API License: permissive · Maintenance: active · Downloads: 1.0M/mo ## What it is and what it does knockapi is the official Python client for Knock's REST API, generated by Stainless. It wraps HTTP calls to Knock's notification and workflow service with a typed, object-oriented interface. Both synchronous (Knock) and asynchronous (AsyncKnock) clients are provided, powered by httpx; the async client can optionally use aiohttp for higher concurrency. All request parameters and response fields are typed using TypedDicts and Pydantic models, enabling IDE autocomplete and type checking. The library handles pagination automatically, error classification (connection errors, 4xx/5xx responses), and retries (2x by default for transient failures, 408, 429, and 5xx errors). Responses include helper methods for serialization (to_json, to_dict). It targets developers building notification workflows, triggering campaigns, or managing user data through Knock's API. Use it for: - Trigger notification workflows programmatically from a Python application with typed parameters and response validation. - Build async notification systems using AsyncKnock for high-concurrency environments without blocking I/O. - Iterate over paginated user or message lists automatically without manual page-fetching logic. - Handle API errors with specific exception types (RateLimitError, AuthenticationError, etc.) for granular retry/fallback logic. - Integrate Knock notifications into a Django, FastAPI, or other Python web framework with full type hints for IDE support. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a typed Python client library for the Knock REST API, supporting both synchronous and asynchronous workflows with automatic pagination and comprehensive error handling. Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and is Apache-2.0 licensed. It provides a well-typed, modern Python interface to Knock's API with both sync and async support. Install it if you need to integrate Knock notifications into a Python application. ## Install pip install knockapi uv add knockapi poetry add knockapi ## Installing knockapi Before you install: Low install friction with a pure-Python wheel distribution. The package is actively maintained with a recent release (29 days old) and supports current Python versions (3.9–3.14). Six runtime dependencies are all well-established libraries. License in practice: Licensed under Apache-2.0 (permissive), allowing use in commercial and private projects with minimal restrictions; attribution required. Quickstart: pip install knockapi import os from knockapi import Knock client = Knock(api_key=os.environ.get("KNOCK_API_KEY")) response = client.workflows.trigger( key="dinosaurs-loose", recipients=["dnedry"], data={"dinosaur": "triceratops"}, ) print(response.workflow_run_id) Requires Python 3.9 or later; KNOCK_API_KEY environment variable or explicit api_key parameter needed for authentication. Verify before relying: - Whether the Knock service itself has SLA/uptime guarantees relevant to production use. - Rate-limit behavior and backoff strategy beyond the documented 2x automatic retry default. - Performance characteristics of auto-pagination for large result sets. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags knock api client python, notification service sdk, async http client library, rest api wrapper typed, workflow trigger automation, pydantic typed api client, httpx-based rest client, api-client, async-support, typed-sdk [View on SkillFed](https://skillfed.io/packages/knockapi) · [View on PyPI](https://pypi.org/project/knockapi/)