Finn Python SDK
Python client for the Finn API (https://api.hirefinn.ai/v1): calls, Finns,
voices, phone numbers, audiences, campaigns, wallet, do-not-call, CRM records, Operator cases, approvals, agents and
chat.
- Sync (
Finn) and async (AsyncFinn) clients on httpx, the only dependency. - Typed: every request body, query parameter and response in the spec is a
TypedDict(finn.types), generated from the API's OpenAPI spec. - Retries with backoff on network errors, 408, 429 and 5xx, honouring
Retry-After. - Automatic
Idempotency-Keyon spending and outward writes, kept the same across retries. - One iterator over every list style (cursor, offset, page, before).
- Typed exceptions for the API's error shapes; held writes come back as
PendingApproval.
Python 3.9 or newer.
Install
pip install hirefinn # not published yet; until then:
pip install git+https://github.com/Hire-FinnAI/finn-sdk-py.git
The distribution is called hirefinn (the name finn on PyPI belongs to another project); you import finn.
Quickstart
from finn import Finn, is_pending_approval
finn = Finn() # reads FINN_API_KEY; or Finn(api_key="finn_live_...")
# Place a call
call = finn.calls.create({"finn_id": "8f14e45f-...", "to_number": "4155550142", "country_code": "1"})
if is_pending_approval(call):
print("Waiting for a person to approve:", call.approve_url)
outcome = finn.wait_for_approval(call.approval_id)
else:
print(call["data"]["call_uuid"])
# Read one
c = finn.calls.retrieve(call_uuid)
print(c["data"]["status"])
# Every completed call, page by page under the hood
for summary in finn.calls.list_all(status="completed", limit=100):
print(summary["call_uuid"])
# CRM
rec = finn.contacts.create({"kind": "contact", "name": "Ada Lovelace", "phone": "+14155550142"})
finn.contacts.add_note(rec["data"]["id"], {"text": "Asked for a callback on Monday."})
Async:
import asyncio
from finn import AsyncFinn
async def main() -> None:
async with AsyncFinn() as finn:
agents = await finn.agents.list(limit=20)
async for conv in finn.chat.conversations.list_all():
print(conv["id"])
asyncio.run(main())
Use the client as a context manager (with Finn() as finn:) or call finn.close() to release connections.
Client options
| Option | Default | |
|---|---|---|
api_key |
env FINN_API_KEY |
finn_live_... org key, finn_test_... test key, or OAuth finn_oat_... token |
base_url |
https://api.hirefinn.ai/v1 |
|
org |
none | Finn-Org header, for tokens that can use more than one org |
version |
none | Pins the API version (Finn-Version header), e.g. "2026-11-01" |
max_retries |
2 |
Retries after the first attempt |
timeout |
60 |
Seconds per attempt |
auto_idempotency |
True |
Generate Idempotency-Key on spending/outward writes |
max_retry_after |
60 |
Longest Retry-After (seconds) to wait out; longer raises |
default_headers |
none | Sent on every request |
http_client |
new httpx.Client |
Bring your own (proxies, custom transport); the SDK does not close it |
Every method also takes the per-request keyword options idempotency_key, org, version, max_retries,
timeout and extra_headers, which override the client's setting for that call only. extra_headers can never
replace Authorization.
Resources
| Attribute | Methods |
|---|---|
calls |
create, list, list_all, retrieve |
finns |
list, list_all, create, retrieve, update, delete, list_knowledge_base, add_knowledge_base_document, post_call_analysis |
voices |
list, list_all, retrieve |
phone_numbers |
list, list_all, search_available, rent, retrieve, release |
audiences |
list, list_all, create, retrieve, archive, list_contacts, list_all_contacts, add_contacts, remove_contact |
deployments |
list, list_all, create_outbound, create_inbound, retrieve, stop, stop_inbound, analytics |
wallet |
retrieve, list_transactions, list_all_transactions |
do_not_call |
list, list_all, add, remove |
contacts |
list, list_all, create, retrieve, update, timeline, timeline_all, add_note, list_kinds, list_fields |
cases |
list, list_all, retrieve, list_events, start |
approvals |
list, list_all, retrieve, decide, approve, reject, wait |
agents |
list, list_all, create, draft, retrieve, save_draft, validate, test, publish, drive_test |
chat |
list_channels; chat.conversations: list, list_all, start, retrieve, list_messages, list_all_messages, send; chat.contacts: list, list_all, retrieve, update |
Path parameters are positional, the request body is the next positional argument (a dict), and query parameters
are keyword arguments (from is spelled from_). Knowledge-base uploads take files=:
with open("policy.pdf", "rb") as f:
finn.finns.add_knowledge_base_document(finn_id, {"name": "Refund policy"}, files={"file": f})
Anything else, including endpoints newer than this SDK, goes through request (typed by method and path) or
request_with_response (untyped, returns status, headers and request id):
call = finn.request("get", "/calls/{call_uuid}", path_params={"call_uuid": call_uuid})
res = finn.request_with_response("get", "/wallet")
print(res.status, res.request_id, res.idempotent_replayed, res.data)
Retries
Failed attempts are retried up to max_retries times on network errors, 408, 429, 5xx and
409 idempotency_in_progress, waiting Retry-After when the API sends it and otherwise backing off exponentially
(0.5 s, 1 s, 2 s ... up to 8 s, with jitter). A Retry-After longer than max_retry_after raises at once.
Only requests that are safe to repeat are retried: GET, PUT, DELETE, and writes that carry an
Idempotency-Key.
Idempotency keys
The SDK adds a random Idempotency-Key to calls.create, phone_numbers.rent, deployments.create_outbound,
deployments.create_inbound, chat.conversations.start, chat.conversations.send, agents.create and
cases.start, and keeps it across retries. Pass your own to make a retry from your side safe too, or False to
send none:
finn.calls.create(body, idempotency_key=f"order-{order_id}")
finn.calls.create(body, idempotency_key=False)
Errors
Every API error raises finn.FinnError (or a subclass by status: BadRequestError, AuthenticationError,
PaymentRequiredError, PermissionDeniedError, NotFoundError, ConflictError, PayloadTooLargeError,
RateLimitError, InternalServerError). Branch on code, never on the message.
from finn import FinnError, NotFoundError
try:
finn.finns.retrieve(finn_id)
except NotFoundError:
...
except FinnError as e:
print(e.status, e.code, e.message, e.request_id)
print(e.fields) # per-field problems on invalid_request
print(e.required_scope) # on insufficient_scope
print(e.action_url) # dashboard page that fixes it (insufficient_credits, ...)
print(e.retry_after, e.doc_url, e.details)
No HTTP answer at all raises FinnConnectionError (FinnTimeoutError when an attempt timed out).
FinnSdkError is the base of everything the SDK raises.
Approvals
Outward and spending writes from OAuth and MCP callers may be held for a person to approve. They answer HTTP 202,
which the SDK returns as a PendingApproval (approval_id, approve_url, expires_at, action, summary).
finn.wait_for_approval(id) polls until the approval is decided and returns it; for a held request, status ends
as succeeded, failed, declined or expired, and result holds the held request's own answer.
Pagination
list_all(...) methods return a paginator: iterate it for items, .pages() for raw pages, .to_list(limit) to
collect. Async paginators work with async for and await .to_list().
Regenerating from the spec
The spec is vendored in spec/openapi.json. To refresh it from a local checkout of the backend (prod branch):
BACKEND=../hirefinn-web-app-backend ./scripts/pull-spec.sh
# or from a file or URL:
python scripts/generate.py path/or/url/to/openapi.json
scripts/generate.py (standard library only) writes finn/_generated/: TypedDicts for every schema, the
resource classes (grouped by the RESOURCES table in the script) and typed overloads for request(). It fails if
the table names an operation the spec lacks, and lists spec operations the table does not cover.
Development
python3 -m venv .venv && .venv/bin/pip install -e '.[dev]'
.venv/bin/pytest
The tests use httpx.MockTransport and never touch the network; one of them type-checks a sample with mypy.
Releases go to PyPI from a GitHub release via Trusted Publishing; see RELEASING.md.
Metadata
Release files for hirefinn 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hirefinn-0.1.0.tar.gz | 111.8 kB | Without provenance | Details for hirefinn-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hirefinn-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for hirefinn-0.1.0-py3-none-any.whl |
Total release size: 153.9 kB
Release files / hirefinn-0.1.0.tar.gz
| Download URL | hirefinn-0.1.0.tar.gz |
|---|---|
| Size | 111.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3a638af4203c08b23f83d33fac7a4bca626405e725c9c95f9638af9440bd692
|
|
BLAKE2b-256 checksum How to use checksums |
b0edaef6e05eb3792ca0f21e0ea7f9dde0e67222fd548a65f19826b01259235d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / hirefinn-0.1.0-py3-none-any.whl
| Download URL | hirefinn-0.1.0-py3-none-any.whl |
|---|---|
| Size | 42.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8cc9d8e2bd933a4bd44b80bbc80fd91a7fd8142cda4ee63bb25356ac190380ef
|
|
BLAKE2b-256 checksum How to use checksums |
3ce848016ebb5e86786f47926cf70935f5c8145fa6a0bf145bac78972ccd403f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for hirefinn 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.