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
Toparameter consisting of the destination phone number (using E.164 formatting), or fax-capable SIP URI.
- Sender: The
Fromparameter consisting of a valid Twilio phone number (using E.164 formatting), or a verified outgoing caller ID.
- Content: The
MediaUrlparameter 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 https://fax.twilio.com/v1/Faxes \ --data-urlencode "To=+13105555555" \ --data-urlencode "From=+12125551234" \ --data-urlencode "MediaUrl=https://www.mysite.com/docs/contract.pdf" \ -u "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token"
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.
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.