Simple Example for Sending a Fax

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.

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.

API Explorer

Another convenient tool for sending faxes is the API Explorer in Console. Just login to your Twilio account, and then select Runtime > API Explorer. From here, you can send a fax using the 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