A Programmable Fax API command is sent with a faxid. The faxid allows a user to communicate to Telnyx the fax the user wants to take an action on.
The Telnys Programmable Fax API supports PDF files. To initiate sending the fax, we need to send the request to the Telnyx Programmable Fax API endpoint https://api.telnyx.com/v2/faxes.
With the request we need to send additional parameters containing authentication information so Telnyx knows which account to send the fax from and information about the destination and file being sent.
|media_url||Authorization: Bearer YOUR_API_KEY|
|connection_id||Authorization: Bearer YOUR_API_KEY|
|to||Authorization: Bearer YOUR_API_KEY|
|from||Authorization: Bearer YOUR_API_KEY|
|Authorization: Bearer||The prefix to your API V2 key created in Step 2.|
Telnyx sends webhooks to update on the status of Programmable Fax. Webhooks will also be sent in response to requests to list and delete faxes.
|Send a fax||fax.queued
When you send a Programmable Fax API Command, you will immediately receive an http response. Responses include, but are not limited to:
|HTTP STATUS CODE||MESSAGE||DESCRIPTION|
|202||OK||The request succeeded.|
|403||Forbidden||The request was valid, however the user is not authorized to perform this action.|
|404||Not Found||The requested resource could not be found.|
|422||Invalid Parameters||The request has invalid parameters.|
To send a fax, send a POST request to the https://api.telnyx.com/v2/faxes endpoint as shown in the example below.
curl -X POST https://api.telnyx.com/v2/faxes \ --data-urlencode "media_url=https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" \ --data-urlencode "connection_id=1232154810234" \ --data-urlencode "to=+13129457420" \ --data-urlencode "from=+19459457421" \ --header "Authorization: Bearer APIAuthKey_fromPortal"
Note: After pasting the above content, Kindly check and remove any new line added