Rate this page:

Receiving Faxes

We have made the difficult decision to disable Programmable Fax for all accounts on December 17, 2021. For new and inactive accounts, access to Programmable Fax is disabled effective immediately. We recognize the challenges this decision might cause and have provided detailed migration plans to prevent disruptions.

For additional information, and migration plans, please see Fax Support on Twilio. Learn more.

This guide walks through receiving a fax with Twilio Programmable Fax. We include sample code for many web languages and frameworks. For other frameworks (or languages) you can choose to use a helper library or directly respond with TwiML to receive a fax.

To receive a fax, you will require:

  • An Incoming Phone Number configured as a fax number.
    • Note: this will cause the number to be unavailable to receive calls using Programmable Voice
  • A FaxUrl which Twilio will query when a fax is received.

Set Up a Phone Number for Fax

First, ensure that you have an Incoming Phone Number on your account that supports receiving faxes. The number you select should have true for the fax item in the capabilities object. Alternatively, you can check using the console:

If you don't have a fax-capable number, you'll need to first purchase one. You can either use the Available Phone Numbers REST API resource (query with FaxEnabled=true), or Console Phone Numbers Search (/console/phone-numbers/search) (check the box to search for numbers with the Fax capability) to do so.

Next, you need to configure the number's Voice Receive Mode so that the number receives faxes rather than voice calls. Again, you can use the API's Incoming Phone Numbers resource (POST to the instance resource with VoiceReceiveMode=fax) or the Console. If using the Console, select the phone number you want to use from the list, and change the value of the "Accepts" dropdown box to "Faxes":

At this point, the number's VoiceUrl will now behave as its FaxUrl. Again, note that the number will now be unable to receive regular voice calls.

You may also choose to configure an incoming status callback URL in the Fax Status Changes field, to be notified if the transmission was "Received' or had 'Failed'.

Please note, this URL will only be hit if the <Receive> action URL is omitted.

Receiving a Fax with the Twilio Helper Libraries

The following examples show how to receive a fax with common web languages and frameworks and are ready for you to incorporate the code in your application.

If you are not using one of these languages and frameworks:

  • If you are using one of these languages with a different framework, you can use the Twilio helper library in a similar way to receive faxes.
  • If you are using a different language, you can respond to Twilio's request with TwiML to receive the fax. Read beyond the sample code for more details.

        If requesting a fax media file from a web application, you must specify a User-Agent header in your request to Twilio.

        Receiving a Fax with TwiML

        When Twilio receives a call to an incoming phone number that has been configured as a Fax number, we will make an HTTP request to the FaxUrl configured for that number. Your server should respond with TwiML that instructs Twilio how to proceed.

        You can check out the parameters of the TwiML request, as well as the available <Receive> and <Reject> TwiML verbs and their usage in the TwiML documentation.

        Fax Log Storage

        Twilio will store copies of media files for received faxes. The media files are available at the URL specified on the Fax instance resource.

        Log data for each fax will be available via the REST API for 180 days after creation. When old fax records are pruned, Twilio will also delete the media associated with the pruned records. If you wish to delete data before that, you can delete just the media, or the entire resource, including the media.

        Receiving Faxes with Twilio

        Now you've seen how to receive faxes with common web languages and frameworks, as well as pointers if you are using a different framework or language.

        Want to see more advanced features? Next, see the Fax REST API documentation.

        Update on Fax Beta

        We have received feedback from our customers about inconsistent performance when receiving Faxes on Twilio numbers. We have taken this feedback seriously and are actively working to improve the Fax product. We want to make sure that the product we release meets the quality and standards that our customers expect from us.

        Rate this page:

        Need some help?

        We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.


              Thank you for your feedback!

              We are always striving to improve our documentation quality, and your feedback is valuable to us. Please select the reason(s) for your feedback or provide additional information about how we can improve:

              Sending your feedback...
              🎉 Thank you for your feedback!
              Something went wrong. Please try again.

              Thanks for your feedback!

              Refer us and get $10 in 3 simple steps!

              Step 1

              Get link

              Get a free personal referral link here

              Step 2

              Give $10

              Your user signs up and upgrade using link

              Step 3

              Get $10

              1,250 free SMSes
              OR 1,000 free voice mins
              OR 12,000 chats
              OR more