{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/fax/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["partial"]},"product":"Fax","type":"markdown"},"seo":{"title":"Node.js SDK Reference | Fax API | Sinch","siteUrl":"https://developers.sinch.com","llmstxt":{"title":"Sinch Developer Documentation","description":"LLMs.txt containing a map of all the documentation files for Sinch.","sections":[{"title":"Numbers API","description":"The Numbers API enables you to search for, view, and activate numbers. It's considered a precursor to other APIs in the Sinch product family. The numbers API can be used in tandem with any of our APIs that perform messaging or calling.","includeFiles":["docs/numbers/**/*.md","docs/numbers/**/*.yaml"],"excludeFiles":["docs/numbers/index.md"]},{"title":"Conversation API","description":"Send and receive messages globally on many popular channels with ease and confidence when using Sinch's Conversation API. Conversation API is the preferred API for sending mobile messages on SMS and other social channels with Sinch. It is a simple API with unified error messages, consistent request payloads, and common webhook payloads that are channel-agnostic.","includeFiles":["docs/conversation/**/*.md","docs/conversation/**/*.yaml"],"excludeFiles":["docs/conversation/index.md"]},{"title":"Voice API (legacy/GA)","description":"Which Voice API? If you are building something using voice AI agents, use the Voice API v2. To learn more, you can read [Why migrate to v2?](/docs/voice-2.0/migration.md) or [What's new?](/docs/voice-2.0/whatsnew.md).\n\nThe Voice API works as a big telephony switch. The Voice API handles incoming phone calls (also known as incoming call “legs”), sets up outgoing phone calls (or outgoing call “legs”), and bridges the two. The incoming call leg may come in over a data connection (from a smartphone or web application using the Sinch SDKs) or through a local phone number (from the PSTN network). Similarly, the outgoing call leg can be over data (to another smartphone or web application using the Sinch SDKs) or the PSTN network.","includeFiles":["docs/voice/**/*.md"],"excludeFiles":["docs/voice/index.md"]},{"title":"Voice API v2 (recommended for new builds/preview)","description":"Which Voice API? If you are building something using voice AI agents, use the Voice API v2. To learn more, you can read [Why migrate to v2?](/docs/voice-2.0/migration.md) or [What's new?](/docs/voice-2.0/whatsnew.md).\n\nThe Voice API v2 enables embedding voice calling into applications for virtually limitless use cases. From voice-enabling AI agents to allow real-time conversational AI workflows over the phone, to number masking for privacy, automated appointment reminders, and outreach campaigns with answering machine detection, to bridging calls between PSTN and SIP endpoints, the API offers the flexibility and control needed for modern communications. The Sinch Programmable Voice is a cloud-native global voice platform, composed by multiple Inbound and Outbound voice channels. All these channels can be combined using our powerful markup language called SVAML v2, creating a toolbox capable of building almost limitless use cases. Our SVAML uses the concept of commands, and customers can use a combination of our commands to interact with calls in all channels, in order to model from the most basic to highly complex scenarios, required to fulfill their voice calling needs.","includeFiles":["docs/voice-2.0/**/*.md"],"excludeFiles":["docs/voice-2.0/index.md"]},{"title":"Verification API","description":"The Verification API is a platform for phone number verification. It consists of the API and different software development kits (the Sinch SDKs) that you integrate with your smartphone or web application and cloud based back-end services. Together they enable SMS, Flashcall, Phone Call and Data verification in your application.","includeFiles":["docs/verification/**/*.md","docs/verification/**/*.yaml"],"excludeFiles":["docs/verification/index.md"]},{"title":"Provisioning API","description":"Provisioning API allows you to programmatically set up your senders, accounts and templates on your favorite messaging platforms on the Conversation API. For now, you can create your first WhatsApp channel through Meta's Embedded sign up, you can configure your first SMS App and configure your webhooks. As development continues, we will be adding the most commonly used channels.","includeFiles":["docs/provisioning-api/**/*.md","docs/provisioning-api/**/*.json"],"excludeFiles":["docs/provisioning-api/index.md"]},{"title":"Elastic SIP Trunking API","description":"With Elastic SIP Trunking you can create and manage your SIP trunks and phone numbers programmatically.","includeFiles":["docs/est/**/*.md","docs/est/**/*.yaml"],"excludeFiles":["docs/est/index.md"]},{"title":"Fax API","description":"Send and receive HIPAA compliant faxes on our modern fax platform using our developer-friendly API.","includeFiles":["docs/fax/**/*.md","docs/fax/**/*.yaml"],"excludeFiles":["docs/fax/index.md"]},{"title":"In-app Voice and Video SDK","description":"The In-app Voice and Video SDK enables you to add voice and video calling capabilities directly into your mobile or web application using the Sinch SDKs.","includeFiles":["docs/in-app-calling/**/*.md"],"excludeFiles":["docs/in-app-calling/index.md"]},{"title":"Number Lookup API","description":"The Number Lookup API is designed to provide in-depth information about phone numbers, helping enterprises enhance their communication strategies and prevent fraud. By identifying the type of phone line (for example, mobile, landline, VoIP) and the associated carrier, the API allows businesses to optimize routing, reduce unnecessary costs, and improve customer engagement.","includeFiles":["docs/number-lookup-api-v2/**/*.md","docs/number-lookup-api-v2/**/*.yaml"],"excludeFiles":["docs/number-lookup-api-v2/index.md"]},{"title":"Functions","description":"Serverless compute for voice and messaging. Deploy your code and Sinch routes live calls and messages to it — no infrastructure to run.","includeFiles":["docs/functions/functions/**/*.md","docs/functions/concepts/**/*.md","docs/functions/ai-support.md","docs/functions/reference/**/*.md"],"excludeFiles":["docs/functions/functions/index.md"]},{"title":"CLI","description":"One command line for Sinch numbers, messaging, voice, fax, SIP trunking and porting, and the full Functions lifecycle — scaffold, run locally, deploy, and manage.","includeFiles":["docs/functions/cli/**/*.md"],"excludeFiles":["docs/functions/cli/index.md"]}]},"description":"Learn the syntax of the Sinch Node.js SDK for Fax API."},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"sinch-nodejs-sdk-for-fax-api","__idx":0},"children":["Sinch Node.js SDK for Fax API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sinch Node.js SDK allows you to quickly interact with the ","Fax API"," from inside your Node.js applications. When using the Node.js SDK, the code representing requests and queries sent to and responses received from the ","Fax API"," are structured similarly to those that are sent and received using the ","Fax API","."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The fastest way to get started with the SDK is to check out our ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/fax/getting-started"},"children":["getting-started"]}," guides. There you'll find all the instructions necessary to download, install, set up, and start using the SDK."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"syntax","__idx":1},"children":["Syntax"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Note:"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide describes the syntactical structure of the Node.js SDK for the Fax API, including any differences that may exist between the API itself and the SDK. For a full reference on Fax API calls and responses, see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/fax/api-reference/fax"},"children":["Fax API Reference"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The code sample below is an example of how to use the Node.js SDK to send a fax. We've also provided an example that accomplishes the same task using the REST API."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"SDK","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"file":"/code-snippets/node-sdk/fax/send-fax.sample.js","language":"javascript","title":"start.js","header":{"title":"start.js","controls":{"copy":{}}},"lang":"javascript","source":"/**\n * Class to send a demo fax using the Sinch Node.js SDK.\n */\nexport class FaxSample {\n  /**\n   * @param { import('@sinch/sdk-core').FaxService } faxService - the FaxService instance from the Sinch SDK containing the API methods.\n   */\n  constructor(faxService) {\n    this.faxService = faxService;\n  }\n\n  async start() {\n    const recipient = 'YOUR_FAX_NUMBER';\n    const contentUrl = 'https://developers.sinch.com/fax/fax.pdf';\n    const callbackUrl = 'FAX_CALLBACK_URL';\n\n    const response = await this.faxService.faxes.send({\n      sendFaxRequestBody: {\n        to: recipient,\n        contentUrl,\n        ...(callbackUrl !== 'FAX_CALLBACK_URL' && { callbackUrl }),\n      },\n    });\n\n    const fax = response[0];\n    console.log('Fax ID:', fax.id);\n    console.log('Status:', fax.status);\n    console.log('Response:', response);\n  }\n}\n"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"REST API","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const ACCESS_KEY = \"YOUR_access_key\";\nconst ACCESS_SECRET = \"YOUR_access_secret\";\nconst PROJECT_ID = \"YOUR_project_id\";\nconst TO_NUMBER = \"YOUR_to_number\";\nconst CONTENT_URL = \"YOUR_content_url\";\nconst CALLBACK_URL = \"YOUR_callback_url\";\n\nlet config = {\n  baseURL: \"https://fax.api.sinch.com/v3/projects/\" + PROJECT_ID,\n  auth: {\n      username: ACCESS_KEY,\n      password: ACCESS_SECRET\n  }\n};\n\nconst apiClient = require('axios').create(config);\n\nconst faxBody = {\nto:  TO_NUMBER,\ncontentUrl: CONTENT_URL,\ncallbackUrl: CALLBACK_URL\n};\n\napiClient\n  .post('/faxes/', faxBody)\n  .then((response) => console.log(response));\n","lang":"javascript"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example highlights the following required to successfully make a Fax API call using the Sinch Node.js SDK:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#client"},"children":["Client initialization"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#fax-domain"},"children":["Fax domain access"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#endpoint-categories"},"children":["Endpoint usage"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#request-and-query-parameters"},"children":["Field population"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"client","__idx":2},"children":["Client"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When using the Sinch Node.js SDK, you initialize communication with the Sinch backend by initializing the Node.js SDK's main client class. This client allows you to access the functionality of the Sinch Node.js SDK."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"initialization","__idx":3},"children":["Initialization"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To start using the SDK, you need to initialize the main client class with your credentials from your Sinch ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://dashboard.sinch.com/dashboard"},"children":["dashboard"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const {SinchClient} = require('@sinch/sdk-core');\n\nconst sinchClient = new SinchClient({\n    projectId: \"YOUR_project_id\",\n    keyId: \"YOUR_access_key\",\n    keySecret: \"YOUR_access_secret\"\n});\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For testing purposes on your local environment it's fine to use hardcoded values, but before deploying to production we strongly recommend using environment variables to store the credentials, as in the following example:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," File"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"PROJECTID=\"YOUR_project_id\"\nACCESSKEY=\"YOUR_access_key\"\nACCESSSECRET=\"YOUR_access_secret\" \n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["app.js"]}," File"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const {SinchClient} = require('@sinch/sdk-core');\n\nconst sinchClient = new SinchClient({\n    projectId: process.env.PROJECTID,\n    keyId: process.env.ACCESSKEY,\n    keySecret: process.env.ACCESSSECRET\n});\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"fax-domain","__idx":4},"children":["Fax domain"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sinch Node.js SDK organizes different functionalities in the Sinch product suite into domains. These domains are accessible through the client. For example, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sinch.fax.[endpoint_category].[method()]"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"endpoint-categories","__idx":5},"children":["Endpoint categories"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the Sinch Node.js SDK, Fax API endpoints are accessible through the client. The naming convention of the endpoint's representation in the SDK matches the API:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-node/1.8.0/classes/FaxesApi.html"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fax.faxes"]},{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/external-blue.5a59beb5e5a442f78b530509ddf6b5d0fa705285ff8181e59adf96b5c2c73e25.33310b29.svg","alt":"external"},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-node/1.8.0/classes/CoverPagesApi.html"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fax.coverPages"]},{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/external-blue.5a59beb5e5a442f78b530509ddf6b5d0fa705285ff8181e59adf96b5c2c73e25.33310b29.svg","alt":"external"},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-node/1.8.0/classes/FaxToEmailApi.html"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fax.faxToEmail"]},{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/external-blue.5a59beb5e5a442f78b530509ddf6b5d0fa705285ff8181e59adf96b5c2c73e25.33310b29.svg","alt":"external"},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developers.sinch.com/sdk/sinch-sdk-node/1.8.0/classes/ServicesApi.html"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fax.services"]},{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/external-blue.5a59beb5e5a442f78b530509ddf6b5d0fa705285ff8181e59adf96b5c2c73e25.33310b29.svg","alt":"external"},"children":[]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const response = await fax.faxes.send({\n      sendFaxRequestBody: {\n        to: recipient,\n        contentUrl,\n        ...(callbackUrl !== 'FAX_CALLBACK_URL' && { callbackUrl }),\n      },\n});\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"request-and-query-parameters","__idx":6},"children":["Request and query parameters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Requests and queries made using the Node.js SDK are similar to those made using the Fax API. Path parameters, request body parameters, and query parameters that are used in the API are all passed as arguments to the corresponding Node.js method."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example, consider this example in which the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["get()"]}," method of the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fax.faxes"]}," class is invoked:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const response = await sinch.fax.faxes.get({ id: faxId });\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"\nurl = \"https://fax.api.sinch.com/v3/projects/${projectId}/faxes/${faxId}\"\n\n","lang":"JSON"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When using the Fax API, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["faxId"]}," would be included as a path parameter in the request. With the Node.js SDK, the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["faxId"]}," parameter is used in an object passed as an argument in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["get()"]}," method."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"responses","__idx":7},"children":["Responses"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response fields match the API responses. They are delivered as Javascript objects."]}]},"headings":[{"value":"Sinch Node.js SDK for Fax API","id":"sinch-nodejs-sdk-for-fax-api","depth":1},{"value":"Syntax","id":"syntax","depth":2},{"value":"Client","id":"client","depth":2},{"value":"Initialization","id":"initialization","depth":3},{"value":"Fax domain","id":"fax-domain","depth":2},{"value":"Endpoint categories","id":"endpoint-categories","depth":2},{"value":"Request and query parameters","id":"request-and-query-parameters","depth":2},{"value":"Responses","id":"responses","depth":2}],"frontmatter":{"seo":{"title":"Node.js SDK Reference | Fax API | Sinch","description":"Learn the syntax of the Sinch Node.js SDK for Fax API."},"product":"Fax API"},"lastModified":"2026-10-28T18:19:53.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/fax/sdk/node/syntax-reference","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}