Skip to content

client.faxes

Faxes received on and sent from your numbers. These methods are on client.faxes, where client is a MoreVoice client (see the Python SDK). On AsyncMoreVoice the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.

Send a fax. Sends a PDF (up to 10 MB and 50 pages) from one of your fax numbers, as multipart/form-data (a file part) or as JSON with the file base64. The fax is queued and sent over the number’s own line; a busy or dropped line is tried again (up to 3 tries). Follow it with GET /v1/faxes/{id} or the fax.sent / fax.failed events. A number whose line can’t carry fax right now answers 409 (details.readiness). Needs a live key.

client.faxes
def create(self, body: _m.FaxSendParamsInput | _m.FaxesCreateFilesBody | Mapping[str, Any] | Unset = UNSET, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.Fax

client.faxes.create() · await async_client.faxes.create() · POST /faxes · API reference

Field Type Required Description
phone_number_id string yes The number of yours that sends it (fax must be turned on for it, on a line that carries fax).
to string yes The destination fax number: an Israeli landline or national number (mobile and international numbers can’t receive faxes here).
file object yes The document. JSON requests send it base64; multipart/form-data requests send a file part.

Fax:

Field Type Description
object "fax" Always fax.
id string A fax ID (prefix fax_).
livemode boolean true in live mode, false in test mode.
direction "inbound" | "outbound" inbound: received on one of your fax numbers. outbound: sent from one.
status "queued" | "sending" | "receiving" | "received" | "delivered" | "failed" | "cancelled" Received faxes: receiving → received | failed. Sent faxes: queued → sending → delivered | failed (a busy or dropped line is tried again, up to max_attempts); queued → cancelled.
phone_number_id string | null Your number it was received on or sent from; null once that number was released.
local_number string Your number (E.164) at the time of the fax.
remote_number string The other party: the sender of a received fax, the destination of a sent one.
remote_station_id string | null The station id (TSI / CSID) the far fax machine announced.
pages integer Pages received, or pages of the document sent.
attempts integer Sent faxes: tries made so far.
max_attempts integer Sent faxes: the most tries it gets.
next_attempt_at string | null Sent faxes waiting (queued): when the next try starts.
has_document boolean The PDF can be downloaded (GET /v1/faxes/{id}/document).
file_name string Sent faxes: the uploaded file’s name.
size_bytes integer Size of the PDF in bytes.
error_code "busy" | "no_answer" | "rejected" | "not_a_fax" | "line_failed" | "transmission" | "no_line" | "converter_unavailable" | … | null Why the fax failed: busy, no_answer, rejected (the far machine refused it), not_a_fax (no fax machine answered), line_failed, transmission, no_line (the number has no line that carries fax), converter_unavailable, flag_off, cancelled, timeout or number_gone.
call_id string | null When the fax arrived on a voice call (fax tone detection on a voice number): that call.
created string An ISO-8601 timestamp in UTC.
completed_at string | null When it was received, delivered, failed or cancelled.
from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
fax = client.faxes.create({
"file": {
"content_base64": "JVBERi0xLjQKJcfsj6IK",
"filename": "referral.pdf",
},
"phone_number_id": "pn_7H2kLm9QxR4tYb",
"to": "035550199",
})
print(fax)

List faxes. Faxes received on and sent from your numbers, newest first. Filter by direction, status, your number (phone_number_id), any number (number) and creation time. Needs a live key.

client.faxes
def list(self, *, limit: int | Unset = 20, starting_after: str | Unset = UNSET, ending_before: str | Unset = UNSET, direction: _m.FaxesListDirection | Unset = UNSET, status: _m.FaxesListStatus | Unset = UNSET, phone_number_id: str | Unset = UNSET, number: str | Unset = UNSET, created: _m.FaxesListCreated | Unset = UNSET, more_voice_version: str | Unset = UNSET) -> AsyncPage[_m.Fax]

client.faxes.list() · await async_client.faxes.list() · GET /faxes · API reference

Name Type Required Description
limit integer no How many objects to return, 1–100 (default 20).
starting_after string no A cursor (next_cursor) or object ID: return the objects after it (older).
ending_before string no A cursor or object ID: return the objects before it (newer).
direction "inbound" | "outbound" no Only received (inbound) or sent (outbound) faxes.
status "queued" | "sending" | "receiving" | "received" | "delivered" | "failed" | "cancelled" no Only faxes in this status.
phone_number_id string no Only faxes received on, or sent from, this number of yours.
number string no Only faxes to or from this number (any common form): yours or the other party’s.
created object no Filter on the creation time: created[gte], created[gt], created[lte], created[lt] (ISO-8601).

A page of results (FaxList): data, has_more and next_cursor.

from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
for fax in client.faxes.list():
print(fax)

Retrieve a fax. Returns the Fax object. Answers 404 with the code resource_missing when nothing has this ID in this organisation and mode.

client.faxes
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.Fax

client.faxes.retrieve() · await async_client.faxes.retrieve() · GET /faxes/{id} · API reference

Name Type Required Description
id str yes A fax ID (fax_…).

Fax:

Field Type Description
object "fax" Always fax.
id string A fax ID (prefix fax_).
livemode boolean true in live mode, false in test mode.
direction "inbound" | "outbound" inbound: received on one of your fax numbers. outbound: sent from one.
status "queued" | "sending" | "receiving" | "received" | "delivered" | "failed" | "cancelled" Received faxes: receiving → received | failed. Sent faxes: queued → sending → delivered | failed (a busy or dropped line is tried again, up to max_attempts); queued → cancelled.
phone_number_id string | null Your number it was received on or sent from; null once that number was released.
local_number string Your number (E.164) at the time of the fax.
remote_number string The other party: the sender of a received fax, the destination of a sent one.
remote_station_id string | null The station id (TSI / CSID) the far fax machine announced.
pages integer Pages received, or pages of the document sent.
attempts integer Sent faxes: tries made so far.
max_attempts integer Sent faxes: the most tries it gets.
next_attempt_at string | null Sent faxes waiting (queued): when the next try starts.
has_document boolean The PDF can be downloaded (GET /v1/faxes/{id}/document).
file_name string Sent faxes: the uploaded file’s name.
size_bytes integer Size of the PDF in bytes.
error_code "busy" | "no_answer" | "rejected" | "not_a_fax" | "line_failed" | "transmission" | "no_line" | "converter_unavailable" | … | null Why the fax failed: busy, no_answer, rejected (the far machine refused it), not_a_fax (no fax machine answered), line_failed, transmission, no_line (the number has no line that carries fax), converter_unavailable, flag_off, cancelled, timeout or number_gone.
call_id string | null When the fax arrived on a voice call (fax tone detection on a voice number): that call.
created string An ISO-8601 timestamp in UTC.
completed_at string | null When it was received, delivered, failed or cancelled.
from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
fax = client.faxes.retrieve("fax_7Hk2Lm9Qp")
print(fax)

Download a fax. The fax as a PDF: the pages received, or the document sent. A fax that is still being received, or failed before any page arrived, has none (404).

client.faxes
def retrieve_document(self, id: str, *, more_voice_version: str | Unset = UNSET) -> bytes

client.faxes.retrieve_document() · await async_client.faxes.retrieve_document() · GET /faxes/{id}/document · API reference

Name Type Required Description
id str yes A fax ID (fax_…).

Nothing, on success.

from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
data = client.faxes.retrieve_document("fax_7Hk2Lm9Qp")
print(len(data), "bytes")