Get Started
Quickstart
Get Started
SDKs
API Reference
- Accounts
- Numbers
- Faxes
- Files
- Outbox
- Webhooks
- Shop
Get Started
Quickstart
Start sending faxes in 4 steps
1
Create a Fax.Plus Account
Fax.Plus API is available for enterprise plan only
2
Get Your API Key
Please visit the Integrations page to get your API key.
3
Upload a file
To send a fax, you need to upload a file to the Fax.Plus server. The file can be in PDF, TIFF, Word, Excel, RTF or image format.
const axios = require('axios');
const fs = require('fs')
const FilesApiFp = require('@alohi/faxplus-api').FilesApiFp;
const Configuration = require('@alohi/faxplus-api').Configuration;
const config = new Configuration({
accessToken: accessToken,
basePath: 'https://restapi.fax.plus/v3',
// Header required only when using the OAuth2 token scheme
baseOptions: {
headers: {
"x-fax-clientid": clientId,
}
}
});
async function uploadFile() {
const reqParams = {
"format": 'tiff',
"userId": '13d8z73c',
"faxFile": fs.createReadStream(FILE_PATH)
}
const req = await FilesApiFp(config).uploadFile(reqParams);
const resp = await req(axios);
}
uploadFile()
const axios = require('axios');
const fs = require('fs')
const FilesApiFp = require('@alohi/faxplus-api').FilesApiFp;
const Configuration = require('@alohi/faxplus-api').Configuration;
const config = new Configuration({
accessToken: accessToken,
basePath: 'https://restapi.fax.plus/v3',
// Header required only when using the OAuth2 token scheme
baseOptions: {
headers: {
"x-fax-clientid": clientId,
}
}
});
async function uploadFile() {
const reqParams = {
"format": 'tiff',
"userId": '13d8z73c',
"faxFile": fs.createReadStream(FILE_PATH)
}
const req = await FilesApiFp(config).uploadFile(reqParams);
const resp = await req(axios);
}
uploadFile()
from faxplus import ApiClient, FilesApi
from faxplus.configuration import Configuration
conf = Configuration()
conf.access_token = access_token
# header_name and header_value required only when using the OAuth2 token scheme
api_client = ApiClient(header_name='x-fax-clientid', header_value=client_id, configuration=conf)
api = FilesApi(api_client)
resp = api.upload_file(
format='tiff',
user_id='13d8z73c',
fax_file='/path/to/file.pdf'
)
/**
* Example below uses Apache HTTP Client 4 with Fluent API
**/
Map<String, String> pathParams = new HashMap<>();
pathParams.put("user_id", "'13d8z73c'");
pathParams.put("fax_id", "'132esd4cs31'");
StrSubstitutor sub = new StrSubstitutor(values, "{", "}");
String url = sub.replace("https://restapi.fax.plus/v3/accounts/{user_id}/report/{fax_id}");
String result = Request
.Get(url)
// The x-fax-clientid header is required only when using the OAuth2 token scheme
.addHeader("x-fax-clientid", "{client-id}")
.addHeader("Accept", "'application/pdf'")
.addHeader("Authorization", "''Bearer {access-token}''")
.execute()
.returnContent().asString();
System.out.println(result.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
// The x-fax-clientid header is required only when using the OAuth2 token scheme
"Accept": []string{"application/pdf"},
"Authorization": []string{"Bearer {access-token}"},
"x-fax-clientid": []string{"{client-id}"}
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts/{user_id}/report/{fax_id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
'x-fax-clientid' => '{client-id}',
);
$client = new GuzzleHttp\Client();
try {
$response = $client->request('GET', 'https://restapi.fax.plus/v3/accounts', array(
'headers' => $headers,
));
print_r($response->getBody()->getContents());
} catch (GuzzleHttp\Exception\BadResponseException $e) {
print_r($e->getMessage());
}
# You can also use wget
curl -X GET https://restapi.fax.plus/v3/accounts/{user_id}/files/{fax_id} \
-H 'Accept: application/pdf' \
-H 'Authorization: Bearer {access-token}' \
# The x-fax-clientid header is required only when using the OAuth2 token scheme
-H 'x-fax-clientid: "YOUR_CLIENT_ID"'
Once the file is uploaded, you will receive a path
in the response. You will need this path
to send a fax.
{
"path": "/storage/2937237320213-213-21323"
}
4
Send a fax
To send a fax, you need to provide the recipient’s fax number and the file path you received in the previous step.
const axios = require('axios');
const OutboxApiFp = require('@alohi/faxplus-api').OutboxApiFp;
const Configuration = require('@alohi/faxplus-api').Configuration;
const config = new Configuration({
accessToken: accessToken,
basePath: 'https://restapi.fax.plus/v3',
// Header required only when using the OAuth2 token scheme
baseOptions: {
headers: {
"x-fax-clientid": clientId,
}
}
});
async function sendFax() {
const reqParams = {
"userId": '13d8z73c',
"payloadOutbox": {
"comment": {
"tags": [
"tag1",
"tag2"
],
"text": "text comment"
},
"files": [
"filetosend.pdf"
],
"from": "+12345667",
"options": {
"enhancement": true,
"retry": {
"count": 2,
"delay": 15
}
},
"send_time": "2000-01-01 01:02:03 +0000",
"to": [
"+12345688",
"+12345699"
],
"return_ids": true
}
}
const req = await OutboxApiFp(config).sendFax(reqParams);
const resp = await req(axios);
}
sendFax()
const axios = require('axios');
const OutboxApiFp = require('@alohi/faxplus-api').OutboxApiFp;
const Configuration = require('@alohi/faxplus-api').Configuration;
const config = new Configuration({
accessToken: accessToken,
basePath: 'https://restapi.fax.plus/v3',
// Header required only when using the OAuth2 token scheme
baseOptions: {
headers: {
"x-fax-clientid": clientId,
}
}
});
async function sendFax() {
const reqParams = {
"userId": '13d8z73c',
"payloadOutbox": {
"comment": {
"tags": [
"tag1",
"tag2"
],
"text": "text comment"
},
"files": [
"filetosend.pdf"
],
"from": "+12345667",
"options": {
"enhancement": true,
"retry": {
"count": 2,
"delay": 15
}
},
"send_time": "2000-01-01 01:02:03 +0000",
"to": [
"+12345688",
"+12345699"
],
"return_ids": true
}
}
const req = await OutboxApiFp(config).sendFax(reqParams);
const resp = await req(axios);
}
sendFax()
from faxplus import ApiClient, OutboxApi, OutboxComment, RetryOptions, OutboxOptions, OutboxCoverPage, PayloadOutbox
from faxplus.configuration import Configuration
outbox_comment = OutboxComment(tags=['tag1', 'tag2'],
text='text comment')
retry_options = RetryOptions(count=2, delay=15)
outbox_options = OutboxOptions(enhancement=True, retry=retry_options)
outbox_cover_page = OutboxCoverPage()
payload_outbox = PayloadOutbox(from='+12345667',
to=['+12345688', '+12345699'],
files=['filetosend.pdf'],
comment=outbox_comment,
options=outbox_options,
send_time='2000-01-01 01:02:03 +0000',
return_ids=True,
cover_page=outbox_cover_page)
conf = Configuration()
conf.access_token = access_token
# header_name and header_value required only when using the OAuth2 token scheme
api_client = ApiClient(header_name='x-fax-clientid', header_value=client_id, configuration=conf)
api = OutboxApi(api_client)
resp = api.send_fax(
user_id='13d8z73c',
body=payload_outbox
)
/**
* Example below uses Apache HTTP Client 4 with Fluent API
**/
Map<String, String> pathParams = new HashMap<>();
pathParams.put("user_id", "'13d8z73c'");
StrSubstitutor sub = new StrSubstitutor(values, "{", "}");
String url = sub.replace("https://restapi.fax.plus/v3/accounts/{user_id}/outbox");
String jsonBody = ...; // See request body example
String result = Request
.Post(url)
// The x-fax-clientid header is required only when using the OAuth2 token scheme
.addHeader("x-fax-clientid", "YOUR CLIENT_ID")
.addHeader("Content-Type", "'application/json'")
.addHeader("Accept", "'application/json'")
.addHeader("Authorization", "'Bearer {access-token}'")
.bodyString(jsonBody, "application/json")
.execute()
.returnContent().asString();
System.out.println(result);
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
// The x-fax-clientid header is required only when using the OAuth2 token scheme
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
"x-fax-clientid": []string{"YOUR CLIENT_ID"}
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://restapi.fax.plus/v3/accounts/{user_id}/outbox", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
// The x-fax-clientid header is required only when using the OAuth2 token scheme
'x-fax-clientid' => '{client ID}',
);
$client = new GuzzleHttp\Client();
// Define array of request body.
$request_body = ...; // See request body example
try {
$response = $client->request('POST','https://restapi.fax.plus/v3/accounts/{user_id}/outbox', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
# You can also use wget
curl -X POST https://restapi.fax.plus/v3/accounts/{user_id}/outbox \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
# The x-fax-clientid header is required only when using the OAuth2 token scheme
-H 'x-fax-clientid: "YOUR CLIENT_ID"'
On success, the API will return a response with return a list of fax IDs. Each fax ID represents a fax that was sent to a recipient.
{
"ids": {
"+1234567890": "1a2b3c4d5e6f7890",
"+1345678912": "78901a2b3c4d5e6f"
}
}
Go further
On this page