Metadata-Version: 2.5
Name: nixflex
Version: 0.4.1
Summary: Official Python SDK for the Nixflex voice AI platform - AI phone agents, outbound campaigns, SMS and caller context.
Project-URL: Homepage, https://nixflex.com
Project-URL: Documentation, https://docs.nixflex.com/sdks/python
Project-URL: Repository, https://github.com/nixflex/nixflex-python
Project-URL: Changelog, https://github.com/nixflex/nixflex-python/blob/main/CHANGELOG.md
Author-email: Nixflex <dev@nixflex.com>
License: MIT
License-File: LICENSE
Keywords: ai-receptionist,nixflex,phone,sdk,sms,telephony,voice-agent,voice-ai
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Communications :: Telephony
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx<2,>=0.27
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# Nixflex Python SDK — 0.4.0 candidate
> **Building with AI?** Tell your assistant to read https://docs.nixflex.com/ai-rules.md first - the rules for building on Nixflex (safe defaults, costs, what to ask before acting). Full docs: https://docs.nixflex.com

B57 deletion and voice campaign delete: see [B57-DELETES.md](B57-DELETES.md). K9 is an unpublished candidate; one DELETE, never an automatic retry.

Python 3.9+, httpx. Install the approved release using pip install nixflex; local checks use the wheel.

~~~python
import os
from nixflex import Nixflex, AsyncNixflex
with Nixflex(api_key=os.environ["NIXFLEX_API_KEY"]) as client:
    agents = client.agents.list(limit=1)
async def read():
    async with AsyncNixflex(api_key=os.environ["NIXFLEX_API_KEY"]) as client:
        return await client.agents.list(limit=1)
~~~

Sync/async have the same resource methods. Await async JSON; async for streams (no initial await). File helpers accept a path and stream chunks. max_retries=0 disables GET retry when the application owns policy.

## Contract and safety

K1–K5 cover 140 of 141 public inventory operations in Node/CLI/Python. Private signing-secret retrieval is deliberately excluded. Dedicated Knowledge keyterms is additional to the old denominator. Personal login, invite acceptance, ownership transfer and account closure remain dashboard-only.

Only GET has bounded retries (default one). POST/PUT/PATCH/DELETE never automatically repeat, including 429, lost replies or malformed success. NixflexOutcomeUnknownError means outcome unknown and safe_to_retry false: inspect authoritative state before retrying. Never log raw errors, customer content, recordings, credentials or private integration responses.

Ownership, roles and active-account rules remain authoritative, along with refusals actually returned by each route. B57 single-call and campaign deletion ends running calls instead of waiting for settlement; other guarded cleanup routes keep their existing safety rules. Accepted deletion is not proof cleanup finished. API keys act with Owner authority and cannot impersonate a personal member session.

Omitted fields stay omitted. Agent defaults are dynamic greeting true, maximum duration 300 seconds, silence hangup 10 seconds; existing agents are not rewritten. Single-call variables use dynamic_vars; variables is a non-conflicting alias. Campaign recipient variables stay unchanged. SMS requires a sender; campaign message_template and scheduled_date are canonical.

Preserve page filters/string cursors; stop at next_cursor:null. Call iterators use pages 1–200; offset paging is not a snapshot. Integration PUT replaces configuration; custom-function PATCH changes supplied fields.

Webhook verification uses the organisation signing secret, independent of key rotation. Obtain it privately outside kits; verify the raw body before trusting a delivery.

## Method reference

See [METHODS.md](METHODS.md), [KNOWLEDGE.md](KNOWLEDGE.md), [TEAM-INTEGRATIONS.md](TEAM-INTEGRATIONS.md), [ORGANISATIONS.md](ORGANISATIONS.md) and [CHANGELOG.md](CHANGELOG.md). Full API reference: https://docs.nixflex.com.

Unpublished candidates. Offline coverage does not prove successful mutations on staging; those tests remain manual.

## Caller read: missing record versus wrong number

GET /v1/phone-numbers/:phoneNumber/callers/:callerNumber returns HTTP 404 with code caller_not_found when the owned number has no saved record for that caller. HTTP 404 phone_number_not_found means the business number is missing or is not owned by this account; do not treat it as an empty caller record. Generic not_found is not the documented caller-absence response.

Node and Python raise NixflexNotFoundError with status=404 and the exact server code. CLI --json exits 1 and preserves error.status and error.code (it does not serialize a JavaScript exception class). Inspect the code; never swallow all 404s. The K5b staging checker passes its synthetic-caller absence check only for 404 caller_not_found and selects that probe's business number from the authenticated account list, excluding the two protected staging numbers. With no eligible number it reports PENDING and sends no caller request. Never log the key, headers or raw response body.

## K6 additions

Four Google Calendar methods, private number credentials, SMS 409 handling and booking models. Read [NUMBER-FEATURES.md](NUMBER-FEATURES.md) for exact fields, safe errors and recovery. All earlier exclusions remain, except the two explicit K6 MCP additions noted there.

## K7 additions

Read a call’s retained booking result and its saved outbound request. Optional UUID request_id adds duplicate protection without automatic redial. Prepare and save the ID before the first send. See [CALL-REQUESTS.md](CALL-REQUESTS.md) for every state/error and [KIT-EXAMPLES-K7.md](KIT-EXAMPLES-K7.md) for Node, CLI, Python sync/async and MCP examples. Existing no-ID calls keep their old behavior.
