FAXAGE Web API Documentation
FAXAGE Web API Documentation
FAXAGE Web API Documentation
This documentation and all example code provided with it are the confidential and
proprietary property of EC Data Systems, Inc. These materials are provided only for the
purpose of an existing or potential customer evaluating and potentially implementing a
programmatic integration with the FAXAGE Internet fax service. Any other use or
disclosure is strictly prohibited unless the express written consent of EC Data Systems,
Inc. is obtained in advance of such use or disclosure.
Each of these URLs will be described in this documentation in terms of both required and
optional variables that are sent to the URL in order to accomplish certain operations.
Responses from the FAXAGE system are additionally defined throughout this
documentation in the relevant section.
Example code is supplied in Perl, Java, PHP and Progress for one or more of these
operations. The basic structure (HTTPS POST with a series of required and optional
variables passed in) is essentially the same for all components and operations that can be
performed utilizing the API. Thus an example of every operation in every language is not
supplied.
Sending-related Operations
1. The ‘sendfax’ operation allows for posting one or more files that will be faxed to
a specified destination. It can also accept a URL rather than file(s) and will
download the specified URL and fax out the HTML content or document that the
URL points to
2. The ‘status’ operation allows for checking status (pending, success, failure) of a
fax that has been sent
3. The ‘clear’ operation allows for deleting status records for faxes that have
completed sending (either success or failed)
4. The ‘stopfax’ operation allows a pending job to be stopped/cancelled
Receiving-related Operations
Other Operations
1. The ‘disabledid’ operation allows for a number to be ‘busied out’ so that faxes
cannot come in to it
2. The ‘enabledid’ operation allows for a number that had been disabled to be re-
enabled (all numbers are enabled for inbound by default when set up)
A debugging URL is also provided that is equivalent to the httpsfax.php URL, except that
it also returns the contents of your POST, so that you can see what our server thinks you
passed us:
https://www.faxage.com/httpsfax-debug.php
The sendfax-example.pl script provides an example of code that uses this operation.
Examples for the sendfax operation are also provided in Java, PHP and Progress. All of
these can be found under the example-code directory distributed with this zip file.
Note the optional ‘URL Mode’ below. If you wish to POST a URL to be downloaded and
faxed out rather than file data, please use the variables shown rather than the first set of
Required POST Variables which are for the ‘standard’ mode. Note that URL mode will
support faxing the HTML content and will use stylesheets as well as images, etc.
However, any client-side scripting will not be executed by the parser on our end. Any
supported file type (such as a Word document or PDF) may also be passed in URL mode,
provided that these are available at a designated URL. Also, note that HTML passed to
FAXAGE (in standard mode as a file versus URL mode) can contain external hyperlinks
to images, etc. via HTTP or HTTPs as long as the links are absolute (i.e.: begin with
http:// or https://) or images, etc. can be passed as additional files along with the HTML,
depending on developer preference. The sendfax-example-url.pl script is provided as an
example for URL mode versus standard mode.
As of this writing, the following file types are supported for sending, others may become
available over time, so please check with us if the type of content you wish to send is not
listed here:
Description Extension(s)
JPEG Image JPG, JPEG
Adobe PDF PDF
Adobe PostScript PS
TIFF Image TIF, TIFF
Microsoft Word DOC
Microsoft Word Template DOT
Microsoft Word 2007 DOCX
OpenOffice Writer Doc (Open Document Text) ODT
Rich Text RTF
Microsoft Excel XLS
Microsoft Excel 2007 XLSX
OpenOffice Calc Spreadsheet ODS
Comma-separated CSV CSV
HTML HTM, HTML
Bitmap Image BMP
GIF Image GIF
HP Printer Control Language PCL
Plain Text TXT
Variable Description
username Assigned FAXAGE username
company Assigned FAXAGE company credential
password Assigned FAXAGE password
recipname Recipient Name – 32 chars max
faxno Fax Number – 10 digits, numeric only
operation Hard coded to ‘sendfax’ (w/o the quotes)
faxfilenames[ ] Array of file names. These must end in a supported extension – see
the table above for a list
faxfiledata[ ] Corresponding array of base64-encoded strings that are the
contents/data of the file in faxfilenames. E.g.: if faxfilenames[0] is
test.doc, then faxfiledata[0] should be the base64-encoded contents
of test.doc
Variable Description
username Assigned FAXAGE username
company Assigned FAXAGE company credential
password Assigned FAXAGE password
recipname Recipient Name – 32 chars max
faxno Fax Number – 10 digits, numeric only
operation Hard coded to ‘sendfax’ (w/o the quotes)
faxurl Absolute URL path (beginning with http:// or https://) to the URL
to fax out.
Variable Description
tagname In the header of each fax page, this specifies the name that will
follow From: If unspecified, the default for your company will be
used
tagnumber In the header of each fax page, this specifies the fax number that
will follow tagname. 14 characters max. If unspecified, the default
for your company will be used
em_notify If this variable is set to 1, then the final status of the job will be
pushed via email to the email address associated with the user
Possible Responses
Response Meaning
ERR01: Database connection failed Internal FAXAGE error
ERR02: Login incorrect One or more of username, company,
password is incorrect or your account is
disabled for some reason
ERR03: No files to fax No valid files where found in faxfilenames[
] and/or faxfiledata[ ]
ERR04: Fax number <number> appears to The faxno variable does not contain a 10-
be invalid digit numeric only string
ERR05: <reason> The number you tried to fax to was blocked
(outside of continental US, Canada and
Hawaii or a 555, 911, or other
invalid/blocked type of number)
JOBID: <numeric-job-id> Successful send. The jobid reported can
later be used to get status, etc. for this job
ERR08: Unknown operation specified or Either operation is not correctly hard coded
bad POST <POST contents> or the POST was bad, the POST contents
are returned for debugging purposes
ERR15: Invalid Job ID Internal FAXAGE error – the job was not
properly inserted into our database
The status-example.pl script provides an example of code that uses this operation.
Variable Description
username Assigned FAXAGE username
company Assigned FAXAGE company credential
password Assigned FAXAGE password
operation Hard coded to ‘status’ (w/o the quotes)
Variable Description
jobid If specified, reports only the status of the requested jobid, otherwise
reports status of all jobids for your company
jobids[] Alternative to ‘jobid’ to request status for an array list of jobs as
opposed to a single job
pagecount Hard code this variable to ‘1’. If passed, this will cause the page
count to be displayed as the last field on each status record. If not
passed, then page counts will not be displayed.
useronly Hard code to ‘1’. If passed, the status call will only show records
pertaining to faxes sent by the calling username, versus showing all
records for the account, which is the default mode of operation.
Possible Responses
Response Meaning
ERR01: Database connection failed Internal FAXAGE error
ERR02: Login incorrect One or more of username, company, password is
incorrect or your account is disabled for some
reason
ERR06: No jobs to display or job id The jobid you passed was not found or there are
specified not found simply no jobs to report for your company at this
time
<StatusRecord> The format of the status record(s) returned is as
follows (newline separation if multiple records).
See below for definition of each field
<jobid><tab><commid><tab><destname><tab><
destnum><tab><shortstatus><tab><longstatus><ta
b><sendtime><tab><completetime><tab><xmitti
longstatus – Descriptive failure reason or other descriptive text about the status. NOTE:
This text is intended to be human-readable and is subject to change, programmatic
parsing or rendering of the ‘longstatus’ field is not recommended
completetime – Time this job was completed YYYY-MM-DD HH:MM:SS format, all
0’s if the job is pending
pagecount – Optional if the pagecount variable is POSTed. This will display the number
of pages in the job
The clear-example.pl script provides an example of code that uses this operation. Clear
will only clear records of completed jobs (presumably after the programmer has
processed them using the status operation). Pending jobs cannot be cleared through the
API.
Variable Description
username Assigned FAXAGE username
company Assigned FAXAGE company credential
password Assigned FAXAGE password
operation Hard coded to ‘clear’ (w/o the quotes)
jobid The jobid to clear the status record for
None
Possible Responses
Response Meaning
ERR01: Database connection failed Internal FAXAGE error
ERR02: Login incorrect One or more of username, company, password is
incorrect or your account is disabled for some
reason
ERR07: Job ID: <jobid> not found, The jobid you passed was not found, is not a job
does not belong to you or is for your company or is in a pending state
pending and cannot be cleared yet
<jobid> cleared Successful clear of the specified jobid’s status
record
ERR08: Unknown operation Either operation is not correctly hard coded or the
specified or bad POST <POST POST was bad, the POST contents are returned for
contents> debugging purposes
The listfax-example.pl script provides an example of code that uses this operation.
Variable Description
username Assigned FAXAGE username
company Assigned FAXAGE company credential
password Assigned FAXAGE password
operation Hard coded to ‘listfax’ (w/o the quotes)
Variable Description
useronly Hardcode to ‘1’. If specified only shows faxes that the currently
passed credentials (if a non-manager account is being used) has
access to from a website-security perspective. This allows
automatic filtering on a per-user basis when using the API if it is
desirable to control user access on the FAXAGE side versus
building your own capabilities to filter faxes into your application
idasc Hardcode to ‘1’. Causes faxes to be listed by faxid (see listfax
record definition below) ascending. Faxid is an incremented
numeric field, so this is basically an ‘oldest to newest’ type of
listing. The default is to list by the receiving number, then by date
received descending (‘newest to oldest’, grouped by receiving fax
number)
filename Hardcode to ‘1’. Causes a fifth returned column, which contains the
internal filename associated with each received fax
starttime Hardcode to ‘1’. If set, causes the start time as well as the received
time to be returned (the recvdate is the receive time in the return
record, which is really the ‘end time’ of the transmission). Using
this, incoming fax duration can be calculated as recvdate - starttime
Possible Responses
Response Meaning
ERR01: Database connection Internal FAXAGE error
failed
ERR02: Login incorrect One or more of username, company, password is
<recvid><tab><recvdate>(OPTIONAL:
<tab><starttime>)
<tab><CID><tab><DNIS>(OPTIONAL:
<tab><filename>)
The getfax-example.pl script provides an example of code that uses this operation. Note
that faxes will be returned as either PDF’s or TIFF’s, depending on the settings in the
website under ‘Admin’ -> ‘Fax Format’. The default is PDF unless changed.
Variable Description
username Assigned FAXAGE username
company Assigned FAXAGE company credential
password Assigned FAXAGE password
operation Hard coded to ‘getfax’ (w/o the quotes)
faxid The numeric ID of the fax to get, retrieved from the listfax
operation
None
Possible Responses
Response Meaning
ERR01: Database connection Internal FAXAGE error
failed
ERR02: Login incorrect One or more of username, company, password is
incorrect or your account is disabled for some reason
ERR12: FAX ID <faxid> not The faxid passed in is invalid or is an ID that does not
found or does not belong to you belong to your company
ERR13: File could not be Internal FAXAGE error
opened
<filedata> Success condition. Headers will be content-type:
application/octet-stream and disposition: attachment, a
unique filename is also supplied in the headers. The
actual data returned will be the binary contents of the
fax itself. This looks just like a website sending a file
to a browser for Open or Save type of operation.
Depending on your company setup, the file will either
be a TIFF image or an Adobe PDF
ERR08: Unknown operation Either operation is not correctly hard coded or the
specified or bad POST <POST POST was bad, the POST contents are returned for
contents> debugging purposes
The delfax-example.pl script provides an example of code that uses this operation.
Variable Description
username Assigned FAXAGE username
company Assigned FAXAGE company credential
password Assigned FAXAGE password
operation Hard coded to ‘delfax’ (w/o the quotes)
faxid The numeric ID of the fax to delete, obtained from listfax
None
Possible Responses
Response Meaning
ERR01: Database connection Internal FAXAGE error
failed
ERR02: Login incorrect One or more of username, company, password is
incorrect or your account is disabled for some reason
ERR14: FAX ID <faxid> not The requested faxid either does not exist or is not a fax
found or does not belong to you belonging to your company
<faxid> Deleted Success condition
ERR08: Unknown operation Either operation is not correctly hard coded or the
specified or bad POST <POST POST was bad, the POST contents are returned for
contents> debugging purposes
The stopfax-example.pl script provides an example of code that uses this operation.
NOTE: Only faxes ‘In Queue’ or ‘Waiting for conversion’ that are not currently
transmitting can be stopped.
Variable Description
username Assigned FAXAGE username
company Assigned FAXAGE company credential
password Assigned FAXAGE password
operation Hard coded to ‘stopfax’ (w/o the quotes)
jobid The numeric ID of the fax to delete, obtained from listfax
None
Possible Responses
Response Meaning
ERR01: Database connection Internal FAXAGE error
failed
ERR02: Login incorrect One or more of username, company, password is
incorrect or your account is disabled for some reason
ERR19: JOB ID <jobid> not The requested faxid either does not exist or is not a fax
found or does not belong to you belonging to your company
<jobid> stopped Success condition
ERR18: No jobid specified The ‘jobid’ variable was not specified or did not
contain a numeric job id
ERR20: Job ID - <jobid> - is The jobid is not currently in an ‘In Queue’ or ‘Waiting
not In Queue for conversion’ status and, therefore, is ineligible to be
stopped
ERR21: Job ID - <jobid> - not The jobid is not on the fax server at present and,
found on fax server therefore, cannot be stopped. This may be indicative of
an internal status error within FAXAGE
ERR22: Job ID - <jobid> - is in The jobid is currently being transmitted and, therefore,
transmission cannot be stopped
ERR23: Job ID - <jobid> - General failure to stop. The request is otherwise valid,
failed to stop but just didn’t work
ERR08: Unknown operation Either operation is not correctly hard coded or the
Disabledid Operation
Variable Description
Username Assigned FAXAGE username
Company Assigned FAXAGE company credential
Password Assigned FAXAGE password
Operation Hard coded to ‘disabledid’ (w/o the quotes)
didnumber The 10-digit did to disable
None
Possible Responses
Response Meaning
ERR01: Database connection Internal FAXAGE error
failed
ERR02: Login incorrect One or more of username, company, password is
incorrect or your account is disabled for some reason
ERR17: DID <didnumber> not The requested didnumber either does not exist or is not
found or doesn't belong to you a number belonging to your company
ERR16: invalid DID number - The value of the ‘didnumber’ variable is not a 10-digit
<didnumber> number or was not specified
Disabled <didnumber> Success condition
ERR08: Unknown operation Either operation is not correctly hard coded or the
specified or bad POST <POST POST was bad, the POST contents are returned for
contents> debugging purposes
Variable Description
Username Assigned FAXAGE username
Company Assigned FAXAGE company credential
Password Assigned FAXAGE password
Operation Hard coded to ‘enabledid’ (w/o the quotes)
didnumber The 10-digit did to enable
None
Possible Responses
Response Meaning
ERR01: Database connection Internal FAXAGE error
failed
ERR02: Login incorrect One or more of username, company, password is
incorrect or your account is disabled for some reason
ERR17: DID <didnumber> not The requested didnumber either does not exist or is not
found or doesn't belong to you a number belonging to your company
ERR16: invalid DID number - The value of the ‘didnumber’ variable is not a 10-digit
<didnumber> number or was not specified
Enabled <didnumber> Success condition
ERR08: Unknown operation Either operation is not correctly hard coded or the
specified or bad POST <POST POST was bad, the POST contents are returned for
contents> debugging purposes
NOTE: Although these parameters show as optional, one of either of these should be
specified (otherwise all records are returned, which could be a lengthy operation):
• Both begin and end
• ‘nuidgt’ (generally used in conjunction with ‘nuidshow’)
The return record format looks like this if nuidshow is not set (begin/end are used).
Records are newline-separated and comma-delimited within each record:
calldate,direction,src,dst,duration
nuid,calldate,direction,src,dst,duration
Where:
Response Meaning
ERR01: database connection failed Internal FAXAGE error
ERR02: login incorrect One or more of username, company or
password is invalid or the account is
currently locked out
• ‘listac’ returns a list of area codes in which numbers are available for provisioning
• ‘listnpanxx’ returns a list of NPANXX’s (first 6 digits of the phone number) in
which numbers are available for provisioning
• ‘listdids’ returns a list of available DIDs for provisioning
• ‘provdid’ provisions a specific DID to your account
• ‘deprovdid’ de-provisions (removes) a specific DID from your account
A typical workflow (if using this for user self-signup), might be:
Example code for this URL is provided under the ‘PHP’ example code directory
distributed with this documentation. The ‘listdids’ and ‘provdid’ functions are shown in
the example.
These responses apply to all possible operations. Operation specific error responses and
success cases are documented under each operation separately.
Response Meaning
ERR01: database connection failed Internal FAXAGE error
ERR02: login incorrect One or more of username, company or
password is invalid or the account is
currently locked out
ERR03: unknown operation The ‘operation’ variable is not specified or
does have one of the valid operations as its
value
None
A newline separated list of area codes in which the system has DID’s available for
provisioning. E.g.:
202
303
415
….
This operation lists NPANXX’s (first six digits of a phone number) available for
provisioning.
A list of npanxx’s in which the system has DID’s available for provisioning or nothing if
the ‘ac’ value was passed and it is not an Area Code in which DID’s are available.
The return records are newline separated and are in the following format:
<npanxx><tab><rcname><tab><rcstate>
Where:
npanxx – The first six digits of a telephone number
rcname – The Ratecenter name associated with this NPANXX (locality, like ‘Denver’ or
‘San Francisco’, etc.)
rcstate – The state in which the Ratecenter is located for this NPANXX
Note that for toll-free DID’s, both rcname and rcstate will be ‘Toll-Free’
303991<tab>Denver<tab>CO
This operation lists DID’s (full telephone numbers) available for provisioning.
A newline separated list of DIDs (full telephone numbers) available for provisioning, for
example:
3035551212
3035551234
3035551111
….
None
This operation de-provisions a DID (removes a telephone number from your account).
None