Simple Example for Sending a Fax

Notice: Twilio Programmable Fax will be disabled for all users on December 17, 2021. New and inactive accounts will lose access as of December 17, 2020. For full details, including migration options, see Fax Support on Twilio.

To send a fax, your application needs to make an HTTP POST request to Twilio’s Fax List REST API resource with three required pieces of information; A recipient, a sender, and some content.

  • Recipient: The To parameter consisting of the destination phone number (using E.164 formatting), or fax-capable SIP URI.
  • Sender: The From parameter consisting of a valid Twilio phone number (using E.164 formatting), or a verified outgoing caller ID.
  • Content: The MediaUrl parameter consisting of the URL of the .PDF file you wish to send.

Note: Files sent via fax must be accessible by Twilio's proxy servers. Local files on your desktop are likely unaccessible via these methods, but they may be uploaded to Twilio Assets for sending.

Here’s an example cURL script:

curl -X POST \
--data-urlencode "To=+13105555555" \
--data-urlencode "From=+12125551234" \
--data-urlencode "MediaUrl=" \

This example will transmit the file contract.pdf from the sender (212) 555-1234 (+12125551234) to the fax machine at (310) 555-5555 (+13105555555). To make this script work for you, make the following updates, and then paste it into a terminal window:

  • Line 2 update with a valid destination
  • Line 3 update with a valid sender number
  • Line 4 update with a valid file url
  • Line 5 update with your Account SID and Auth Token.

API Explorer

Another convenient tool for sending faxes is the API Explorer in Console. From here, you can send a fax using easy to update fields and drop-down menus. You can even see the code change in real-time as your adjust the parameters. Click here to try it yourself: API Explorer Create a Fax.

Additional Resources

Have more questions? Submit a request
Powered by Zendesk