Skip to main content
The Telnyx Programmable Fax API lets you send, receive, and manage faxes through a set of easy-to-use HTTP endpoints. In this guide, you’ll learn how to send a fax using the Programmable Fax API in four simple steps.

Step 1: Setting up with Telnyx

Setup a Telnyx account, phone number, and programmable fax application

First, follow our Quickstart guide to create a Telnyx account, phone number, and Fax Application.

Step 2: API authentication

If you already have a Telnyx V2 API Authentication key, skip to Step 3.
  1. In the Telnyx Mission Control Portal , in the left menu bar navigate to ” API Keys ”.
  2. Ensure, API V2 is selected in the horizontal menu bar.
  3. Click “Create API key”
  4. Copy the API key and save it somewhere safe.

Step 3: Send a PDF with the programmable fax API using curl

The Telnyx Programmable Fax API supports PDF files. To initiate sending a fax, we need to send the request to the Telnyx Programmable Fax API endpoint https://api.telnyx.com/v2/faxes. We need to send additional parameters containing authentication information with the request, so Telnyx knows which account to send the fax from and information about the destination and file being sent.
HeaderDescription
media_urlThe URL of the PDF used for the fax’s media.
connection_idThe app ID or connection ID to send the fax with.
toThe fax enabled phone number (in E.164 format), or SIP URI, the fax will be sent to.
fromThe phone number, in E.164 format, the fax will be sent from.
Authorizaton: BearerThe prefix to your API V2 key created in Step 2.
Now that we know what we need to include in our request, we can use a number of different methods to structure and send it. In this example, we are going to use curl straight from the command line. You can also use a client such as Postman to structure your request.
After pasting the above content, Kindly check and remove any new line added
Simply copy the above code into your favorite text editor, paste in your parameters from the table in place of the existing data, and execute the command.

Step 4: Verify HTTP response and receive webhooks

If you have successfully structured your command and the fax has begun sending, the Programmable Fax API will respond with HTTP 202. If you do not receive a HTTP 202 response, double-check your request and try again. Explanations of other response codes can be found in our API reference. Once the request to send the fax has been successfullly received by Telnyx, you should begin receiving a series of webhooks to the URL that you specified in your Fax Application. The webhooks you should receive are:
  • fax.queued
  • fax.media.processed
  • fax.sending.started
  • fax.delivered
  • fax.failed
That’s it! Once you’ve received a fax.delivered webhook, your fax has been delivered to its destinaion.

Webhook examples

On successful delivery

After pasting the above content, Kindly check and remove any new line added

On failed delivery

After pasting the above content, Kindly check and remove any new line added

Media requirements and limits

Telnyx checks each media file of a fax on its own. Word, RTF, and text files are converted to PDF first, and the checks apply to the converted PDF. The checks run after the API responds with HTTP 202 and before any call is placed. If media processing fails, the fax fails and the fax.failed webhook carries one of these failure_reason values:
Failure reasonWhen it happensWhat to do
file_size_limit_exceededThe file is larger than 50,000,000 bytes (50 MB).Reduce the file size, for example by downsampling embedded images.
page_count_limit_exceededThe file has more than 350 pages.Split the document and send it as several faxes.
page_dimension_limit_exceededA PDF page’s width or height is over the current limit of 48 in (3,456 points). The page size is its MediaBox multiplied by its /UserUnit; exactly 48 in is accepted.Scale the pages to a standard paper size, such as Letter or A4.
file_download_failedTelnyx couldn’t download the file.For media_url, check that the URL returns the file. For media_name, check that the uploaded file is still available. Then send the fax again.
file_format_invalidThe file isn’t in a supported format, or Telnyx couldn’t read or convert it.Use a supported file format and check that the file opens.
media_processing_exception, service_unavailableAn internal error occurred while Telnyx processed the media.Send the fax again.
Telnyx sends every page as a portrait fax page 8.5 in wide, so Letter or A4 is recommended. Standard sizes up to A3 and Tabloid are accepted. PDFs built from photos at one pixel per point often exceed 48 in: a 12 MP photo is about 56 × 42 in.

Possible failure reasons

Inspect the failure_reason field in webhook’s payload to debug failed deliveries of your faxes. The possible failure reasons are:
  • account_disabled
  • connection_channel_limit_exceeded
  • destination_invalid
  • destination_not_in_countries_whitelist
  • destination_not_in_service_plan
  • destination_unreachable
  • fax_initial_communication_timeout
  • fax_signaling_error
  • file_download_failed
  • file_format_invalid
  • file_size_limit_exceeded
  • invalid_ecm_response_from_receiver
  • media_processing_exception
  • no_outbound_profile
  • outbound_profile_channel_limit_exceeded
  • outbound_profile_daily_spend_limit_exceeded
  • page_count_limit_exceeded
  • page_dimension_limit_exceeded
  • receiver_call_dropped
  • receiver_communication_error
  • receiver_decline
  • receiver_incompatible_destination
  • receiver_invalid_number_format
  • receiver_no_answer
  • receiver_no_response
  • receiver_recovery_on_timer_expire
  • receiver_unallocated_number
  • service_unavailable
  • user_busy
  • user_channel_limit_exceeded

Where to next?

Continue to our next tutorial to learn how to receive inbound faxes via API.