Skip to main content

Fax for Agents

faxforagents

The Python client for Fax for Agents, the fax API built for AI agents.

Website · Quickstart · API reference · SDKs · MCP · Dashboard · Pricing · Changelog · GitLab

PyPI version CI MIT licence Python 3.10+

Fax for Agents is a fax API, a hosted MCP server and SDKs built so AI agents can send and receive faxes. It is made by JSB Holdings LLC and built by Synapse.

pip install faxforagents            # the client
pip install "faxforagents[cli]"     # plus the faxforagents command

Python 3.10 or later. Two dependencies, httpx and pydantic.

Quickstart, against the sandbox

A test key (ffa_test_...) reaches the sandbox provider only. No carrier, no cost, nothing leaves the box. The destination number picks the outcome. Keys are created in the dashboard at https://app.faxforagents.com or with POST /v1/api-keys.

import os
from faxforagents import Client

os.environ["FAXFORAGENTS_API_KEY"] = "ffa_test_..."      # or export it in the shell

with Client() as ffa:
    doc = ffa.documents.create(text="Hello from an agent.", filename="hello")
    print(doc.id, doc.page_count, doc.sha256[:12])

    quote = ffa.quotes.create(document_id=doc.id, to="+15550000001")
    print(quote.amount_micro, "micro, expires", quote.expires_at)

    fax = ffa.faxes.create(quote_id=quote.id)              # Idempotency-Key minted for you
    print(fax.id, fax.state)                               # queued, never delivered yet

    fax = ffa.faxes.wait(fax.id)                           # polls until a terminal state
    print(fax.state, fax.pages_sent, fax.evidence)         # delivered, 1, {...}

    for job in ffa.faxes.iter(state="failed"):             # follows next_cursor
        print(job.id, job.failure_code)

The same in async form, with AsyncClient and await on every call.

What the client does for you

  • Every mutating call carries an Idempotency-Key. When you pass none, a uuid4 is minted once per call and reused on every retry, so a retried send never creates a second fax. Pass idempotency_key= to pick your own.
  • 429 and 5xx answers are retried up to three times. Retry-After is honoured. Connection errors and timeouts are retried the same way.
  • Cursor-paginated fax, document, event, approval, inbox, extraction and billing lists have iterators that follow next_cursor.
  • documents.create(text=...), markdown=... or html=... renders on the server. HTML prints with scripts off and no network, inline CSS and data: images only, at most 2 MiB.
  • documents.upload(path) runs the whole upload path for a PDF or an image (PNG, JPG, TIFF): the upload session, the signed PUT with the content type read from the filename, the sha256 check, the document. An image becomes gray letter pages.
  • faxes.wait(fax_id) and approvals.wait(approval_id) poll with a timeout.
  • verify_webhook(secret, headers, body) checks the Standard Webhooks signature on a delivery.
  • Models are pydantic v2, generated from the public OpenAPI document. Money is an integer count of USD micro-units (39000 is $0.039). Timestamps are UTC strings.

For raw HTTP upload completion, send a JSON object even when you omit the checksum.

curl -X POST "https://api.faxforagents.com/v1/uploads/$UPLOAD_ID/complete" \
  -H "Authorization: Bearer $FAXFORAGENTS_API_KEY" \
  -H "Content-Type: application/json" -d '{}'

Resources

Method names are the operationIds of the OpenAPI document, shortened by their resource. The reference at https://faxforagents.github.io/openapi/ names the scope each call needs.

Resource Calls
ffa.identity me, list_api_keys, create_api_key, rotate_api_key, revoke_api_key
ffa.documents create, upload, create_upload, put_upload_content, complete_upload, cancel_upload, list, iter, get, delete, get_validation, get_download, download, list_pages
ffa.quotes create, get
ffa.faxes create, list, iter, get, wait, list_events, list_attempts, get_receipt, cancel
ffa.webhooks list, create, update, delete, rotate_secret, test, list_deliveries, replay_delivery
ffa.events list, iter
ffa.billing balance, list_ledger, iter_ledger, iter_topup_sessions, iter_invoices, settings, top-ups, auto top-ups, budgets, usage, exports, invoices, subscriptions, create_portal_session
ffa.platform capabilities, service_status
ffa.sandbox list_scenarios, create_scenario, create_inbound_fax, reset
ffa.approvals request, request_help, list, iter, get, wait, approve, reject, revoke
ffa.policies list, create, effective, get, update, list_versions, evaluate
ffa.agents list, create, get, update, create_key, activity
ffa.inbox list, iter, get, update, delete, get_download, download
ffa.numbers coverage, inventory, create_order, get_order, list, get, update, release, check_portability, list_port_orders, create_port_order, get_port_order, create_port_out_request, verify_sender
ffa.extractions create, list, iter, get, correct, classify, list_classifications, iter_classifications, get_classification, summarize, list_summaries, iter_summaries, get_summary, list_schemas, create_schema, get_schema
ffa.organizations list, current, update_current, request_data_export, request_data_deletion
ffa.members list, update, remove, list_invitations, invite, revoke_invitation

ffa.request("GET", "/v1/anything") reaches an operation the resources do not cover yet.

States

A fax job is queued, active, partial, failed, unknown or delivered. delivered is written only when the carrier's evidence is on the attempt, and fax.evidence holds it. partial and unknown never retransmit on their own. Whether to resend is a human decision.

Sandbox destinations: +15550000001 delivered, +15550000002 busy then delivered, +15550000003 partial, +15550000004 no answer, +15550000005 unknown, +15550000006 provider timeout, +15550000007 invalid number. Any other +1 number is delivered.

Errors

from faxforagents import APIError, RateLimitedError

try:
    fax = ffa.faxes.create(quote_id=quote.id)
except RateLimitedError as exc:
    print("retry in", exc.retry_after)
except APIError as exc:
    print(exc.code, exc.message, exc.correlation_id)   # quote_expired, insufficient_balance, approval_required

AuthenticationError (401), ScopeError (403), NotFoundError (404), ConflictError (409), PaymentRequiredError (402), InvalidRequestError (400, 422), RateLimitedError (429) and ServerError (5xx) are all APIError. APIConnectionError and APITimeoutError mean the API was not reached.

Approvals

A live send needs either a human approval bound to the quote or a delegated policy that allows it.

req = ffa.approvals.request(quote.id)          # a person is mailed
req = ffa.approvals.wait(req.id)               # pending until they decide
if req.status == "approved":
    fax = ffa.faxes.create(quote_id=quote.id, approval_id=req.id)

An agent's own API key can never approve. ffa.policies.evaluate(quote_id=...) is a dry run that says whether a policy would allow the send.

Webhooks

from faxforagents import verify_webhook, parse_event, SignatureError

try:
    event_id = verify_webhook(secret, request.headers, request.body)
except SignatureError:
    return 400
event = parse_event(request.body)              # event.type is fax.delivered, fax.failed, fax.received...

Verify on the raw bytes. Store event_id to drop a redelivery you already handled. During a secret rotation two signatures arrive for 24 hours and either one verifies.

faxforagents.webhooks.verify is an alias of verify_webhook. Both names accept the same arguments.

The command

export FAXFORAGENTS_API_KEY=ffa_test_...
faxforagents documents upload letter.pdf        # or .png, .jpg, .tiff, .html, .md, .txt
faxforagents fax quote --document doc_... --to +15550000001
faxforagents fax send --quote quote_... --wait
faxforagents fax list --state failed
faxforagents inbox list
faxforagents approvals list --status pending
faxforagents balance
faxforagents sandbox scenario partial --to +12025550100

Every command takes --json for the raw answer.

Prices

Price card launch-v1 is effective from 2026-10-28. $0.039 per page sent, $0.019 per page received. $2 per number per month, $19 per month for the Agent workspace. Sandbox pages cost 0. ffa.platform.capabilities() returns the card in force.

Working on this repository

pip install -e ".[dev,cli]"
pytest -q                                   # unit tests, respx fixtures, no network
FAXFORAGENTS_API_KEY=ffa_test_... pytest -q -m live    # one real sandbox send
python scripts/gen_models.py --check        # models.py matches spec/openapi.yaml
ruff check src tests && mypy src
sh scripts/truthcheck.sh

spec/openapi.yaml contains all schemas from the live API version 1.6.0 document and the existing SDK operations. It also retains earlier public model names and route-documented response additions. To refresh it, merge the live schemas while preserving existing declarations, then run uv run python scripts/gen_models.py. Keep new response fields optional so older payloads and existing callers remain valid. The schema drift test compares every saved schema property with the generated declarations without network access.

Licence

MIT. See LICENSE. Security reports go to hello@faxforagents.com, see SECURITY.md.

Metadata

Release files for faxforagents 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for faxforagents 0.2.5
File Size Uploaded Provenance Actions
faxforagents-0.2.5.tar.gz 93.1 kB With provenance Details for faxforagents-0.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for faxforagents 0.2.5
File Interpreter ABI Platform Actions
faxforagents-0.2.5-py3-none-any.whl Python 3 none any Details for faxforagents-0.2.5-py3-none-any.whl

Total release size: 142.1 kB

Release files / faxforagents-0.2.5.tar.gz

Download URL faxforagents-0.2.5.tar.gz
Size 93.1 kB
Tags Source
SHA-256 checksum
How to use checksums
144cbceada1c83c82508d8cd904b3f40031baa911d8631c0930f5dbf6eb0f8a0
BLAKE2b-256 checksum
How to use checksums
5e19a02c953a74216735874e5ba7eb20afd0dd26d58cd21fef336dfdd30a2c90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / faxforagents-0.2.5-py3-none-any.whl

Download URL faxforagents-0.2.5-py3-none-any.whl
Size 49.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc42fae440c212c93b4e95d6e3f879852fc4c71dc61f136183a5957308d10ab9
BLAKE2b-256 checksum
How to use checksums
d99333abbbb0eee49ff93d2364e32db7d455a542aae4c37d78cb1409fd5e6536
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for faxforagents 0.2.5

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for faxforagents-0.2.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page