Send a Fax
Use this endpoint for the Fax method to send a Fax.
Parameters
Parameter | Description |
---|---|
MediaUrl Required | The URL to the PDF used for the fax's media. |
To Required | The phone number, in E.164 format, the fax will be sent to. |
From required | The phone number, in E.164 format, the fax will be sent from. |
Quality Optional | The quality of the fax. Default is fine . |
StatusCallback Optional | The URL to send a POST request when the status of a fax changes. See StatusCallback Parameters for parameters. |
Ttl Optional | The number of minutes, after a fax was initiated, SignalWire should wait before attempting to send a fax. |
Request
- cURL
- Node.js
- C#
- Python
- Ruby
curl https://example.signalwire.com/api/laml/2010-04-01/Accounts/{AccountSid}/Faxes.json \
-X POST \
--data-urlencode "From=+13103383454" \
--data-urlencode "To=+13104456789" \
--data-urlencode "MediaUrl=https://example.com/fax.pdf" \
-u "YourProjectID:YourAuthToken"
const { RestClient } = require('@signalwire/compatibility-api')
const client = RestClient('YourProjectID', 'YourAuthToken', { signalwireSpaceUrl: 'example.signalwire.com' })
client.fax.faxes
.create({
from: '+13103383454',
to: '+13104456789',
mediaUrl: 'https://example.com/fax.pdf'
})
.then(fax => console.log(fax.sid))
.done();
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Fax.V1;
class Program
{
static void Main(string[] args)
{
TwilioClient.Init("YourProjectID", "YourAuthToken", new Dictionary<string, object> { ["signalwireSpaceUrl"] = "{SPACE}.signalwire.com" });
var fax = FaxResource.Create(
from: "+13103383454",
to: "+13104456789",
mediaUrl: new Uri("https://example.com/fax.pdf")
);
Console.WriteLine(fax.Sid);
}
}
from signalwire.rest import Client as signalwire_client
client = signalwire_client("YourProjectID", "YourAuthToken", signalwire_space_url = 'example.signalwire.com')
fax = client.fax.faxes \
.create(
from='+13103383454',
to='+13104456789',
media_url='https://example.com/fax.pdf'
)
print(fax.sid)
require 'signalwire/sdk'
@client = Signalwire::REST::Client.new 'YourProjectID', 'YourAuthToken', signalwire_space_url: "example.signalwire.com"
fax = @client.fax.faxes
.create(
from: '+13103383454',
to: '+13104456789',
media_url: 'https://example.com/fax.pdf'
)
puts fax.sid
Responses
200 OK
{
"account_sid": "b3877c40-da60-4998-90ad-b792e98472ac",
"api_version": "v1",
"date_created": "2018-11-26T20:00:00Z",
"date_updated": "2018-11-27T20:00:00Z",
"direction": "outbound",
"from": "+13103383454",
"media_url": "https://example.com/fax.pdf",
"media_sid": "b3877c40-da60-4998-90ad-b792e98472me",
"num_pages": null,
"price": null,
"price_unit": null,
"quality": null,
"sid": "b3877c40-da60-4998-90ad-b792e98472fx",
"status": "canceled",
"to": "+13104456789",
"duration": null,
"links": {
"media": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472ac/Faxes/b3877c40-da60-4998-90ad-b792e98472fx/Media"
},
"url": "/api/laml/2010-04-01/Accounts/b3877c40-da60-4998-90ad-b792e98472ac/Faxes/b3877c40-da60-4998-90ad-b792e98472fx"
}
StatusCallback Parameters
The StatusCallback
request contains the following parameters:
Parameter | Description |
---|---|
RemoteStationId Optional | The transmitting subscriber identification (TSID) reported by the fax machine that sent in the fax. |
FaxStatus Optional | The status of the fax. |
OriginalMediaUrl Optional | The original URL passed when a fax is sent. |
NumPages Optional | The number of pages received from a successful fax. |
MediaSid Optional | The SID that uniquely identifies the fax media. |
MediaUrl Optional | The media URL to request to retrieve incoming media. |
ErrorCode Optional | The error code provides more information on a failed fax. |
ErrorMessage Optional | The message explaining the reason for fax failure. |