Tutorials

How to Send MMS with Sinch API and Node.js: Complete 2026 Developer Guide

Learn how to send MMS messages with Sinch API, Node.js, and Express. Complete tutorial with media handling, fallback SMS, error handling, and production deployment best practices for multimedia messaging.

JH
Jacky Hossein
β€’ Principal Telecommunications Architect β€’ Published Nov 4, 2026 β€’ 17 min read

Developer Quick-Start: Learn how to send MMS messages with Sinch API, Node.js, and Express. Complete tutorial with media handling, fallback SMS, error handling, and production deployment best practices for multimedia messaging. Want to skip 10DLC vetting queues, carrier surcharges, and multi-step SDK boilerplate? You can send the same SMS directly via SMSRoute's REST API with instant no-KYC provisioning.

You'll build a production-ready Node.js application using the Express framework to send Multimedia Messaging Service (MMS) messages via the Sinch MMS JSON API. This guide covers everything from initial project setup to deployment and monitoring.

Important: Sinch offers multiple APIs (e.g., legacy APIs, unified Messages API). This guide focuses on a specific MMS JSON API structure. **Always verify endpoints, payload structures, authentication methods, and specific behaviors against the current, official Sinch documentation relevant to your account and the specific API product version you are using.** API details can change.

By the end of this tutorial, you will have a functional Express API endpoint capable of accepting MMS details (recipient number, media URLs, text) and dispatching the message through Sinch, including handling fallbacks to SMS.

Project Overview and Goals

Goal: To create a robust backend service that enables sending MMS messages programmatically using Sinch's dedicated MMS API.

Problem Solved: Provides a reliable way to integrate rich media messaging into applications, automating communication workflows that require images, videos, or other media alongside text. This is essential for marketing campaigns, transactional notifications with visual content, and customer engagement workflows that need multimedia support.

Technologies Used:

  • Node.js: A JavaScript runtime environment for building server-side applications.
  • Express: A minimal and flexible Node.js web application framework used to build the API layer.
  • Axios: A promise-based HTTP client for making requests to the Sinch API.
  • dotenv: A module to load environment variables from a .env file for secure credential management.
  • Sinch MMS JSON API: The specific Sinch API endpoint and protocol for sending MMS messages (subject to verification against current documentation).

System Architecture:

+-------------+       +---------------------+       +-----------------+
| Your Client | ----> | Node.js/Express App | ----> | Sinch MMS API |
| (e.g., Web, |       | (API Endpoint)      |       |                 |
| Mobile App) |       +---------------------+       +-----------------+
+-------------+               |
                              | (Optional)
                              v
                        +-------------+
                        | Database    |
                        | (Logging)   |
                        +-------------+

(Note: This is a simplified text-based representation.)

Prerequisites:

  • Node.js and npm (or Yarn) installed. As of January 2025, Node.js 22 is the current LTS version (codenamed 'Jod') recommended for production use. Node.js 18.x reaches end-of-life on April 30, 2025 – plan to upgrade to Node.js 20 or 22 for continued support.
  • Note: This guide uses Express v5.x (released October 2024) which requires Node.js 18+. Express 5 includes security improvements, async error handling, and drops support for Node.js versions before v18.
  • Note: This guide uses Axios v1.12.x for HTTP requests. Current versions include improved fetch adapter support and enhanced timeout configuration.
  • A Sinch account with access to the MMS API product you intend to use.
  • Your Sinch Service Plan ID (may also be called Campaign ID or similar - verify term in your dashboard/docs).
  • Your Sinch API Token associated with the Service Plan ID.
  • A Sinch provisioned phone number (Short Code,

Toll-Free , or 10DLC) capable of sending MMS.

  • Publicly accessible URLs for the media files (images, videos, audio, etc.) you intend to send. These servers must return a Content-Length header.
  • Familiarity with the official Sinch MMS API documentation for verification.

How to Set Up a Node.js Project for Sinch MMS Integration

Initialize your Node.js project and install the necessary dependencies.

Step 1: Create Project Directory

Open your terminal and create a new directory for the project, then navigate into it.

mkdir sinch-mms-sender
cd sinch-mms-sender

Step 2: Initialize Node.js Project

Initialize the project using npm. Accept the defaults or customize as needed.

npm init -y

This creates a package.json file.

Step 3: Install Dependencies

We need Express for the server, Axios to make HTTP requests, and dotenv to handle environment variables. We'll also add nodemon as a development dependency for easier development.

npm install express axios dotenv
npm install --save-dev nodemon

Step 4: Configure Environment Variables

Create a file named .env in the root of your project. This file will store your sensitive credentials and configuration. Never commit this file to version control.

# .env

# --- Sinch Credentials ---
# Get these from your Sinch Customer Dashboard (e.g., under SMS -> APIs)
# Replace placeholders with your actual values.

# Your Service Plan ID (or Campaign ID - verify term)
SINCH_SERVICE_PLAN_ID=YOUR_SERVICE_PLAN_ID

# Your API Token for the Service Plan ID
SINCH_API_TOKEN=YOUR_API_TOKEN

# Your provisioned Sinch Number (use E.164 format, e.g., +1xxxxxxxxxx)
SINCH_NUMBER=YOUR_SINCH_PHONE_NUMBER

# --- Sinch API Configuration ---
# CRITICAL: Verify the correct API base URL and structure in the official Sinch documentation
# for your specific region (us, eu, au, etc.) and API product version.
# The structure might require the service plan ID in the path as shown, or it might be different.
# Example structure (VERIFY THIS):
SINCH_API_BASE_URL=https://us.mms.api.sinch.com/v1/services/YOUR_SERVICE_PLAN_ID

# --- Server Configuration ---
# Port your Express server will listen on
PORT=3000

# Optional: Logging level (e.g., 'info', 'debug', 'warn', 'error')
# LOG_LEVEL=info
  • SINCH_SERVICE_PLAN_ID: Found on your Sinch Customer Dashboard. The exact name and location might vary. Replace YOUR_SERVICE_PLAN_ID with your actual ID.
  • SINCH_API_TOKEN: Found on the Sinch Customer Dashboard, often near the Service Plan ID configuration. Replace YOUR_API_TOKEN with your actual token.
  • SINCH_NUMBER: A virtual number assigned to your Sinch account, capable of sending MMS. Use the E.164 international format (e.g., +12223334444). Replace YOUR_SINCH_PHONE_NUMBER with your actual Sinch number.
  • SINCH_API_BASE_URL: The base URL for the Sinch MMS API. Crucially, verify the correct URL and structure in the official Sinch documentation. It can vary based on region, API version, and whether the Service Plan ID is part of the path. The example provided is common but requires verification. Replace YOUR_SERVICE_PLAN_ID within the URL if this structure is correct for your API.
  • PORT: The port your Express server will listen on.

Step 5: Set Up Project Structure

Create the following basic structure:

sinch-mms-sender/
β”œβ”€β”€ node_modules/
β”œβ”€β”€ public/             # (Optional: for static files if needed)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ controllers/    # Request/response handling
β”‚   β”‚   └── mmsController.js
β”‚   β”œβ”€β”€ services/       # Business logic (Sinch interaction)
β”‚   β”‚   └── sinchService.js
β”‚   β”œβ”€β”€ routes/         # API route definitions
β”‚   β”‚   └── mmsRoutes.js
β”‚   β”œβ”€β”€ app.js          # Express app configuration
β”‚   └── server.js       # Server entry point
β”œβ”€β”€ .env                # Environment variables (DO NOT COMMIT)
β”œβ”€β”€ .gitignore          # Git ignore file
β”œβ”€β”€ package.json
└── package-lock.json

Create the src directory and the subdirectories/files within it.

Step 6: Create .gitignore

Create a .gitignore file in the project root to prevent committing sensitive files and unnecessary directories.

# .gitignore
node_modules/
.env
npm-debug.log
*.log

Step 7: Add Run Scripts to package.json

Modify the scripts section in your package.json:

{
  "scripts": {
    "start": "node src/server.js",
    "dev": "nodemon src/server.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  }
}

(Note: The test script is a placeholder. It will be updated in Section 13 when testing with Jest is introduced.)

  • npm start: Runs the application using Node.
  • npm run dev: Runs the application using nodemon, which automatically restarts the server on file changes.

How to Implement the Sinch MMS Service Layer

This service will encapsulate the logic for interacting with the Sinch MMS API.

File: src/services/sinchService.js

const axios = require('axios');

require('dotenv').config();

const SINCH_SERVICE_PLAN_ID = process.env.SINCH_SERVICE_PLAN_ID;
const SINCH_API_TOKEN = process.env.SINCH_API_TOKEN;
const SINCH_API_BASE_URL = process.env.SINCH_API_BASE_URL;

if (!SINCH_SERVICE_PLAN_ID || !SINCH_API_TOKEN || !SINCH_API_BASE_URL) {
    console.error("Error: Missing Sinch credentials or API base URL in .env file. Please check SINCH_SERVICE_PLAN_ID, SINCH_API_TOKEN, and SINCH_API_BASE_URL.");
    process.exit(1);
}

const SEND_MMS_ENDPOINT = `${SINCH_API_BASE_URL}/actions/sendmms`;

const sendMms = async (to, from, subject, slides, fallbackText, options = {}) => {
    console.log(`Attempting to send MMS to ${to} from ${from}`);


    if (!to || !from || !subject || !Array.isArray(slides) || slides.length === 0) {
        throw new Error('Missing required parameters: to, from, subject, or non-empty slides array.');
    }
    if (!to.startsWith('+') || !from.startsWith('+')) {
        console.warn(`Warning: Phone numbers should be in E.164 format (start with +). To: ${to}, From: ${from}`);

    }
    if (slides.length > 8) {
        console.warn('Warning: Maximum of 8 slides recommended per Sinch guidelines.');
    }


     const disableFallbackSms = options.disableFallbackSms === true;

     if (!disableFallbackSms && !fallbackText) {

         throw new Error('fallbackText is required when disableFallbackSms is false (or not provided).');
     }


    const payload = {
        action: 'sendmms',
        'service-id': SINCH_SERVICE_PLAN_ID,
        to: to,
        from: from,
        'message-subject': subject,
        slide: slides,

        'fallback-sms-text': disableFallbackSms ? undefined : fallbackText,
        'disable-fallback-sms': options.disableFallbackSms || false,
        'disable-fallback-sms-link': options.disableFallbackSmsLink || false,


        'client-reference': options.clientReference,
        'cache-content': options.cacheContent === undefined ? true : options.cacheContent,
    };


    Object.keys(payload).forEach(key => payload[key] === undefined && delete payload[key]);

    console.log('Constructed Sinch Payload:', JSON.stringify(payload, null, 2));

    try {

        const response = await axios.post(SEND_MMS_ENDPOINT, payload, {
            headers: {
                'Content-Type': 'application/json; charset=utf-8',
                'Authorization': `Bearer ${SINCH_API_TOKEN}`
            },
            timeout: 15000
        });

        console.log('Sinch API Response Status:', response.status);
        console.log('Sinch API Response Data:', JSON.stringify(response.data, null, 2));



        if (response.data && response.data.status === 'success' && response.data['tracking-id']) {
             console.log(`MMS successfully queued with Sinch. Tracking ID: ${response.data['tracking-id']}`);
            return response.data;
        } else {

            console.error('Sinch API response body indicates potential issue:', response.data);
            throw new Error(`Sinch API did not return expected success status or tracking-id in response body: ${JSON.stringify(response.data)}`);
        }

    } catch (error) {
        console.error('Error sending MMS via Sinch:', error.message);
        let errorMessage = 'Failed to send MMS via Sinch API.';

        if (error.response) {

            console.error('Sinch API Error Status:', error.response.status);
            console.error('Sinch API Error Headers:', error.response.headers);
            console.error('Sinch API Error Data:', JSON.stringify(error.response.data, null, 2));

            const errorDetails = error.response.data ? `: ${JSON.stringify(error.response.data)}` : '';
            errorMessage = `Sinch API request failed with status ${error.response.status}${errorDetails}`;
        } else if (error.request) {

            console.error('Sinch API No Response Received. Request details:', error.request);
            errorMessage = 'No response received from Sinch API. Check network connectivity and endpoint URL.';
        } else {

            console.error('Axios Request Setup Error:', error.message);
            errorMessage = `Error setting up request to Sinch API: ${error.message}`;
        }

        throw new Error(errorMessage);
    }
};

module.exports = {
    sendMms,
};

Explanation:

  1. Dependencies & Config: Imports axios and dotenv. Loads environment variables and checks for essential Sinch credentials and the base URL, exiting if missing.
  2. Endpoint Construction: Defines the full URL for the sendmms action based on the SINCH\_API\_BASE\_URL. Includes a prominent warning to verify this endpoint against official documentation.
  3. sendMms Function:
  • Takes required parameters (to, from, subject, slides) and optional fallbackText and options.
  • Performs basic input validation (required fields, E.164 format hint, slide count).
  • Validates that fallbackText is present if fallback SMS is not explicitly disabled.
  • Constructs the JSON payload according to a common Sinch MMS JSON API specification. Includes a warning to verify the payload structure against official documentation. Handles common optional fields and cleans undefined values.
  • Uses axios.post to send the request.
  • Sets necessary headers: Content-Type and Authorization (Bearer token - verify this method).
  • Includes robust error handling for different failure scenarios (API errors with status codes, network errors, request setup errors), logging detailed information.
  • Logs the constructed payload and the received response for debugging.
  • Checks the response body for a success indicator (e.g., status: 'success' and tracking-id) as 200 OK might not guarantee acceptance. This check might need adjustment based on the specific API response structure.
  • Returns the success response data from Sinch upon successful queueing.
  • Throws detailed errors for upstream handling.

How to Build Express API Routes and Controllers for MMS

Now, let's create the Express route and controller to expose our MMS sending functionality.

File: src/routes/mmsRoutes.js

const express = require('express');
const mmsController = require('../controllers/mmsController');

const router = express.Router();

router.post('/send', mmsController.handleSendMms);

module.exports = router;

File: src/controllers/mmsController.js

const sinchService = require('../services/sinchService');

require('dotenv').config();
const SINCH_NUMBER = process.env.SINCH_NUMBER;

if (!SINCH_NUMBER) {
    console.error("FATAL: SINCH_NUMBER is not defined in .env file. Cannot determine sender number.");
    process.exit(1);
}

const handleSendMms = async (req, res) => {

    const { to, subject, slides, fallbackText, clientReference,
            disableFallbackSms, disableFallbackSmsLink  } = req.body;
    const from = SINCH_NUMBER;


    if (!to || !subject || !Array.isArray(slides) || slides.length === 0) {
        console.warn(`Validation failed for incoming request: Missing required fields.`);
        return res.status(400).json({
            status: 'error',
            message: 'Bad Request: Missing required fields: `to`, `subject`, `slides` (must be a non-empty array).',
        });
    }



    const serviceOptions = {
        clientReference,
        disableFallbackSms,
        disableFallbackSmsLink,

    };

    try {
        console.log(`Processing request to send MMS via Sinch: To=${to}, From=${from}, Subject=${subject}`);
        const result = await sinchService.sendMms(
            to,
            from,
            subject,
            slides,
            fallbackText,
            serviceOptions
        );


        console.log(`Successfully queued MMS to ${to} via Sinch. Tracking ID: ${result['tracking-id']}`);

        res.status(200).json({
            status: 'success',
            message: 'MMS request accepted by Sinch and queued for delivery.',
            data: result,
        });

    } catch (error) {

        console.error(`Failed to process MMS request for ${to}:`, error.message);




        const statusCode = error.message.includes("Sinch API request failed") || error.message.includes("required parameters") || error.message.includes("fallbackText is required") ? 400 : 500;

        res.status(statusCode).json({
            status: 'error',
            message: 'Failed to send MMS.',

            error: error.message,
        });
    }
};

module.exports = {
    handleSendMms,
};

Explanation:

  1. Routes (mmsRoutes.js): Defines a single POST route /api/mms/send that maps to the handleSendMms controller function. Includes a commented-out example showing where validation middleware (Section 7) would go.
  2. Controller (mmsController.js):
  • Imports the sinchService.
  • Loads the SINCH\_NUMBER from environment variables to use as the from number, exiting if not found.
  • Extracts expected fields (to, subject, slides, fallbackText, and optional fields like clientReference, disableFallbackSms) from the request body (req.body).
  • Performs basic validation on required fields. Strongly recommends using express-validator (Section 7) for robust validation in production.
  • Bundles optional parameters into a serviceOptions object.
  • Calls sinchService.sendMms with the extracted and validated data.
  • Handles success: Logs the success and responds with a 200 status and the Sinch API success response (which should include the tracking-id).
  • Handles errors: Catches errors thrown by the service layer, logs the detailed error message, determines an appropriate HTTP status code (400 for client-side/API input errors, 500 for internal server issues), and responds with a JSON error message including the error details from the service.

How to Configure Express Application with Sinch MMS Integration

Let's tie everything together in our main Express application file.

File: src/app.js

const express = require('express');
const mmsRoutes = require('./routes/mmsRoutes');

require('dotenv').config();

const app = express();

app.use((req, res, next) => {
    console.log(`[${new Date().toISOString()}] Incoming Request: ${req.method} ${req.originalUrl}`);
    next();
});

app.use(express.json({ limit: '1mb' }));

app.use(express.urlencoded({ extended: true }));

app.use('/api/mms', mmsRoutes);

app.get('/health', (req, res) => {

    res.status(200).json({ status: 'ok', timestamp: new Date().toISOString() });
});

app.use((req, res, next) => {
    res.status(404).json({ status: 'error', message: `Resource not found: ${req.originalUrl}` });
});

app.use((err, req, res, next) => {

    console.error("Unhandled Error:", err.stack || err);


    const statusCode = typeof err.status === 'number' ? err.status : 500;


    res.status(statusCode).json({
        status: 'error',
        message: err.message || 'Internal Server Error',

        ...(process.env.NODE_ENV === 'development' && { stack: err.stack })
    });
});

module.exports = app;

File: src/server.js

const app = require('./app');

require('dotenv').config();

const PORT = process.env.PORT || 3000;
const NODE_ENV = process.env.NODE_ENV || 'development';

const server = app.listen(PORT, () => {
    console.log(`Server running in ${NODE_ENV} mode on port ${PORT}`);
    console.log("--- Configuration Check ---");
    console.log(`Sinch Service Plan ID configured: ${process.env.SINCH_SERVICE_PLAN_ID ? 'Yes' : 'NO - Check .env!'}`);
    console.log(`Sinch API Token configured: ${process.env.SINCH_API_TOKEN ? 'Yes' : 'NO - Check .env!'}`);
    console.log(`Sinch Sender Number configured: ${process.env.SINCH_NUMBER || 'NO - Check .env!'}`);
    console.log(`Sinch API Base URL configured: ${process.env.SINCH_API_BASE_URL || 'NOT SET - Check .env!'}`);
    console.log("---------------------------");
    if (!process.env.SINCH_SERVICE_PLAN_ID || !process.env.SINCH_API_TOKEN || !process.env.SINCH_NUMBER || !process.env.SINCH_API_BASE_URL) {
        console.error("FATAL: One or more required Sinch environment variables are missing. Application might not function correctly.");
    }
});

process.on('SIGTERM', () => {
    console.log('SIGTERM signal received: closing HTTP server');

    server.close(() => {
        console.log('HTTP server closed');
        process.exit(0);
    });
});

Explanation:

  1. app.js:
  • Initializes the Express application (app).
  • Loads dotenv early.
  • Includes essential middleware: a basic request logger (recommend replacing with pino-http or similar for production), express.json() for parsing JSON bodies, and express.urlencoded() (optional).
  • Includes placeholders for security middleware (rate limiting, etc. - see Section 7).
  • Mounts the mmsRoutes under the /api/mms path prefix.
  • Adds a basic /health check endpoint for monitoring.
  • Includes a 404 handler for requests that don't match any route.
  • Implements a global error handler middleware (must have 4 arguments: err, req, res, next) to catch unhandled errors from routes or next(error) calls. It logs the error and sends a standardized JSON error response to the client, avoiding leaking stack traces in production.
  1. server.js:
  • Imports the configured app from app.js.
  • Loads dotenv again (safe if already loaded) to ensure environment variables are available here too.
  • Gets the PORT and NODE\_ENV from environment variables (with defaults).
  • Starts the Express server using app.listen and stores the server instance.
  • Logs essential configuration status on startup for quick verification, including warnings if critical Sinch variables are missing.
  • Includes optional basic graceful shutdown handling for SIGTERM, using the stored server instance.

How to Implement Error Handling, Logging, and Retry Logic for MMS

We've built foundational error handling. Let's refine logging and consider retries.

Error Handling Strategy (Recap):

  • sinchService.js: Catches axios errors during the API call. Logs detailed Sinch API error responses. Throws a new, informative Error object containing relevant details.
  • mmsController.js: Uses a try...catch block to catch errors from sinchService. Logs a summary. Responds to the client with an appropriate HTTP status (400 for known client/API errors, 500 for unexpected internal errors) and a JSON error message derived from the caught error.
  • app.js (Global Handler): Catches any errors missed by route handlers or thrown unexpectedly. Logs the full stack trace (server-side) and sends a generic 500 response to the client.

Logging Enhancements (Production):

Standard console.log/error is okay for development, but insufficient for production. Use a dedicated, structured logging library like pino.

  • Benefits: Structured JSON output (machine-readable), log levels (info, debug, warn, error, fatal), faster performance, easy integration with log shippers (Fluentd, Logstash) and management systems (ELK, Datadog, Splunk).
  • Implementation:
  1. Install: npm install pino pino-http
  2. Configure: Create a logger instance (e.g., in src/utils/logger.js).
  3. Integrate pino-http middleware in app.js for automatic request/response logging.
  4. Replace console.log/error calls throughout your services and controllers with logger.info(), logger.warn(), logger.error(), etc. Pass error objects directly to logger.error(error, "Optional message") for stack trace logging.

Retry Mechanisms:

Network issues or temporary Sinch API unavailability (e.g., 5xx errors) can occur. Retrying failed requests can improve resilience.

  • When to Retry: Typically retry on transient errors: network timeouts, DNS issues, 502 Bad Gateway, 503 Service Unavailable, 504 Gateway Timeout. Do not retry on permanent errors like 4xx (Bad Request, Unauthorized, Not Found) as the request is unlikely to succeed without changes.
  • Strategy: Implement exponential backoff (wait longer between each retry) to avoid overwhelming the API.
  • Library: axios-retry simplifies this.

Example using axios-retry:

  1. Install: npm install axios-retry
  2. Modify src/services/sinchService.js:
const axios = require('axios');

const axiosRetry = require('axios-retry').default;

const sinchApiClient = axios.create({
    baseURL: SINCH_API_BASE_URL,
    timeout: 15000,
    headers: {
        'Content-Type': 'application/json; charset=utf-8',
        'Authorization': `Bearer ${SINCH_API_TOKEN}`
    }
});

axiosRetry(sinchApiClient, {
    retries: 3,
    retryDelay: (retryCount) => {
        console.log(`Retry attempt: ${retryCount}`);
        return retryCount * 1000;
    },
    retryCondition: (error) => {

        return (
            axiosRetry.isNetworkOrIdempotentRequestError(error) ||
            (error.response && error.response.status >= 500 && error.response.status <= 599)
        );
    },
    onRetry: (retryCount, error, requestConfig) => {
        console.warn(`Retrying request to ${requestConfig.url} due to error: ${error.message}. Attempt ${retryCount}`);
    }
});

try {








    const endpointPath = new URL(SEND_MMS_ENDPOINT).pathname;
    const response = await sinchApiClient.post(endpointPath, payload);



} catch (error) {

    console.error('Error sending MMS via Sinch (after potential retries):', error.message);

}

(Note: The axios-retry example above is illustrative and requires careful integration with the existing sendMms function, particularly regarding how the URL/endpoint is passed to the sinchApiClient.post method based on whether baseURL is set on the instance.)


Frequently Asked Questions About Sinch MMS Integration

What Node.js version do I need for Sinch MMS integration?

You need Node.js 18 or later for this Sinch MMS implementation. As of January 2025, Node.js 22 (codenamed 'Jod') is the current LTS version recommended for production. Node.js 18.x reaches end-of-life on April 30, 2025 – plan to upgrade to Node.js 20 or 22 for continued support. This guide uses Express v5.x, which requires Node.js 18+ and includes security improvements and async error handling.

What are the MMS file size limits for Sinch API?

Sinch MMS supports up to 8 slides per message, with each slide containing text and/or one media type (image, audio, video). The recommended file size is under 500 KB for reliable delivery across all carriers. While most US and Canadian carriers accept up to 1 MB, carrier-specific limits vary: AT&T accepts up to 1 MB, Verizon up to 1.7 MB, and T-Mobile up to 3 MB. All media files must serve a valid Content-Length header and proper Content-Type headers (e.g., image/jpeg, video/mp4).

How do I authenticate with the Sinch MMS API?

Sinch MMS API uses Bearer token authentication. Include your API token in the Authorization header as Bearer YOUR_API_TOKEN. You'll also need your Service Plan ID (sometimes called Campaign ID), which may be included in the API endpoint path or request payload depending on your API version. Always verify the authentication method and endpoint structure in the official Sinch documentation for your specific account and region (US, EU, AU).

What's the difference between Sinch MMS JSON API and XML API?

Sinch offers two MMS APIs: the XML API (industry standard for sending rich multimedia content with higher throughput) and the MM7 API (SOAP-based protocol used by carriers). This guide focuses on the JSON API, which sends MMS messages defined in JSON format to mobile numbers via HTTP POST requests. The JSON API requires UTF-8 encoded JSON data and supports slides with embedded text, images, videos, audio, and other objects.

How do I handle MMS delivery failures and fallback to SMS?

The Sinch MMS API includes automatic fallback to SMS when MMS delivery fails or is disabled by the recipient. Set fallback-sms-text in your payload with the SMS message to send if MMS fails. You can disable fallback by setting disableFallbackSms: true, though this is not recommended. Set disable-fallback-sms-link: false to include a link to view media in the fallback SMS. Implement delivery status webhooks to track message delivery and handle failures in your application logic.

What error handling should I implement for Sinch MMS requests?

Implement comprehensive error handling for three scenarios: API errors (4xx/5xx status codes), network errors (timeouts, DNS failures), and request setup errors. Log detailed error information including Sinch API error responses. Use axios-retry with exponential backoff for transient errors (5xx, network issues) but don't retry 4xx client errors. Set reasonable timeouts (15 seconds recommended). Use structured logging (pino) in production. Implement global error handlers in Express to catch unhandled errors.

How do I validate phone numbers and media URLs for MMS?

Validate that phone numbers use E.164 international format (starting with +, e.g., +12223334444) for both sender and recipient. Check that the recipient number is MMS-capable. Validate media URLs are publicly accessible and return proper Content-Length and Content-Type headers. Verify file sizes are under carrier limits (500 KB recommended). Validate slide count (max 8), subject length (max 80 chars, 40 recommended), and text length (up to 1600 chars). Use express-validator middleware for robust production validation.

Use a layered architecture: services/ for business logic (Sinch API interaction), controllers/ for request/response handling, routes/ for API route definitions, and app.js for Express configuration. Separate concerns by keeping API logic in the service layer, validation in middleware, and HTTP handling in controllers. Store credentials in .env files (never commit to version control). Use environment-specific configurations. Implement proper error boundaries at each layer.

How do I test MMS sending in development without sending real messages?

Use Sinch's sandbox/test environment if available for your account. Mock the Sinch API responses using tools like nock or msw (Mock Service Worker) in your unit tests. Create integration tests that verify request payloads without calling the real API. Use Jest for testing with axios-mock-adapter to intercept HTTP requests. Implement feature flags to disable MMS sending in development. Log request payloads to verify correct message formatting before enabling production sends.

What are the rate limits for Sinch MMS API?

Sinch MMS API rate limits vary by account and service plan. Each service plan has a maximum messages per second (MPS) setting, with default limits varying by account type. For batch messages with multiple recipients, each recipient counts toward the rate limit. Status query limits are typically 1 request per second per IP address (HTTP 429 if exceeded). Maximum API concurrency is often 700 requests per second per IP address. Check your specific rate limits in the Sinch Dashboard under your service plan details and contact Sinch support for higher volume adjustments.

Simpler Alternative: Send the Same SMS With SMSRoute (No-KYC, Direct Routes)

If you want to replace legacy aggregator SDK boilerplate, multi-week compliance queues, and opaque carrier surcharges with a single HTTP request, SMSRoute delivers global SMS over direct Tier-1 carrier interconnects with instant API access and transparent per-country pricing.

curl -X POST https://api.sendsmsnokyc.com/messages \
  -H "x-api-key: $SMSROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["+14155551234"],
    "channel": ["sms"],
    "body": "Your verification code is 482910"
  }'
  • Instant onboarding: No KYC paperwork or sales queues β€” grab an API key and fund with crypto (BTC/USDT) or card.
  • Direct Tier-1 routes: Verify real handset delivery, DLR latency, and Sender ID preservation before launch via SMSRoute Live Carrier Testing.
  • Transparent global pricing: Compare exact per-country termination rates on our live pricing page.

Ship Global SMS in One API Call

Skip legacy SDK sprawl and carrier bottlenecks. Send OTPs, alerts, and bulk campaigns across 190+ countries with SMSRoute.

Explore SMSRoute Developers β†’