INeedToSendAFax Python SDK
Official Python client for the INeedToSendAFax API. Send faxes, track delivery, and verify webhook callbacks.
- Synchronous
ClientandAsyncClient - Typed models and exceptions
- Automatic idempotency keys and retries
- Constant-time webhook signature verification
Install
pip install ineedtosendafax
Quick start
Grab an API key from api.ineedtosendafax.com and set it as IFAX_API_KEY, or pass it to the client.
from ineedtosendafax import Client
client = Client() # reads IFAX_API_KEY
fax = client.send_fax("15551234567", ["invoice.pdf"])
print(fax.id, fax.status) # -> queued
Async
import asyncio
from ineedtosendafax import AsyncClient
async def main():
async with AsyncClient("ifx_live_...") as client:
fax = await client.send_fax("15551234567", ["invoice.pdf"])
print(fax.id)
asyncio.run(main())
Sending a fax
send_fax accepts PDF, Word (DOC/DOCX), PNG/JPEG, PostScript, and TIFF, up to 10 combined files and 32 MB each. Files can be paths, bytes, (name, data) tuples, or file objects.
fax = client.send_fax(
"15551234567",
["report.pdf", ("appendix.pdf", open("appendix.pdf", "rb"))],
callback_url="https://example.com/fax-webhook",
cover=True,
cover_text="Confidential",
sender_name="Acme Billing",
recipient_name="Dr. Smith",
)
Tracking status
fax = client.get_fax("b1a2c3d4-...")
# fax.status is "queued", "sending", "sent", or "failed".
listing = client.list_faxes(limit=50) # listing.data, listing.balance_cents
account = client.me() # account.balance_cents, account.max_pages, ...
price = client.pricing() # price.price_cents, ...
Verifying webhooks
When you set callback_url, we POST the final status with an X-Fax-Signature header. Verify it against the raw request body with your webhook signing secret.
from ineedtosendafax import verify_webhook, SignatureVerificationError
def handle(request):
try:
event = verify_webhook(
secret,
request.headers["X-Fax-Signature"],
request.get_data(), # raw, unmodified bytes
)
except SignatureVerificationError:
return "bad signature", 401
print(event.id, event.status)
verify_webhook uses a 5 minute replay window by default and a constant-time comparison. Pass tolerance=0 to disable the timeout check.
Retries and idempotency
The client retries 429 and 5xx responses and network errors with backoff, honoring Retry-After. send_fax always sends an Idempotency-Key (generated when you do not provide one), so a retried send never delivers a fax twice.
client = Client("ifx_live_...", timeout=90, max_retries=3)
Errors
All non-2xx responses raise a subclass of APIError:
from ineedtosendafax import (
AuthenticationError,
InsufficientCreditsError,
NotFoundError,
RateLimitError,
ValidationError,
ServerError,
)
Each carries .status_code, .code, .message, and .retry_after.
License
MIT
Metadata
Release files for ineedtosendafax 1.0.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 | |
|---|---|---|---|
| ineedtosendafax-1.0.0.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ineedtosendafax-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.5 kB
Release files / ineedtosendafax-1.0.0.tar.gz
| Download URL | ineedtosendafax-1.0.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f6d70c8b7300e0ae92e76b8edf0d2dd209eb7015f3cfbde8ac07064ff308b66
|
|
BLAKE2b-256 checksum How to use checksums |
44f1ebe5f139271591f45c016fdad7aadb2e5631ecdced4693335f16805be799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / ineedtosendafax-1.0.0-py3-none-any.whl
| Download URL | ineedtosendafax-1.0.0-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd6858dd941d8d14ea23955bc347d57f1a820efcd1a65a40a49eaf221389712a
|
|
BLAKE2b-256 checksum How to use checksums |
ea55198b71a8917f22d3b0ff95e40cb2b852dfcc34c98a790941aeecef1042f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|