Skip to content

mv.faxes

Faxes received on and sent from your numbers. These methods are on mv.faxes, where mv is your client (see the Node.js SDK). Each one returns the response object and throws 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.

mv.faxes.create(body: FaxesCreateData["body"], options?: RequestOptions): Promise<FaxesCreateResponse>

POST /faxes · API reference

Name Type Required Description
body.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).
body.to string yes The destination fax number: an Israeli landline or national number (mobile and international numbers can’t receive faxes here).
body.file object yes The document. JSON requests send it base64; multipart/form-data requests send a file part.
options.headers["MoreVoice-Version"] string no The API version to use for this request. Defaults to the version the API key is pinned to.
options.headers["Idempotency-Key"] string no A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice.
options RequestOptions no idempotencyKey, extra headers and an abort signal: see retries and idempotency.

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.
import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const fax = await mv.faxes.create({
file: {
content_base64: "JVBERi0xLjQKJcfsj6IK",
filename: "referral.pdf",
},
phone_number_id: "pn_7H2kLm9QxR4tYb",
to: "035550199",
});
console.log(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.

mv.faxes.list(query?: NonNullable<FaxesListData["query"]>, options?: RequestOptions): PagedList<FaxesListResponse["data"][number], NonNullable<FaxesListData["query"]>>

GET /faxes · API reference

Name Type Required Description
query.limit integer no How many objects to return, 1–100 (default 20).
query.starting_after string no A cursor (next_cursor) or object ID: return the objects after it (older).
query.ending_before string no A cursor or object ID: return the objects before it (newer).
query.direction string no Only received (inbound) or sent (outbound) faxes.
query.status string no Only faxes in this status.
query.phone_number_id string no Only faxes received on, or sent from, this number of yours.
query.number string no Only faxes to or from this number (any common form): yours or the other party’s.
query.created object no Filter on the creation time: created[gte], created[gt], created[lte], created[lt] (ISO-8601).
options.headers["MoreVoice-Version"] string no The API version to use for this request. Defaults to the version the API key is pinned to.
options RequestOptions no idempotencyKey, extra headers and an abort signal: see retries and idempotency.

A PagedList: await it for the first page, for await it for every item.

import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
for await (const fax of mv.faxes.list()) {
console.log(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.

mv.faxes.retrieve(id: FaxesRetrieveData["path"]["id"], options?: RequestOptions): Promise<FaxesRetrieveResponse>

GET /faxes/{id} · API reference

Name Type Required Description
id string yes A fax ID (fax_…).
options.headers["MoreVoice-Version"] string no The API version to use for this request. Defaults to the version the API key is pinned to.
options RequestOptions no idempotencyKey, extra headers and an abort signal: see retries and idempotency.

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.
import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const fax = await mv.faxes.retrieve("fax_7Hk2Lm9Qp");
console.log(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).

mv.faxes.retrieveDocument(id: FaxesRetrieveDocumentData["path"]["id"], options?: RequestOptions): Promise<FaxesRetrieveDocumentResponse>

GET /faxes/{id}/document · API reference

Name Type Required Description
id string yes A fax ID (fax_…).
options.headers["MoreVoice-Version"] string no The API version to use for this request. Defaults to the version the API key is pinned to.
options RequestOptions no idempotencyKey, extra headers and an abort signal: see retries and idempotency.

Nothing, on success.

import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const data = await mv.faxes.retrieveDocument("fax_7Hk2Lm9Qp");
console.log(data);