Faxes Resource

The Faxes resource is the main point of interaction between you and the Fax REST API.

Fax Instance Resource

This resource represents faxes that have been sent or received.

Resource URL

https://fax.twilio.com/v1/Faxes/{FaxSid}

where {FaxSid} is the 34-character unique ID associated with the Fax.

Resource Properties

A Fax instance is represented by the following properties:

Property Description
sid A 34-character unique identifier prefixed with "FX"
account_sid The account that owns the fax instance
from E.164 'From' number - the phone number that originated the fax
to E.164 'To' number - the phone number that received the fax, or a SIP URI
direction Either outbound for a sent fax, or inbound for a received fax
num_pages The number of pages contained in the fax document
duration Time, in seconds, taken to transmit the fax
media_sid A 34-character unique identifier prefixed with "ME" that references the media instance associated with this Fax instance
media_url Twilio-hosted URL that can be used to download media (note that this URL will expire after 2 hours, but a new URL can be fetched from the instance resource)
status One of the Fax Status values
quality One of the Fax Quality values
api_version "v1" for this version of the Fax API
price The price charged for this fax
price_unit The ISO 4217 currency code used to price the fax
date_created An ISO 8601 date and time for when the fax was created
date_updated An ISO 8601 date and time for when the fax was last updated

Fax Status

Value Description
queued The fax is queued, waiting for processing
processing The fax is being downloaded, uploaded, or transcoded into a different format
sending The fax is in the process of being sent
delivered The fax has been successfuly delivered
receiving The fax is in the process of being received
received The fax has been successfully received
no-answer The outbound fax failed because the other end did not pick up
busy The outbound fax failed because the other side sent back a busy signal
failed The fax failed to send or receive
canceled The fax was canceled, either by using the REST API, or rejected by TwiML

Fax Quality

Value Description
standard A low quality (204x98) fax resolution that should be supported by all devices
fine A medium quality (204x196) fax resolution; this quality boasts wide device support
superfine A high quality (204x392) fax resolution; this quality my not be supported by many devices

Subresources

The Fax instance contains one subresource, the Fax Media Resource.

HTTP GET

Retrieves a single Fax instance.

Return Values

Returns 200 with a single Fax instance resource if the FaxSid was found.

Returns 404 if the FaxSid was not found.

Example

Loading Code Samples...
Language
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.fax.v1.faxes('FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa').fetch()
  .then(function(response) {
    console.log(response.sid);
  }).catch((err) => {
    console.log(err)
  });
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Fax.V1;
using Twilio.Types;
using System.Collections.Generic;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        const string faxSid = "FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

        TwilioClient.Init(accountSid, authToken);

        var fax = FaxResource.Fetch(faxSid);

        Console.WriteLine(fax.Sid);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$fax = $client->fax->v1
    ->faxes("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->fetch();

echo $fax->status;
require 'net/http'
require 'json'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

uri = URI('https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')

Net::HTTP.start(uri.host, uri.port,
  :use_ssl => uri.scheme == 'https') do |http|

  request = Net::HTTP::Get.new uri.request_uri
  request.basic_auth account_sid, auth_token

  response = http.request request

  puts JSON.parse(response.body)['media_url']
end
from twilio.rest import Client

# put your own credentials here
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"

fax_sid = "FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

client = Client(account_sid, auth_token)

fax = client.fax.v1.faxes(sid=fax_sid).fetch()

print(fax.sid)
// Install the Java helper library from twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.fax.v1.Fax;
import java.net.URISyntaxException;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) throws URISyntaxException {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        Fax fax = Fax.fetcher("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch();

        System.out.println(fax.getMediaUrl());
    }
}
curl 'https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' \
    -X GET \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
    "status": "busy",
    "direction": "outbound",
    "from": "+15017250604",
    "date_updated": "2017-04-06T06:41:44Z",
    "price": null,
    "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "to": "+15558675309",
    "date_created": "2017-04-06T06:41:32Z",
    "url": "https://fax.twilio.com/v1/Faxes/FX0bc96ef78eae441348874c6998db5a51",
    "sid": "FX0bc96ef78eae441348874c0098db5a51",
    "duration": null,
    "num_pages": 1,
    "quality": "fine",
    "price_unit": null,
    "api_version": "v1",
    "media_url": "https://media.twiliocdn.com/fax/AC7719587dd8553511c99cf14d495da345/f540dd4a36e448636c6a03ea16fef29ca1b6f1c20e80b16ae7538807311c1d77e239b42678ffe13617213ce892b55e1a09b0d4f3db7f01968b587b6c095b343e?x-amz-security-token=FQoDYasdEBgaDDRjH242324BB8SK3A4ex5oEKcNjDtlfxoAdcyA8PGme7Z%2Frj4W7l6Jdeq2342rwerwmkJs4vZ8fllEvQU0xErPz5kIxcOJ7ODOYSu%2Bcsk28Nr0QecoIxaZdZTyCFGxa3rEVXOgNq6M4smzWlxH7VHZpiSHjE8VHMGrB5xY5qygtwN1kSqh%2Bf%2Bg1h2XqPE7w83O2JUfLS23%2FnX9KKJOHtMrwLjLyjvD1AxvlVVzB2815xaLUkPYrOrgVO%2B6kzQlPiwn2jqsTO8TYWezgrVQmo8MyLMwVNrZ7cYrTq3Us3tAHm1nG%2BB7cOHziinet%2FsPqjLOL3cpj8Npm55%2BKvh74SypF6zAeNLKsX%2F2uE6%2FaWRtf1iyjp4zh%2B72qw9RJKjicUxCKCTdIK8rhh%2Fk8Zk1puSThXZnMGX0z9XWlSySisLUBrLh2SJAfqNqyjMnzxGErIV6jzgeMOpxpYk6UYtbFUx%2Ba1X5iEdXDQPUO7v7e6dTF2N%2F4OJdXFgeClzYXFAlKA29KUBGx3mYShOM8VccyqtCG7zhHoYv1%2Fhr%2FBktHNezWAVjGdkAhHm6O6Nl3X%2FnS1cLwz3vouRRKPVlPwfLSopuNn0lfAVYRxYojaKZxwU%3D&AWSAccessKeyId=ASIAIF4A5CFXDRXORVKQ&Expires=1491499879&Signature=pVV8xEzm1%22IyDz%2BSQ2rvoSdQxoA%3D"
}
Retrieve a Single Fax Instance

HTTP POST

Updates a single Fax instance.

Optional Parameters

Parameter Description
Status The only supported value is canceled, and allows you to cancel a queued fax

Return Values

Returns 200 with a single Fax instance resource on success.

Returns 400 if the Status value is not valid or supported.

Returns 404 if the FaxSid was not found.

Returns 409 if the status cannot be updated because the fax has already completed or failed. Note: currently faxes cannot be canceled once sending has begun.

Example

Loading Code Samples...
Language
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.fax.v1
  .faxes('FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
  .update({
    status: 'canceled',
  })
  .then(response => {
    console.log(response.sid);
  })
  .catch(err => {
    console.log(err);
  });
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Fax.V1;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var fax = FaxResource.Update("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            FaxResource.UpdateStatusEnum.Canceled);

        Console.WriteLine(fax.Status);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$fax = $client->fax->v1
    ->faxes("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->update(array("status" => "canceled"));

echo $fax->status;
require 'net/http'
require 'json'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

uri = URI('https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')

Net::HTTP.start(uri.host, uri.port,
  :use_ssl => uri.scheme == 'https') do |http|

  request = Net::HTTP::Post.new uri.request_uri
  request.basic_auth account_sid, auth_token
  request.body = URI.encode_www_form({
    :Status => 'canceled'
  })

  response = http.request request

  puts JSON.parse(response.body)['status']
end
from twilio.rest import Client

# put your own credentials here
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"

client = Client(account_sid, auth_token)

fax = client.fax.v1 \
    .faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
    .update(status="canceled")

print(fax.status)
// Install the Java helper library from twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.fax.v1.Fax;
import java.net.URISyntaxException;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) throws URISyntaxException {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
      
        Fax fax = Fax.updater("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
               .setStatus(Fax.UpdateStatus.CANCELED)
               .update();

        System.out.println(fax.getStatus());
    }
}
curl 'https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' \
    -X POST \
    -d 'Status=canceled'  \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
	"status": "canceled",
	"direction": "outbound",
	"from": "+15017250604",
	"date_updated": "2017-04-06T09:15:48Z",
	"price": null,
	"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	"to": "+15558675309",
	"date_created": "2017-04-06T09:15:38Z",
	"url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
	"sid": "FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
	"duration": null,
	"num_pages": null,
	"quality": "fine",
	"price_unit": null,
	"api_version": "v1",
	"media_url": null
}
Update a Single Fax Instance

HTTP PUT

Not supported.

HTTP DELETE

Deletes this Fax instance and any associated Fax Media instance. Note that this action cannot be undone, so it should be taken with care.

Return Values

Returns 204 if this resource and its subresources were successfully deleted, had been deleted previously, or were not found.

Returns 409 if the Fax instance has not yet moved into a completed state and cannot yet be deleted.

Fax List Resource

The list resource allows you to retrieve a list of faxes sent or received, and to send new faxes.

Resource URL

https://fax.twilio.com/v1/Faxes

HTTP GET

Lists Faxes in the account.

Optional Parameters

Parameter Description
From Return only faxes sent from the specified E.164-formatted number
To Return only faxes received by the specified E.164-formatted number
DateCreatedOnOrBefore Return only faxes created on or before the specified ISO 8601 datetime
DateCreatedAfter Return only faxed created after the specified ISO 8601 datetime

Return Values

Returns 200 with a list resource (under the key faxes) with standard Twilio paging information (the list may be empty if no faxes match the requested filters).

Returns 422 if the From or To parameters are not valid E.164-formatted phone numbers.

Example

Loading Code Samples...
Language
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.fax.v1.faxes.list()
  .then(function(response) {
    console.log(response);
  }).catch((err) => {
    console.log(err)
  });
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Fax.V1;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var faxes = FaxResource.Read();

        foreach (var fax in faxes)
        {
        	Console.WriteLine(fax.MediaUrl);
        }
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$faxes = $client->fax->v1->faxes->read();

foreach ($faxes as $fax) {
    echo $fax->mediaUrl;
}
require 'net/http'
require 'json'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

uri = URI('https://fax.twilio.com/v1/Faxes')

Net::HTTP.start(uri.host, uri.port,
  :use_ssl => uri.scheme == 'https') do |http|

  request = Net::HTTP::Get.new uri.request_uri
  request.basic_auth account_sid, auth_token

  response = http.request request

  JSON.parse(response.body)['faxes'].each do |fax|
    puts fax['media_url']
  end
end
from twilio.rest import Client

# put your own credentials here
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"

client = Client(account_sid, auth_token)

faxes = client.fax.v1.faxes.list()

for fax in faxes:
    print(fax.media_url)
// Install the Java helper library from twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.fax.v1.Fax;
import java.net.URISyntaxException;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) throws URISyntaxException {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        ResourceSet<Fax> faxes = Fax.reader().read();

        for (Fax fax : faxes) {
            System.out.println(fax.getMediaUrl());
        }
    }
}
curl 'https://fax.twilio.com/v1/Faxes' \
    -X GET \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
  "meta": {
    "page": 0,
    "page_size": 50,
    "first_page_url": "https://fax.twilio.com/v1/Faxes?PageSize=50&Page=0",
    "previous_page_url": null,
    "url": "https://fax.twilio.com/v1/Faxes?PageSize=50&Page=0",
    "next_page_url": null,
    "key": "faxes"
  },
  "faxes": [
    {
      "status": "busy",
      "direction": "outbound",
      "from": "+15017250604",
      "date_updated": "2017-04-06T06:41:44Z",
      "price": null,
      "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "to": "+15558675309",
      "date_created": "2017-04-06T06:41:32Z",
      "url": "https://fax.twilio.com/v1/Faxes/FX0bc96ef78eae441348874c6998db5a51",
      "sid": "FX0bc96ef78eae441348874c0098db5a51",
      "duration": null,
      "num_pages": 1,
      "quality": "fine",
      "price_unit": null,
      "api_version": "v1",
      "media_url": "https://media.twiliocdn.com/fax/AC7719587dd8553511c99cf14d495da345/f540dd4a36e448636c6a03ea16fef29ca1b6f1c20e80b16ae7538807311c1d77e239b42678ffe13617213ce892b55e1a09b0d4f3db7f01968b587b6c095b343e?x-amz-security-token=FQoDYasdEBgaDDRjH242324BB8SK3A4ex5oEKcNjDtlfxoAdcyA8PGme7Z%2Frj4W7l6Jdeq2342rwerwmkJs4vZ8fllEvQU0xErPz5kIxcOJ7ODOYSu%2Bcsk28Nr0QecoIxaZdZTyCFGxa3rEVXOgNq6M4smzWlxH7VHZpiSHjE8VHMGrB5xY5qygtwN1kSqh%2Bf%2Bg1h2XqPE7w83O2JUfLS23%2FnX9KKJOHtMrwLjLyjvD1AxvlVVzB2815xaLUkPYrOrgVO%2B6kzQlPiwn2jqsTO8TYWezgrVQmo8MyLMwVNrZ7cYrTq3Us3tAHm1nG%2BB7cOHziinet%2FsPqjLOL3cpj8Npm55%2BKvh74SypF6zAeNLKsX%2F2uE6%2FaWRtf1iyjp4zh%2B72qw9RJKjicUxCKCTdIK8rhh%2Fk8Zk1puSThXZnMGX0z9XWlSySisLUBrLh2SJAfqNqyjMnzxGErIV6jzgeMOpxpYk6UYtbFUx%2Ba1X5iEdXDQPUO7v7e6dTF2N%2F4OJdXFgeClzYXFAlKA29KUBGx3mYShOM8VccyqtCG7zhHoYv1%2Fhr%2FBktHNezWAVjGdkAhHm6O6Nl3X%2FnS1cLwz3vouRRKPVlPwfLSopuNn0lfAVYRxYojaKZxwU%3D&AWSAccessKeyId=ASIAIF4A5CFXDRXORVKQ&Expires=1491499879&Signature=pVV8xEzm1%22IyDz%2BSQ2rvoSdQxoA%3D"
    }
  ]
}
List Faxes on your Twilio Account

HTTP POST

Creates a new Fax instance resource and triggers the sending of a fax.

In addition to regular phone numbers, faxes can also be sent to SIP URIs. For more information, please see Sending Faxes to SIP Destinations.

Required Parameters

Parameter Description
From The E.164-formatted phone number to use as the caller ID
To The E.164-formatted phone number to send the fax to
MediaUrl The HTTP or HTTPS URL where the fax media PDF resides (see our security page for information on how to ensure the request for your media comes from Twilio)

Optional Parameters

Parameter Description
Quality A quality value, which defaults to fine
StatusCallback A status callback URL that will receive a POST when the status of the fax changes
StoreMedia Whether or not to store the sent media in the fax media store (true or false; defaults to true)

Return Values

Returns 201 with a single new Fax instance resource with status queued and a newly-generated FaxSid.

Returns 403 if the From number is not valid for use as a From number, or if the To number is blacklisted or not reachable in accordance with the account's international permissions.

Returns 422 if the From or To parameters are not valid E.164-formatted phone numbers, if the Quality value is not valid, or if any of the MediaUrl or StatusCallback parameters are not well-formed URLs.

Status Callback

The status callback sent to your server by Twilio will be a POST request using the application/x-www-form-urlencoded content type, and will include the following form parameters:

Parameter Description
FaxSid The 34-character unique identifier for the fax
AccountSid The account from which the fax was sent
From The caller ID or SIP From display name
To The phone number or SIP URI of the destination
RemoteStationId The called subscriber identification (CSID) reported by the receiving fax machine
FaxStatus The current status of the fax transmission
ApiVersion The API version used to send the fax, which for this API will be "v1"
OriginalMediaUrl The original URL passed when sending the fax
NumPages The number of pages sent (only if successful)
MediaUrl A media URL on Twilio's servers that can be used to fetch the original media sent. Note that this URL will expire after 2 hours, but a new URL can be fetched from the instance resource
ErrorCode A Twilio error code that gives more information about a failure, if any
ErrorMessage A detailed message describing a failure, if any

Example

Loading Code Samples...
Language
SDK Version:
  • 5.x
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.fax.v1.faxes
  .create({
      to: '+15558675309',
      from: '+15017250604',
      mediaUrl: 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf'
  }).then(function(response) {
    console.log(response.sid);
  }).catch((err) => {
    console.log(err)
  });
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Fax.V1;
using Twilio.Types;
using System.Collections.Generic;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var to = "+15558675309";
        var mediaUrl = new Uri(
            "https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf");

        var fax = FaxResource.Create(to, mediaUrl, from: "+15017250604");

        Console.WriteLine(fax.Sid);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$options = array(
  "from" => "+15017250604"
);
$fax = $client->fax->v1->faxes->create(
    "+15558675309",
    "https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf",
    $options
);

echo $fax->sid;
require 'net/http'
require 'json'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

uri = URI('https://fax.twilio.com/v1/Faxes')

Net::HTTP.start(uri.host, uri.port,
  :use_ssl => uri.scheme == 'https') do |http|

  request = Net::HTTP::Post.new uri.request_uri
  request.basic_auth account_sid, auth_token
  request.body = URI.encode_www_form({
    :To => '+15558675309',
    :From => '+15017250604',
    :MediaUrl => 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf'
  })

  response = http.request request

  puts JSON.parse(response.body)['sid']
end
from twilio.rest import Client

# put your own credentials here
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"

client = Client(account_sid, auth_token)

fax = client.fax.v1.faxes.create(
    from_="+15017250604",
    to="+15558675309",
    media_url="https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf")

print(fax.sid)
// Install the Java helper library from twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.rest.fax.v1.Fax;
import com.twilio.rest.fax.v1.FaxCreator;
import java.net.URI;
import java.net.URISyntaxException;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) throws URISyntaxException {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        String from = "+15017250604";
        String to = "+15558675309";
        URI mediaUrl = new URI("https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf");
        FaxCreator faxCreator = Fax.creator(to, mediaUrl);
        faxCreator.setFrom(from);
        Fax fax = faxCreator.create();

        System.out.println(fax.getSid());
    }
}
curl 'https://fax.twilio.com/v1/Faxes' \
    -X POST \
    -d 'To=%2B15558675309'  \
    -d 'From=%2B15017250604'  \
    -d 'MediaUrl=https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf' \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
	"status": "queued",
	"direction": "outbound",
	"from": "+15017250604",
	"date_updated": "2017-04-06T06:39:15Z",
	"price": null,
	"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	"to": "+15558675309",
	"date_created": "2017-04-06T06:39:15Z",
	"url": "https://fax.twilio.com/v1/Faxes/FX4ac3612393b5a66f11c73a148f956a5c",
	"sid": "FX4ac3612393b5a66f11c73a148f956a5c",
	"duration": null,
	"num_pages": null,
	"quality": "fine",
	"price_unit": null,
	"api_version": "v1",
	"media_url": null
}
Create a New Fax Instance and Trigger Send

HTTP PUT

Not supported.

HTTP DELETE

Not supported.

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.

1 / 1
Loading Code Samples...
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.fax.v1.faxes('FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa').fetch()
  .then(function(response) {
    console.log(response.sid);
  }).catch((err) => {
    console.log(err)
  });
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Fax.V1;
using Twilio.Types;
using System.Collections.Generic;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        const string faxSid = "FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

        TwilioClient.Init(accountSid, authToken);

        var fax = FaxResource.Fetch(faxSid);

        Console.WriteLine(fax.Sid);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$fax = $client->fax->v1
    ->faxes("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->fetch();

echo $fax->status;
require 'net/http'
require 'json'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

uri = URI('https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')

Net::HTTP.start(uri.host, uri.port,
  :use_ssl => uri.scheme == 'https') do |http|

  request = Net::HTTP::Get.new uri.request_uri
  request.basic_auth account_sid, auth_token

  response = http.request request

  puts JSON.parse(response.body)['media_url']
end
from twilio.rest import Client

# put your own credentials here
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"

fax_sid = "FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

client = Client(account_sid, auth_token)

fax = client.fax.v1.faxes(sid=fax_sid).fetch()

print(fax.sid)
// Install the Java helper library from twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.fax.v1.Fax;
import java.net.URISyntaxException;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) throws URISyntaxException {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        Fax fax = Fax.fetcher("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch();

        System.out.println(fax.getMediaUrl());
    }
}
curl 'https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' \
    -X GET \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
    "status": "busy",
    "direction": "outbound",
    "from": "+15017250604",
    "date_updated": "2017-04-06T06:41:44Z",
    "price": null,
    "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "to": "+15558675309",
    "date_created": "2017-04-06T06:41:32Z",
    "url": "https://fax.twilio.com/v1/Faxes/FX0bc96ef78eae441348874c6998db5a51",
    "sid": "FX0bc96ef78eae441348874c0098db5a51",
    "duration": null,
    "num_pages": 1,
    "quality": "fine",
    "price_unit": null,
    "api_version": "v1",
    "media_url": "https://media.twiliocdn.com/fax/AC7719587dd8553511c99cf14d495da345/f540dd4a36e448636c6a03ea16fef29ca1b6f1c20e80b16ae7538807311c1d77e239b42678ffe13617213ce892b55e1a09b0d4f3db7f01968b587b6c095b343e?x-amz-security-token=FQoDYasdEBgaDDRjH242324BB8SK3A4ex5oEKcNjDtlfxoAdcyA8PGme7Z%2Frj4W7l6Jdeq2342rwerwmkJs4vZ8fllEvQU0xErPz5kIxcOJ7ODOYSu%2Bcsk28Nr0QecoIxaZdZTyCFGxa3rEVXOgNq6M4smzWlxH7VHZpiSHjE8VHMGrB5xY5qygtwN1kSqh%2Bf%2Bg1h2XqPE7w83O2JUfLS23%2FnX9KKJOHtMrwLjLyjvD1AxvlVVzB2815xaLUkPYrOrgVO%2B6kzQlPiwn2jqsTO8TYWezgrVQmo8MyLMwVNrZ7cYrTq3Us3tAHm1nG%2BB7cOHziinet%2FsPqjLOL3cpj8Npm55%2BKvh74SypF6zAeNLKsX%2F2uE6%2FaWRtf1iyjp4zh%2B72qw9RJKjicUxCKCTdIK8rhh%2Fk8Zk1puSThXZnMGX0z9XWlSySisLUBrLh2SJAfqNqyjMnzxGErIV6jzgeMOpxpYk6UYtbFUx%2Ba1X5iEdXDQPUO7v7e6dTF2N%2F4OJdXFgeClzYXFAlKA29KUBGx3mYShOM8VccyqtCG7zhHoYv1%2Fhr%2FBktHNezWAVjGdkAhHm6O6Nl3X%2FnS1cLwz3vouRRKPVlPwfLSopuNn0lfAVYRxYojaKZxwU%3D&AWSAccessKeyId=ASIAIF4A5CFXDRXORVKQ&Expires=1491499879&Signature=pVV8xEzm1%22IyDz%2BSQ2rvoSdQxoA%3D"
}
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.fax.v1
  .faxes('FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
  .update({
    status: 'canceled',
  })
  .then(response => {
    console.log(response.sid);
  })
  .catch(err => {
    console.log(err);
  });
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Fax.V1;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var fax = FaxResource.Update("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            FaxResource.UpdateStatusEnum.Canceled);

        Console.WriteLine(fax.Status);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$fax = $client->fax->v1
    ->faxes("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->update(array("status" => "canceled"));

echo $fax->status;
require 'net/http'
require 'json'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

uri = URI('https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')

Net::HTTP.start(uri.host, uri.port,
  :use_ssl => uri.scheme == 'https') do |http|

  request = Net::HTTP::Post.new uri.request_uri
  request.basic_auth account_sid, auth_token
  request.body = URI.encode_www_form({
    :Status => 'canceled'
  })

  response = http.request request

  puts JSON.parse(response.body)['status']
end
from twilio.rest import Client

# put your own credentials here
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"

client = Client(account_sid, auth_token)

fax = client.fax.v1 \
    .faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
    .update(status="canceled")

print(fax.status)
// Install the Java helper library from twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.fax.v1.Fax;
import java.net.URISyntaxException;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) throws URISyntaxException {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
      
        Fax fax = Fax.updater("FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
               .setStatus(Fax.UpdateStatus.CANCELED)
               .update();

        System.out.println(fax.getStatus());
    }
}
curl 'https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' \
    -X POST \
    -d 'Status=canceled'  \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
	"status": "canceled",
	"direction": "outbound",
	"from": "+15017250604",
	"date_updated": "2017-04-06T09:15:48Z",
	"price": null,
	"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	"to": "+15558675309",
	"date_created": "2017-04-06T09:15:38Z",
	"url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
	"sid": "FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
	"duration": null,
	"num_pages": null,
	"quality": "fine",
	"price_unit": null,
	"api_version": "v1",
	"media_url": null
}
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.fax.v1.faxes.list()
  .then(function(response) {
    console.log(response);
  }).catch((err) => {
    console.log(err)
  });
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Fax.V1;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var faxes = FaxResource.Read();

        foreach (var fax in faxes)
        {
        	Console.WriteLine(fax.MediaUrl);
        }
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$faxes = $client->fax->v1->faxes->read();

foreach ($faxes as $fax) {
    echo $fax->mediaUrl;
}
require 'net/http'
require 'json'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

uri = URI('https://fax.twilio.com/v1/Faxes')

Net::HTTP.start(uri.host, uri.port,
  :use_ssl => uri.scheme == 'https') do |http|

  request = Net::HTTP::Get.new uri.request_uri
  request.basic_auth account_sid, auth_token

  response = http.request request

  JSON.parse(response.body)['faxes'].each do |fax|
    puts fax['media_url']
  end
end
from twilio.rest import Client

# put your own credentials here
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"

client = Client(account_sid, auth_token)

faxes = client.fax.v1.faxes.list()

for fax in faxes:
    print(fax.media_url)
// Install the Java helper library from twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.fax.v1.Fax;
import java.net.URISyntaxException;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) throws URISyntaxException {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        ResourceSet<Fax> faxes = Fax.reader().read();

        for (Fax fax : faxes) {
            System.out.println(fax.getMediaUrl());
        }
    }
}
curl 'https://fax.twilio.com/v1/Faxes' \
    -X GET \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
  "meta": {
    "page": 0,
    "page_size": 50,
    "first_page_url": "https://fax.twilio.com/v1/Faxes?PageSize=50&Page=0",
    "previous_page_url": null,
    "url": "https://fax.twilio.com/v1/Faxes?PageSize=50&Page=0",
    "next_page_url": null,
    "key": "faxes"
  },
  "faxes": [
    {
      "status": "busy",
      "direction": "outbound",
      "from": "+15017250604",
      "date_updated": "2017-04-06T06:41:44Z",
      "price": null,
      "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "to": "+15558675309",
      "date_created": "2017-04-06T06:41:32Z",
      "url": "https://fax.twilio.com/v1/Faxes/FX0bc96ef78eae441348874c6998db5a51",
      "sid": "FX0bc96ef78eae441348874c0098db5a51",
      "duration": null,
      "num_pages": 1,
      "quality": "fine",
      "price_unit": null,
      "api_version": "v1",
      "media_url": "https://media.twiliocdn.com/fax/AC7719587dd8553511c99cf14d495da345/f540dd4a36e448636c6a03ea16fef29ca1b6f1c20e80b16ae7538807311c1d77e239b42678ffe13617213ce892b55e1a09b0d4f3db7f01968b587b6c095b343e?x-amz-security-token=FQoDYasdEBgaDDRjH242324BB8SK3A4ex5oEKcNjDtlfxoAdcyA8PGme7Z%2Frj4W7l6Jdeq2342rwerwmkJs4vZ8fllEvQU0xErPz5kIxcOJ7ODOYSu%2Bcsk28Nr0QecoIxaZdZTyCFGxa3rEVXOgNq6M4smzWlxH7VHZpiSHjE8VHMGrB5xY5qygtwN1kSqh%2Bf%2Bg1h2XqPE7w83O2JUfLS23%2FnX9KKJOHtMrwLjLyjvD1AxvlVVzB2815xaLUkPYrOrgVO%2B6kzQlPiwn2jqsTO8TYWezgrVQmo8MyLMwVNrZ7cYrTq3Us3tAHm1nG%2BB7cOHziinet%2FsPqjLOL3cpj8Npm55%2BKvh74SypF6zAeNLKsX%2F2uE6%2FaWRtf1iyjp4zh%2B72qw9RJKjicUxCKCTdIK8rhh%2Fk8Zk1puSThXZnMGX0z9XWlSySisLUBrLh2SJAfqNqyjMnzxGErIV6jzgeMOpxpYk6UYtbFUx%2Ba1X5iEdXDQPUO7v7e6dTF2N%2F4OJdXFgeClzYXFAlKA29KUBGx3mYShOM8VccyqtCG7zhHoYv1%2Fhr%2FBktHNezWAVjGdkAhHm6O6Nl3X%2FnS1cLwz3vouRRKPVlPwfLSopuNn0lfAVYRxYojaKZxwU%3D&AWSAccessKeyId=ASIAIF4A5CFXDRXORVKQ&Expires=1491499879&Signature=pVV8xEzm1%22IyDz%2BSQ2rvoSdQxoA%3D"
    }
  ]
}
SDK Version:
  • 5.x
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.fax.v1.faxes
  .create({
      to: '+15558675309',
      from: '+15017250604',
      mediaUrl: 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf'
  }).then(function(response) {
    console.log(response.sid);
  }).catch((err) => {
    console.log(err)
  });
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Fax.V1;
using Twilio.Types;
using System.Collections.Generic;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var to = "+15558675309";
        var mediaUrl = new Uri(
            "https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf");

        var fax = FaxResource.Create(to, mediaUrl, from: "+15017250604");

        Console.WriteLine(fax.Sid);
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$options = array(
  "from" => "+15017250604"
);
$fax = $client->fax->v1->faxes->create(
    "+15558675309",
    "https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf",
    $options
);

echo $fax->sid;
require 'net/http'
require 'json'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

uri = URI('https://fax.twilio.com/v1/Faxes')

Net::HTTP.start(uri.host, uri.port,
  :use_ssl => uri.scheme == 'https') do |http|

  request = Net::HTTP::Post.new uri.request_uri
  request.basic_auth account_sid, auth_token
  request.body = URI.encode_www_form({
    :To => '+15558675309',
    :From => '+15017250604',
    :MediaUrl => 'https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf'
  })

  response = http.request request

  puts JSON.parse(response.body)['sid']
end
from twilio.rest import Client

# put your own credentials here
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"

client = Client(account_sid, auth_token)

fax = client.fax.v1.faxes.create(
    from_="+15017250604",
    to="+15558675309",
    media_url="https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf")

print(fax.sid)
// Install the Java helper library from twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.rest.fax.v1.Fax;
import com.twilio.rest.fax.v1.FaxCreator;
import java.net.URI;
import java.net.URISyntaxException;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) throws URISyntaxException {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        String from = "+15017250604";
        String to = "+15558675309";
        URI mediaUrl = new URI("https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf");
        FaxCreator faxCreator = Fax.creator(to, mediaUrl);
        faxCreator.setFrom(from);
        Fax fax = faxCreator.create();

        System.out.println(fax.getSid());
    }
}
curl 'https://fax.twilio.com/v1/Faxes' \
    -X POST \
    -d 'To=%2B15558675309'  \
    -d 'From=%2B15017250604'  \
    -d 'MediaUrl=https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf' \
    -u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
	"status": "queued",
	"direction": "outbound",
	"from": "+15017250604",
	"date_updated": "2017-04-06T06:39:15Z",
	"price": null,
	"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	"to": "+15558675309",
	"date_created": "2017-04-06T06:39:15Z",
	"url": "https://fax.twilio.com/v1/Faxes/FX4ac3612393b5a66f11c73a148f956a5c",
	"sid": "FX4ac3612393b5a66f11c73a148f956a5c",
	"duration": null,
	"num_pages": null,
	"quality": "fine",
	"price_unit": null,
	"api_version": "v1",
	"media_url": null
}