Send + receive faxes using Twilio’s Fax API and C#

It is not something I do often but every now and then I need to send or receive a fax. I generally search services online and look at different mobile apps. On occasion I have also opted to visit the nearest UPS or FedEx store. The problem I find with online services is that most require a subscription, free ones add their information on the cover page and most mobile apps require credits in the form of in-app purchases. There’s definitely nothing wrong with either of these avenues but I thought how cool it would be to simply write my own. I remembered Twilio has a fax API that is still in beta and decided to code my own. In this post I’ll describe how to build a simple console app to send/receive faxes. Please note this sample is just a proof of concept and doesn’t take security measures into account.


Send/receive faxes using C# console app.


Twilio account & a fax capable phone number

Twilio Account Setup

The first step is to create a Twilio account if you don’t already have one. Once you have your account the next step is to purchase a fax capable phone number. Phone numbers run a $1.00 a month and you’ll pay $0.01/page
(First 100 pages are free) + SIP Trunking minutes for transmission. You can find pricing here.

Searching for a fax capable number.
Example of a fax capable number returned in search.

Creating Console App

The next step is to create our console app. The goal here is to create an app that allows us to send faxes and at the same time receive callbacks from Twilio informing us of Statuses and Incoming faxes.

Install-Package Microsoft.AspNet.WebApi.OwinSelfHost -Version 5.2.7Install-Package Twilio -Version 5.31.3

Sending/Receiving a fax

Now that we configured the project lets start coding.

  • GetFile — called when Twilio retrieves PDF we are faxing out.
  • Sent — called when a fax is incoming, controller then lets Twilio know what action to perform, in this case calling /faxapp/callback/received.
  • Received — called when a fax is received, we’ll download the received PDF from Twilio and store it in the Inbound folder.
Util.cs (DownloadFile)
  1. Setup a webhook url so Twilio can let us know a fax is coming in.
  2. Setup a url so Twilio can send us fax status changes.

Running Console App

When starting FaxApp the Owin API will start listening for requests and console will await user input.


Hope this sample is useful to those seeking an alternate fax solution they can code and modify to their liking. Happy Coding!


Code is available on GitHub:

Principal Software Engineer at Command Health