Metadata-Version: 2.5
Name: nixflex
Version: 0.4.2
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
> **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

Copy the whole API key from **API Keys** in your Nixflex dashboard and store it privately in `NIXFLEX_API_KEY`. Pass the value exactly as copied, including its colon. Raw HTTP requests use `https://api.nixflex.com/v1` and the header `Authorization: Bearer <whole key>`. For the SDK or MCP server, use the origin `https://api.nixflex.com`. The client adds `/v1` to requests.

Install with `python -m pip install nixflex`. The SDK requires Python 3.9 or later and uses httpx.

```python
import os
from nixflex import AsyncNixflex, Nixflex

with Nixflex(api_key=os.environ["NIXFLEX_API_KEY"]) as client:
    agents = client.agents.list(limit=1)

async def list_agents():
    async with AsyncNixflex(api_key=os.environ["NIXFLEX_API_KEY"]) as client:
        return await client.agents.list(limit=1)
```

Both clients expose the same resource methods. Await async JSON responses. Use `async for` directly on async streams. File helpers take a path and stream chunks. Set `max_retries=0` if your application handles retries.

## Requests and errors

GET requests retry once by default. Writes make one attempt, including after HTTP 429, a lost reply or a malformed success. If the SDK raises `NixflexOutcomeUnknownError` with `safe_to_retry:false`, inspect the server state before taking further action. Keep raw errors, credentials, customer content, recordings and private integration responses out of logs.

An organisation API key acts with Owner authority. Personal login, invitation acceptance, ownership transfer and account closure require a dashboard session. Use the organisation’s separate signing secret to verify the original webhook body. API-key rotation leaves that signing secret intact.

Omitting an optional field preserves its default. New agents default to dynamic greeting on, a maximum duration of 300 seconds and a silence timeout of 10 seconds. For single calls, use `dynamic_vars` or its non-conflicting alias `variables`. Campaign recipient variables keep their own shape. Supply an SMS sender and use `message_template` and `scheduled_date` for campaigns.

Keep filters and string cursors when paging. Stop when `next_cursor` is null. Call iterators accept page sizes from 1 to 200. Offset pages can change between requests. An integration PUT replaces its configuration. A custom-function PATCH changes only the supplied fields.

A caller lookup can return two different 404 codes. `caller_not_found` means the owned business number has no saved record for that caller. `phone_number_not_found` means the business number is missing or belongs to another account. Both SDKs expose the exact code on `NixflexNotFoundError`. CLI JSON includes `error.status` and `error.code` and exits with status 1.

## Guides

- [Retained booking results and saved outbound requests](https://docs.nixflex.com/ai-tools/call-results). Save the request ID before the first send so you can look up an uncertain outcome.
- [Call history](https://docs.nixflex.com/guides/developer/call-history) and [campaigns](https://docs.nixflex.com/guides/developer/campaigns). Deletion can end running calls. A queued response means cleanup is still pending.
- [Calendar settings](https://docs.nixflex.com/ai-tools/calendar-settings) and [number credentials](https://docs.nixflex.com/ai-tools/number-credentials).
- [Organisations](https://docs.nixflex.com/guides/developer/organisations) and [Knowledge](https://docs.nixflex.com/guides/developer/knowledge).

[Package guide](https://docs.nixflex.com/sdks/python) · Developer contact: dev@nixflex.com
