The file(s) you want to send as a fax as body attachment.
Fax API (3.0)
This document provides a detailed user guide and reference documentation on the Fax REST API.
If you have questions please contact us via our support portal and a team member will be happy to assist.
You must create an account on our support portal if you do not have one.
Sinch has a global server that will route your call to the appropriate geography region automatically:
https://fax.api.sinch.com/In general we retain fax logs and media for 13 months and you can access that via the API.
Find error codes and explanations here.
The Fax API allows you to send and receive faxes. You can send faxes to a single recipient or to multiple recipients. You can also receive faxes and download them.
To send a TEST Outbound fax you can send a fax TO +19898989898. This will emulate all aspects of a real fax without charging your account.
Request
Create and send a fax.
Fax content may be supplied via one or more files or URLs of supported filetypes.
This endpoint supports the following content types for the fax payload:
- Multipart/form-data
- Application/json
We will however always return a fax object in the response in application json. If you supply a callbackUrl the callback will be sent as multipart/form-data with the content of the fax as an attachment to the body, unless you specify callbackUrlContentType as application/json.
Files may be included in the POST request as multipart/form-data parts.
Any URL on the Internet (including ones with basic authentication), and we'll pull it down and make it a fax. This might be useful to you if you're using a web framework for templates and creating fax files.
Please note: If you are passing fax a secure URL (starting with https://), make sure that your SSL certificate (including your intermediate cert, if you have one) is installed properly, valid, and up-to-date.
- multipart/form-data
- application/json
A phone number in E.164 format, including the leading '+'.
A phone number in E.164 format, including the leading '+'.
Give us any URL on the Internet (including ones with basic authentication) At least one file or contentUrl parameter is required. Please note: If you are passing fax a secure URL (starting with https://), make sure that your SSL certificate (including your intermediate cert, if you have one) is installed properly, valid, and up-to-date. If the file parameter is specified as well, content from URLs will be rendered before content from files.
You can add multiple URLs by adding them as an array them with a comma when posting as multipart/form-data
For example: "https://developers.sinch.com/fax/fax.pdf, https://developers.sinch.com/" or if posting JSON "contentUrl": ["https://developers.sinch.com/fax/fax.pdf", "https://developers.sinch.com/"]
Give us any URL on the Internet (including ones with basic authentication) At least one file or contentUrl parameter is required. Please note: If you are passing fax a secure URL (starting with https://), make sure that your SSL certificate (including your intermediate cert, if you have one) is installed properly, valid, and up-to-date. If the file parameter is specified as well, content from URLs will be rendered before content from files.
You can add multiple URLs by adding them as an array them with a comma when posting as multipart/form-data
For example: "https://developers.sinch.com/fax/fax.pdf, https://developers.sinch.com/" or if posting JSON "contentUrl": ["https://developers.sinch.com/fax/fax.pdf", "https://developers.sinch.com/"]
Text that will be displayed at the top of each page of the fax. 50 characters maximum. Default header text is "-". Note that the header is not applied until the fax is transmitted, so it will not appear on fax PDFs or thumbnails.
If true, page numbers will be displayed in the header. Default is true.
A TZ database name string specifying the timezone for the header timestamp.
The number of seconds to wait between retries if the fax is not yet completed.
You can use this to attach labels to your call that you can use in your applications. It is a key value store.
application/jsonformat:"labels": {"label1":"value1"}multipart/form-dataformat:labels[label1] = value1
The URL to which a callback will be sent when the fax is completed. The callback will be sent as a POST request with a JSON body. The callback will be sent to the URL specified in the callbackUrl parameter, if provided, otherwise it will be sent to the URL specified in the callbackUrl field of the Fax Service object.
The content type of the callback.
| Enum Value | Description |
|---|---|
| multipart/form-data | The callback will be sent as a multipart/form-data request with files as attachments to the body. |
| application/json | The callback will be sent as a JSON request with the files as base64 encoded strings in the JSON object. |
Determines how documents are converted to black and white on OUTBOUND faxes only. Image conversion is not done on INBOUND faxes. Defaults to value selected on Fax Service object.
| Enum Value | Description |
|---|---|
| HALFTONE | Converts the image to halftone. |
| MONOCHROME | Converts the image to monochrome. |
| The number of times the fax will be retired before cancel. Default value is set in your fax service. | The maximum number of retries is 5.
The resolution for the fax. If this is set at the service, this applies to all faxes sent using that service. If this is set on the fax, this will override the service setting.
| Enum Value | Description |
|---|---|
| FINE | Most commonly accepted fax resolution at 200 dpi. |
| SUPERFINE | Higher but less commonly accepted fax resolution at 400 dpi. May be required when sending small text or detailed images. |
You can use this to specify custom data for your cover page that will be sent as part of the fax. It is a key value store. Read more about how to use this here. All keys used must be lower case.
application/jsonformat:"coverPageData": {"customfield1":"customdata1"}multipart/form-dataformat:coverPageData[customfield1] = customdata1
If set to true, you will receive a webhook notification for each page sent on an outbound fax.
- v3.0 of the Fax APIhttps://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
- multipart/form-data
- application/json
- SendFax
- SendFileAsFaxWithCoverPage
- SendFileAsFax
curl -i -X POST \
-u <username>:<password> \
https://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes \
-H 'Content-Type: multipart/form-data' \
-F 'to=+14155552222' \
-F contentUrl=https://developers.sinch.com/fax/fax.pdfThe created fax
The direction of the fax.
| Enum Value | Description |
|---|---|
| OUTBOUND | The fax was sent by you via the API. |
| INBOUND | The fax was received on one of your numbers. |
A phone number in E.164 format, including the leading '+'.
A phone number in E.164 format, including the leading '+'.
The status of the fax
| Enum Value | Description |
|---|---|
| QUEUED | The operation is currently in a queue on a server and should be executed very soon. |
| IN_PROGRESS | The fax is currently being sent (OUTBOUND) or received (INBOUND). |
| COMPLETED | The fax operation succeeded. Everything went as normally planned. |
| FAILURE | The fax operation failed. Details of the error can be found in the error_code field. For OUTBOUND fax, this means that NONE of the recipients received the fax. |
The bar codes found in the fax. This field is populated when Sinch detects bar codes on incoming faxes.
A timestamp representing the time when the initial API call was made.
If the job is complete, this is a timestamp representing the time the job was completed.
The number of pages successfully sent to the receiving side in the fax.
Text that will be displayed at the top of each page of the fax. 50 characters maximum. Default header text is "-". Note that the header is not applied until the fax is transmitted, so it will not appear on fax PDFs or thumbnails.
If true, page numbers will be displayed in the header. Default is true.
A TZ database name string specifying the timezone for the header timestamp.
The number of seconds to wait between retries if the fax is not yet completed.
You can use this to attach labels to your call that you can use in your applications. It is a key value store.
application/jsonformat:"labels": {"label1":"value1"}multipart/form-dataformat:labels[label1] = value1
The URL to which a callback will be sent when the fax is completed. The callback will be sent as a POST request with a JSON body. The callback will be sent to the URL specified in the callbackUrl parameter, if provided, otherwise it will be sent to the URL specified in the callbackUrl field of the Fax Service object.
The content type of the callback.
| Enum Value | Description |
|---|---|
| multipart/form-data | The callback will be sent as a multipart/form-data request with files as attachments to the body. |
| application/json | The callback will be sent as a JSON request with the files as base64 encoded strings in the JSON object. |
Determines how documents are converted to black and white on OUTBOUND faxes only. Image conversion is not done on INBOUND faxes. Defaults to value selected on Fax Service object.
| Enum Value | Description |
|---|---|
| HALFTONE | Converts the image to halftone. |
| MONOCHROME | Converts the image to monochrome. |
Error type
| Enum Value | Description |
|---|---|
| DOCUMENT_CONVERSION_ERROR | A documentation conversion error. |
| CALL_ERROR | A call error. |
| FAX_ERROR | A fax error. |
| FATAL_ERROR | A fatal error. |
| GENERAL_ERROR | A general error. |
One of the error numbers listed in the Fax Error Messages section.
One of the error codes listed in the Fax Error Messages section.
| The number of times the fax will be retired before cancel. Default value is set in your fax service. | The maximum number of retries is 5.
Only shown on the fax result. This indicates if the content of the fax is stored with Sinch. (true or false)
The resolution for the fax. If this is set at the service, this applies to all faxes sent using that service. If this is set on the fax, this will override the service setting.
| Enum Value | Description |
|---|---|
| FINE | Most commonly accepted fax resolution at 200 dpi. |
| SUPERFINE | Higher but less commonly accepted fax resolution at 400 dpi. May be required when sending small text or detailed images. |
You can use this to specify custom data for your cover page that will be sent as part of the fax. It is a key value store. Read more about how to use this here. All keys used must be lower case.
application/jsonformat:"coverPageData": {"customfield1":"customdata1"}multipart/form-dataformat:coverPageData[customfield1] = customdata1
If set to true, you will receive a webhook notification for each page sent on an outbound fax.
The Id of the project associated with the call.
{ "id": "01HDF5S9P29WC29J578J8EKC1C", "direction": "OUTBOUND", "to": "+1234567890", "status": "IN_PROGRESS", "headerTimeZone": "America/New_York", "retryDelaySeconds": 60, "callbackUrl": "https://my.callback.server", "projectId": "YOUR_PROJECT_ID", "serviceId": "YOUR_SERVICE_ID", "maxRetries": 3, "createTime": "2023-10-23T21:06:52.231Z", "headerPageNumbers": true, "contentUrl": [ "www.google.com" ], "imageConversionMethod": "HALFTONE" }
Request
List faxes sent (OUTBOUND) or received (INBOUND), set parameters to filter the list. Example: Return calls made between 1st of January 2021 and 10th of January 2021.
created>=2021-01-01&startTime<=2021-01-10Limits results to faxes that were sent using the specified service.
Filter calls based on createTime. If you make the query more precise, fewer results will be returned. For example, 2021-02-01 will return all calls from the first of February 2021, and 2021-02-01T14:00:00Z will return all calls after 14:00 on the first of February. This field also supports <= and >= to search for calls in a range ?createTime>=2021-10-01&startTime<=2021-10-30 to get a list of calls for all of October 2021. It is also possible to submit partial dates. For example, createTime=2021-02 will return all calls for February 2021.
If not value is submitted, the default value is the prior week.
Limits results to faxes with the specified direction.
| Enum Value | Description |
|---|---|
| OUTBOUND | The fax was sent by you via the API. |
| INBOUND | The fax was received on one of your numbers. |
Limits results to faxes with the specified status.
| Enum Value | Description |
|---|---|
| QUEUED | The operation is currently in a queue on a server and should be executed very soon. |
| IN_PROGRESS | The fax is currently being sent (OUTBOUND) or received (INBOUND). |
| COMPLETED | The fax operation succeeded. Everything went as normally planned. |
| FAILURE | The fax operation failed. Details of the error can be found in the error_code field. For OUTBOUND fax, this means that NONE of the recipients received the fax. |
A phone number that you want to use to filter results. The parameter search with startsWith, so you can pass a partial number to get all faxes sent to numbers that start with the number you passed.
A phone number that you want to use to filter results. The parameter search with startsWith, so you can pass a partial number to get all faxes sent to numbers that start with the number you passed.
The maximum number of items to return per request. The default is 100 and the maximum is 1000. If you need to export larger amounts and pagination is not suitable for you can use the Export function in the dashboard.
- v3.0 of the Fax APIhttps://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes?serviceId=YOUR_SERVICE_ID&createTime=2019-08-24T14%3A15%3A22Z&direction=OUTBOUND&status=COMPLETED&to=%2B14155552222&from=%2B15551235656&pageSize=1&page=string'{ "faxes": [ { … } ], "page": 0, "totalPages": 0, "pageSize": 0, "totalItems": 0 }
- v3.0 of the Fax APIhttps://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes/{id}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes/01F3J0G1M4WQR6HGY6HCF6JA0KThe fax
The direction of the fax.
| Enum Value | Description |
|---|---|
| OUTBOUND | The fax was sent by you via the API. |
| INBOUND | The fax was received on one of your numbers. |
A phone number in E.164 format, including the leading '+'.
A phone number in E.164 format, including the leading '+'.
The status of the fax
| Enum Value | Description |
|---|---|
| QUEUED | The operation is currently in a queue on a server and should be executed very soon. |
| IN_PROGRESS | The fax is currently being sent (OUTBOUND) or received (INBOUND). |
| COMPLETED | The fax operation succeeded. Everything went as normally planned. |
| FAILURE | The fax operation failed. Details of the error can be found in the error_code field. For OUTBOUND fax, this means that NONE of the recipients received the fax. |
The bar codes found in the fax. This field is populated when Sinch detects bar codes on incoming faxes.
A timestamp representing the time when the initial API call was made.
If the job is complete, this is a timestamp representing the time the job was completed.
The number of pages successfully sent to the receiving side in the fax.
Text that will be displayed at the top of each page of the fax. 50 characters maximum. Default header text is "-". Note that the header is not applied until the fax is transmitted, so it will not appear on fax PDFs or thumbnails.
If true, page numbers will be displayed in the header. Default is true.
A TZ database name string specifying the timezone for the header timestamp.
The number of seconds to wait between retries if the fax is not yet completed.
You can use this to attach labels to your call that you can use in your applications. It is a key value store.
application/jsonformat:"labels": {"label1":"value1"}multipart/form-dataformat:labels[label1] = value1
The URL to which a callback will be sent when the fax is completed. The callback will be sent as a POST request with a JSON body. The callback will be sent to the URL specified in the callbackUrl parameter, if provided, otherwise it will be sent to the URL specified in the callbackUrl field of the Fax Service object.
The content type of the callback.
| Enum Value | Description |
|---|---|
| multipart/form-data | The callback will be sent as a multipart/form-data request with files as attachments to the body. |
| application/json | The callback will be sent as a JSON request with the files as base64 encoded strings in the JSON object. |
Determines how documents are converted to black and white on OUTBOUND faxes only. Image conversion is not done on INBOUND faxes. Defaults to value selected on Fax Service object.
| Enum Value | Description |
|---|---|
| HALFTONE | Converts the image to halftone. |
| MONOCHROME | Converts the image to monochrome. |
Error type
| Enum Value | Description |
|---|---|
| DOCUMENT_CONVERSION_ERROR | A documentation conversion error. |
| CALL_ERROR | A call error. |
| FAX_ERROR | A fax error. |
| FATAL_ERROR | A fatal error. |
| GENERAL_ERROR | A general error. |
One of the error numbers listed in the Fax Error Messages section.
One of the error codes listed in the Fax Error Messages section.
| The number of times the fax will be retired before cancel. Default value is set in your fax service. | The maximum number of retries is 5.
Only shown on the fax result. This indicates if the content of the fax is stored with Sinch. (true or false)
The resolution for the fax. If this is set at the service, this applies to all faxes sent using that service. If this is set on the fax, this will override the service setting.
| Enum Value | Description |
|---|---|
| FINE | Most commonly accepted fax resolution at 200 dpi. |
| SUPERFINE | Higher but less commonly accepted fax resolution at 400 dpi. May be required when sending small text or detailed images. |
You can use this to specify custom data for your cover page that will be sent as part of the fax. It is a key value store. Read more about how to use this here. All keys used must be lower case.
application/jsonformat:"coverPageData": {"customfield1":"customdata1"}multipart/form-dataformat:coverPageData[customfield1] = customdata1
If set to true, you will receive a webhook notification for each page sent on an outbound fax.
The Id of the project associated with the call.
{ "id": "01HDF5S9P29WC29J578J8EKC1C", "direction": "OUTBOUND", "to": "+1234567890", "status": "IN_PROGRESS", "headerTimeZone": "America/New_York", "retryDelaySeconds": 60, "callbackUrl": "https://my.callback.server", "projectId": "YOUR_PROJECT_ID", "serviceId": "YOUR_SERVICE_ID", "maxRetries": 3, "createTime": "2023-10-23T21:06:52.231Z", "headerPageNumbers": true, "contentUrl": [ "www.google.com" ], "imageConversionMethod": "HALFTONE", "hasFile": false }
- v3.0 of the Fax APIhttps://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes/{id}/file
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X DELETE \
-u <username>:<password> \
https://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes/01F3J0G1M4WQR6HGY6HCF6JA0K/file- v3.0 of the Fax APIhttps://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes/{id}/file.{fileFormat}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://fax.api.sinch.com/v3/projects/YOUR_project_id/faxes/01F3J0G1M4WQR6HGY6HCF6JA0K/file.pdfRequest
This webhook is triggered when a fax is received on a Sinch number associated with a service. The webhook will contain information about the fax, such as the sender, the recipient, and the content of the fax. You set the callback URL for incoming fax events on the service, either through the dashboard or using the service API.
Multipart/form-data request payloads are encoded as forms with a content type of JSON and the actual fax content as a 'file' application/pdf attachment.
Application/json request payloads are a JSON object with the file encoded as a base64 string as part of the JSON object.
- multipart/form-data
- application/json
The value is always INCOMING_FAX for this event.
| Enum Value | Description |
|---|---|
| INCOMING_FAX | A webhook event triggered by an fax is incoming. |
| FAX_COMPLETED | A webhook event triggered by a fax that has successfully completed. |
- v3.0 of the Fax APIhttps://fax.api.sinch.com/v3/projects/YOUR_project_id/incomingFax
- multipart/form-data
- application/json
{
"event": "INCOMING_FAX",
"eventTime": "2021-11-01T23:25:67Z",
"fax": {
"id": "01HDFHACK1YN7CCDYRA6ZRMA8Z",
"direction": "INBOUND",
"from": "+14155552222",
"to": "+14155553333",
"numberOfPages": 1,
"status": "COMPLETED",
"price": {
"amount": "0.00",
"currencyCode": "USD"
},
"createTime": "2021-11-01T23:25:67Z",
"completedTime": "2021-11-01T23:25:67Z",
"projectId": "YOUR_PROJECT_ID",
"serviceId": "YOUR_SERVICE_ID"
},
"file": "{application/pdf}"
}Request
Triggered when the fax has been completed. The callback will contain information about the fax, such as the sender, the recipient, and the content of the fax. You must set the callback URL where you want the callback sent when you make a send fax request.
- multipart/form-data
- application/json
Always fax completed for this event.
| Enum Value | Description |
|---|---|
| INCOMING_FAX | A webhook event triggered by an fax is incoming. |
| FAX_COMPLETED | A webhook event triggered by a fax that has successfully completed. |
- v3.0 of the Fax APIhttps://fax.api.sinch.com/v3/projects/YOUR_project_id/faxCompleted
- multipart/form-data
- application/json
{
"event": "FAX_COMPLETED",
"eventTime": "2021-11-01T23:25:67Z",
"fax": {
"id": "01HDFHACK1YN7CCDYRA6ZRMA8Z",
"direction": "INBOUND",
"from": "+14155552222",
"to": "+14155553333",
"numberOfPages": 1,
"status": "COMPLETED",
"price": {
"amount": "0.07",
"currencyCode": "USD"
},
"createTime": "2021-11-01T23:25:67Z",
"completedTime": "2021-11-01T23:25:67Z",
"callbackUrl": "https://www.my-website.com/callback",
"callbackUrlContentType": "multipart/form-data",
"imageConversionMethod": "HALFTONE",
"projectId": "YOUR_PROJECT_ID",
"serviceId": "YOUR_SERVICE_ID"
},
"file": "{application/pdf}"
}Webhooks allow you to get updates in real-time about the status of your faxes. Webhooks are triggered by events such as the completion of a fax, and transmit information about the state of that fax to you via HTTP(S) or email. HTTP webhooks are multipart/form-data POST requests, and should be processed like form submissions.
The Emails endpoint allows you to configure the Fax to Email functionality. Fax to Email allows you to send an email and then receive a fax on your Sinch number or send a fax and have it sent to your email address. The service supports sending incoming faxes to multiple email addresses and having many numbers associated with one email address.
You can add cover pages to Sinch Fax either via the API or the Build dashboard.
A Fax service can have 0 or more cover pages configured.
A fax service identifies a set of configuration values. You can specify the service as a part of an API request or by associating a Sinch number with a service.
This can be useful if you want to point a group of numbers to a particular incoming fax URL, or want to set the storage strategy for some of your numbers but not all of them.