Tutorials

Implementing Sinch Callbacks with Next.js and Node.js

A step-by-step guide to setting up a secure Next.js API route to handle Sinch message delivery status and other callbacks using HMAC validation.

JH
Jacky Hossein
β€’ Principal Telecommunications Architect β€’ Published Nov 5, 2026 β€’ 14 min read

Developer Quick-Start: A step-by-step guide to setting up a secure Next.js API route to handle Sinch message delivery status and other callbacks using HMAC validation. 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.

This guide provides a comprehensive, step-by-step walkthrough for integrating Sinch callbacks, particularly message delivery status updates, into a Next.js application. We'll build a Node.js-based API endpoint within Next.js to securely receive and process these callbacks.

Project Overview and Goals

What We'll Build:

We will create a Next.js application with a dedicated API route that acts as a webhook endpoint for Sinch. This endpoint will securely receive callback events (like MESSAGE_DELIVERY or MESSAGE_INBOUND), validate their authenticity using HMAC signatures, and process the incoming data (initially by logging, but extensible for database updates, real-time notifications, etc.).

Problem Solved:

Sinch operates asynchronously. When you send a message, the initial API call confirms acceptance, not final delivery. To know the actual status (delivered, failed, etc.) or receive inbound messages, your application needs to listen for callbacks sent by Sinch to a predefined URL (webhook). This guide solves the challenge of securely setting up and handling these callbacks within a modern web framework like Next.js.

Technologies Used:

  • Next.js: A React framework providing structure for frontend UI and backend API routes (serverless functions). Chosen for its ease of development, integrated API capabilities, and deployment simplicity.
  • Node.js: The runtime environment for our Next.js API route. Handles HTTP requests, JSON parsing, and cryptographic operations (for HMAC).
  • Sinch Conversation API: The Sinch service used for sending messages and configuring webhooks for callbacks.
  • (Optional) Prisma & Database: For persisting callback data (demonstrated conceptually).

System Architecture:

+-------------+       +-----------------+       +-----------------+       +------------------------+       +----------+
| User        | ----> | Next.js UI      | ----> | Sinch API (Send)| ----> | Sinch Platform         | ----> | End User |
| (Browser)   |       | (Client-Side)   |       | (e.g., SMS)     |       | (Processes & Delivers) | <---- | (Phone)  |
+-------------+       +-----------------+       +-----------------+       +------------------------+       +----------+
                                                      ^     |
                                                      |     | (Callback Request: POST /api/sinch/webhook)
                                                      |     v
                                                +----------------------------+       +----------------+
                                                | Next.js API Route (Node.js)| ----> | Optional DB    |
                                                | (Webhook Handler)          |       | (e.g., Prisma) |
                                                +----------------------------+       +----------------+

Prerequisites:

  • Node.js (v18 or later recommended) and npm/yarn installed.
  • A Sinch account with access to the Conversation API.
  • Your Sinch Project ID, App ID, and potentially API credentials (Access Key & Secret, if also sending messages).
  • Basic understanding of Next.js, API routes, and asynchronous JavaScript.
  • A tool for exposing your local development server to the internet (like ngrok) or a deployment platform (like Vercel).

Final Outcome:

By the end of this guide, you will have a functional Next.js API endpoint that:

  1. Is registered as a webhook target in your Sinch application.
  2. Securely validates incoming Sinch callbacks using HMAC signatures.
  3. Logs the received callback payload.
  4. Responds correctly to Sinch to acknowledge receipt.
  5. Provides a foundation for more complex callback processing.

1. Setting up the Project

Let's create a new Next.js project and configure the basic structure.

Step 1: Create a Next.js App

Open your terminal and run the following command, choosing your preferred settings (TypeScript recommended, App Router used in examples):

npx create-next-app@latest sinch-callbacks-app
cd sinch-callbacks-app

Follow the prompts. We'll assume you chose:

  • TypeScript: Yes
  • ESLint: Yes
  • Tailwind CSS: (Your choice, not required for this guide)
  • src/ directory: Yes
  • App Router: Yes (Recommended)
  • Default import alias (@/\*): Yes

Step 2: Install Dependencies

We need a way to get the raw request body for HMAC validation, as Next.js App Router handlers receive the body as a stream.

npm install raw-body

yarn add raw-body

(Optional: If adding database persistence)

npm install @prisma/client
npm install prisma --save-dev

yarn add @prisma/client
yarn add prisma --dev

Step 3: Initialize Prisma (Optional)

If you plan to store callback data:

npx prisma init --datasource-provider postgresql

This creates a prisma directory with a schema.prisma file and a .env file for your database connection string.

Step 4: Configure Environment Variables

Create a file named .env.local in the root of your project. Never commit this file to Git.

.env

# .env.local

# Sinch Webhook Configuration
SINCH_WEBHOOK_SECRET="YOUR_STRONG_SECRET_FOR_HMAC_VALIDATION" # Generate a strong random string

# Sinch API Credentials (If sending messages from the same app)
# SINCH_PROJECT_ID="YOUR_SINCH_PROJECT_ID"
# SINCH_APP_ID="YOUR_SINCH_APP_ID"
# SINCH_ACCESS_KEY_ID="YOUR_SINCH_ACCESS_KEY_ID"
# SINCH_ACCESS_SECRET="YOUR_SINCH_ACCESS_SECRET"

# Database URL (If using Prisma)
# DATABASE_URL="postgresql://user:password@host:port/database?sslmode=require"
  • SINCH\_WEBHOOK\_SECRET: Crucial for security. This is a secret key you define. You will provide this same secret to Sinch when configuring the webhook. Use a password generator to create a strong, unique secret.
  • The other Sinch variables are placeholders if you integrate sending messages later.
  • Replace the DATABASE\_URL if you initialized Prisma.

Step 5: Project Structure (App Router)

Your relevant structure should look like this:

sinch-callbacks-app/
β”œβ”€β”€ src/
β”‚   └── app/
β”‚       β”œβ”€β”€ api/
β”‚       β”‚   └── sinch/
β”‚       β”‚       └── webhook/
β”‚       β”‚           └── route.ts  # <-- Our webhook handler
β”‚       β”œβ”€β”€ page.tsx              # <-- Main app page (optional UI)
β”‚       └── layout.tsx
β”œβ”€β”€ prisma/                     # <-- (Optional) Prisma schema
β”‚   └── schema.prisma
β”œβ”€β”€ .env.local                  # <-- Your secrets
β”œβ”€β”€ next.config.mjs
β”œβ”€β”€ package.json
└── tsconfig.json

(If using Pages Router, the API route would be at src/pages/api/sinch/webhook.ts)


2. Implementing the Core Webhook Handler

Now, let's build the API route that will receive callbacks from Sinch.

File: src/app/api/sinch/webhook/route.ts

import { NextRequest, NextResponse } from 'next/server';
import crypto from 'crypto';
import getRawBody from 'raw-body';

const SINCH_WEBHOOK_SECRET = process.env.SINCH_WEBHOOK_SECRET;

if (!SINCH_WEBHOOK_SECRET) {
  console.error(""FATAL ERROR: SINCH_WEBHOOK_SECRET is not set in environment variables."");


}

async function verifySinchSignature(req: NextRequest, rawBody: Buffer): Promise<boolean> {
  if (!SINCH_WEBHOOK_SECRET) {
    console.error(""HMAC validation skipped: SINCH_WEBHOOK_SECRET is not configured."");
    return false;
  }

  const signatureHeader = req.headers.get('x-sinch-webhook-signature');
  const timestampHeader = req.headers.get('x-sinch-webhook-signature-timestamp');
  const nonceHeader = req.headers.get('x-sinch-webhook-signature-nonce');
  const algorithmHeader = req.headers.get('x-sinch-webhook-signature-algorithm');

  if (!signatureHeader || !timestampHeader || !nonceHeader || !algorithmHeader) {
    console.warn('HMAC validation failed: Missing required Sinch signature headers.');
    return false;
  }


  if (algorithmHeader !== 'HmacSHA256') {
    console.warn(`HMAC validation failed: Unsupported algorithm: ${algorithmHeader}`);
    return false;
  }



  const signedData = `${rawBody.toString('utf-8')}.${nonceHeader}.${timestampHeader}`;


  const calculatedSignature = crypto
    .createHmac('sha256', SINCH_WEBHOOK_SECRET)
    .update(signedData)
    .digest('base64');


  const expectedSignature = signatureHeader;


   if (calculatedSignature !== expectedSignature) {
     console.warn('HMAC validation failed: Signatures do not match.');
     console.log(`Received Signature: ${expectedSignature}`);
     console.log(`Calculated Signature: ${calculatedSignature}`);
     return false;
   }





  return true;
}

export async function POST(req: NextRequest) {
  console.log(`\n--- Received Sinch Callback ---`);
  console.log(`Timestamp: ${new Date().toISOString()}`);
  console.log(`Headers: ${JSON.stringify(Object.fromEntries(req.headers.entries()))}`);

  let rawBody: Buffer;
  try {




    rawBody = await getRawBody(req.body as any);
    console.log('Raw Body Received (length):', rawBody.length);
  } catch (error: any) {
    console.error('Error reading raw request body:', error);
    return new NextResponse(JSON.stringify({ error: 'Failed to read request body' }), {
      status: 400,
      headers: { 'Content-Type': 'application/json' },
    });
  }


  const isSignatureValid = await verifySinchSignature(req, rawBody);
  if (!isSignatureValid) {
    console.error('Invalid Sinch signature. Rejecting request.');

    return new NextResponse(JSON.stringify({ error: 'Invalid signature' }), {
      status: 401,
      headers: { 'Content-Type': 'application/json' },
    });
  }
  console.log('HMAC Signature Verified Successfully.');


  try {

    const callbackPayload = JSON.parse(rawBody.toString('utf-8'));

    console.log('Parsed Callback Payload:', JSON.stringify(callbackPayload, null, 2));







    if (callbackPayload.message_delivery_report) {
        console.log(`Processing MESSAGE_DELIVERY: Status - ${callbackPayload.message_delivery_report.status}, Message ID - ${callbackPayload.message_delivery_report.message_id}`);

    } else if (callbackPayload.message) {
        console.log(`Processing MESSAGE_INBOUND: From - ${callbackPayload.message.channel_identity?.identity}, Message ID - ${callbackPayload.message.id}`);

    } else {

        console.log('Processing other callback type. Top-level key:', Object.keys(callbackPayload)[0] || 'Unknown Type');

    }








    return new NextResponse(JSON.stringify({ message: 'Callback received successfully' }), {
      status: 200,
      headers: { 'Content-Type': 'application/json' },
    });

  } catch (error: any) {
    console.error('Error processing callback payload:', error);

    return new NextResponse(JSON.stringify({ error: 'Failed to process callback' }), {
      status: 500,
      headers: { 'Content-Type': 'application/json' },
    });
  }
}

export async function GET(req: NextRequest) {
  return new NextResponse(JSON.stringify({ error: 'Method Not Allowed' }), { status: 405 });
}

Explanation:

  1. Environment Variable: We securely load the SINCH\_WEBHOOK\_SECRET defined in .env.local.
  2. Read Raw Body: We use the raw-body library inside the POST handler to read the request stream (req.body) into a Buffer. This is essential because we need the raw, untouched request body to verify the HMAC signature before Next.js might parse it.
  3. HMAC Verification (verifySinchSignature):
  • Retrieves the necessary x-sinch-webhook-signature-\* headers.
  • Checks for their presence and the correct algorithm (HmacSHA256).
  • Constructs the signedData string exactly as Sinch specifies: rawBodyAsString.nonce.timestamp. Crucially, it uses the raw body string.
  • Calculates the HMAC signature using your SINCH\_WEBHOOK\_SECRET.
  • Compares the calculated signature with the one provided in the header.
  • Returns true if valid, false otherwise. Logs warnings/errors for debugging.
  1. POST Handler Logic:
  • Reads the raw body.
  • Calls verifySinchSignature. If invalid, it immediately returns a 401 Unauthorized error. Do not process further if the signature is invalid.
  • If the signature is valid, it then safely parses the rawBody buffer into a JSON object (callbackPayload).
  • Crucially, it sends a 200 OK response back to Sinch as soon as possible after basic validation and logging. Heavy processing should ideally happen asynchronously after sending the response.
  • Includes placeholder logic for handling MESSAGE\_DELIVERY and MESSAGE\_INBOUND events.
  • Includes error handling for body reading and payload processing.

3. Integrating with Sinch: Configuring the Webhook

Now, you need to tell Sinch where to send the callbacks.

Step 1: Get Your Public Webhook URL

Sinch needs a publicly accessible URL to send POST requests to.

  • Local Development: Use ngrok to expose your local Next.js development server.
  1. Install ngrok: npm install ngrok -g (or download from ngrok.com)
  2. Start your Next.js dev server: npm run dev (usually runs on port 3000)
  3. In a new terminal window, run: ngrok http 3000
  4. ngrok will provide a public HTTPS URL (e.g., https://<random-string>.ngrok-free.app). Your webhook URL will be this public URL + your API route path: https://<random-string>.ngrok-free.app/api/sinch/webhook
  • Note: The free ngrok plan URL changes each time you restart it. You'll need to update the Sinch webhook configuration frequently during development. Production alternatives are necessary for a live application.
  • Deployment (Vercel, Netlify, etc.): Once deployed, your platform will provide a stable public URL. Your webhook URL will be: https://<your-deployment-url>/api/sinch/webhook
  • Production Alternatives to ngrok: For stable production endpoints without using typical deployment platforms, consider services like Cloudflare Tunnel or ensure your self-hosted server has a public static IP address and a properly configured domain name pointing to it.

Step 2: Configure Webhook in Sinch Portal

  1. Log in to your Sinch Customer Dashboard.
  2. Navigate to your Project and the specific Conversation API App you are using.
  3. Find the Webhooks or Callbacks section for your App.
  4. Click Create Webhook or Add Webhook.
  5. Configure the webhook:
  • Target URL: Enter the public URL obtained in Step 1 (e.g., your ngrok or deployment URL ending in /api/sinch/webhook).
  • Target Type: HTTP (or HTTPS, ensure your endpoint supports it - ngrok and Vercel provide HTTPS).
  • Triggers: Select the events you want to subscribe to. For delivery status, choose MESSAGE\_DELIVERY. For inbound messages, choose MESSAGE\_INBOUND. You can select multiple triggers. Common useful triggers include:
  • MESSAGE\_DELIVERY
  • MESSAGE\_INBOUND
  • EVENT\_INBOUND (e.g., for typing indicators)
  • OPT\_IN / OPT\_OUT
  • Secret: Crucially, enter the exact same strong secret string you defined in your .env.local file for SINCH_WEBHOOK_SECRET. This enables HMAC validation.
  • (Optional) Authentication: For this guide, we are using HMAC via the Secret field. Sinch also supports OAuth 2.0, which is more complex to set up but offers token-based security. If using OAuth, you would configure Client ID, Client Secret, and Token URL here instead of (or in addition to) the HMAC secret.
  1. Save the webhook configuration.

(Alternative) Configure Webhook via Sinch API:

You can also programmatically create webhooks using the Sinch Webhook Management API endpoint (/v1/projects/{PROJECT_ID}/webhooks). See the Sinch documentation for details.

curl -X POST \
 'https://eu.conversation.api.sinch.com/v1/projects/{{PROJECT_ID}}/webhooks' \
 -H 'Content-Type: application/json' \
 -H 'Authorization: Bearer {{YOUR_SINCH_ACCESS_TOKEN}}' \
 -d '{
   "app_id": "{{YOUR_SINCH_APP_ID}}",
   "target": "YOUR_PUBLIC_WEBHOOK_URL/api/sinch/webhook",
   "target_type": "HTTP",
   "triggers": [
     "MESSAGE_DELIVERY",
     "MESSAGE_INBOUND"
     # Add other desired triggers here
   ],
   "secret": "YOUR_STRONG_SECRET_FOR_HMAC_VALIDATION" # Must match .env.local
 }'

4. Error Handling, Logging, and Retry Mechanisms

Our basic handler includes some logging, but let's refine it.

  • Consistent Error Strategy: The current code returns 401 for bad signatures, 400 for bad requests (like unreadable body), and 500 for internal processing errors. This is a good start.
  • Logging:
  • We use console.log and console.error. For production, use a structured logger like pino or winston.
  • Log incoming headers, the verified payload, and any errors encountered during verification or processing.
  • Consider logging the correlation\_id if you provide one when sending messages – it helps trace specific message flows.
  • Sinch Retries:
  • Sinch automatically retries sending callbacks if your endpoint doesn't respond with a 2xx status code (like 200 OK) within a short timeout.
  • Retries use an exponential backoff strategy.
  • Idempotency: Because of retries (or network issues), your webhook might receive the same callback multiple times. Your processing logic must be idempotent – processing the same callback twice should not cause incorrect side effects (e.g., don't increment a counter twice for the same delivery receipt).
  • Strategy: Check if you've already processed a specific message\_id or event ID before performing actions like database updates. You could store processed IDs in a cache (like Redis) or check the database state.
  • Responding Quickly: Re-emphasize: Respond 200 OK before potentially long-running tasks. Use asynchronous processing (processCallbackAsync pattern shown in the code) for anything that might delay the response (database writes, external API calls, complex logic).

5. (Optional) Database Schema and Data Layer (Prisma Example)

If you need to store message status or history:

Step 1: Define Prisma Schema

Add a model to your prisma/schema.prisma file:

Prisma

// prisma/schema.prisma

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql" // Or your chosen provider
  url      = env("DATABASE_URL")
}

model Message {
  id              String    @id @default(cuid()) // Internal DB ID
  sinchMessageId  String    @unique // The ID from Sinch callbacks
  conversationId  String?
  contactId       String?
  channel         String?
  status          String?   // e.g., QUEUED_ON_CHANNEL, DELIVERED, FAILED, READ
  direction       String    // TO_APP (inbound) or TO_CONTACT (outbound - assumed if not inbound)
  content         Json?     // Store parts of the message content if needed
  lastUpdatedAt   DateTime  @updatedAt
  createdAt       DateTime  @default(now())

  // Add relations to Contact or Conversation models if needed
}

// You might also want models for Contacts, Conversations, etc.

Step 2: Generate Prisma Client and Apply Migrations

  1. Generate the client:
   npx prisma generate
  1. Create and apply the database migration:
   npx prisma migrate dev --name init-message-model

Step 3: Update Webhook Handler to Use Prisma

Modify src/app/api/sinch/webhook/route.ts to interact with the database.

import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

    console.log('Parsed Callback Payload:', JSON.stringify(callbackPayload, null, 2));


    processCallbackAsync(callbackPayload).catch(err => {
        console.error("Error during async callback processing:", err);

    });



    return new NextResponse(JSON.stringify({ message: 'Callback received successfully' }), {
      status: 200,
      headers: { 'Content-Type': 'application/json' },
    });

async function processCallbackAsync(payload: any) {
    console.log(`Starting async processing for app_id: ${payload.app_id}`);
    try {
        if (payload.message_delivery_report) {
            const report = payload.message_delivery_report;
            console.log(`Async: Processing MESSAGE_DELIVERY: Status - ${report.status}, Message ID - ${report.message_id}`);



            await prisma.message.upsert({
                where: { sinchMessageId: report.message_id },
                update: {
                    status: report.status,

                },
                create: {
                    sinchMessageId: report.message_id,
                    status: report.status,
                    direction: 'TO_CONTACT',
                    conversationId: report.conversation_id,
                    contactId: report.contact_id,
                    channel: report.channel_identity?.channel,

                }
            });
            console.log(`Async: DB updated for message ${report.message_id}`);

        } else if (payload.message) {
            const msg = payload.message;
            console.log(`Async: Processing MESSAGE_INBOUND: From - ${msg.channel_identity?.identity}, Message ID - ${msg.id}`);




             await prisma.message.create({
                 data: {
                    sinchMessageId: msg.id,
                    conversationId: msg.conversation_id,
                    contactId: msg.contact_id,
                    channel: msg.channel_identity?.channel,
                    status: 'RECEIVED',
                    direction: msg.direction,
                    content: msg.contact_message || {},
                 }
             });
            console.log(`Async: DB record created for inbound message ${msg.id}`);

        } else {

             console.log('Async: Processing other callback type. Top-level key:', Object.keys(payload)[0] || 'Unknown Type');

        }
    } catch (error: any) {

        if (error.code === 'P2002') {
             console.warn(`Async: Record likely already exists for ID (idempotency handled): ${payload.message_delivery_report?.message_id || payload.message?.id}`);
        } else {
             console.error("Async: Error during database operation:", error);

             throw error;
        }
    } finally {
         console.log(`Finished async processing for app_id: ${payload.app_id}`);




    }
}

Key Changes for DB Integration:

  1. Instantiated PrismaClient.
  2. Moved the core processing logic into an async function processCallbackAsync.
  3. Called processCallbackAsync without await before sending the 200 OK response.
  4. Added try...catch...finally within processCallbackAsync specifically for database errors and cleanup/logging.
  5. Used prisma.message.upsert for delivery reports to handle updates idempotently.
  6. Used prisma.message.create for inbound messages (could add checks for existence if needed).
  7. Added basic handling for potential unique constraint errors (P2002) which might occur during retries if the record was already created.
  8. Clarified the comment about prisma.$disconnect(), advising against its use in typical serverless environments.

6. Security Considerations

  • HMAC Validation: Already implemented. Never disable this. Ensure SINCH\_WEBHOOK\_SECRET is strong and kept confidential.
  • HTTPS: Always use HTTPS for your webhook endpoint URL. ngrok and deployment platforms like Vercel handle this automatically.
  • Input Validation: While the HMAC signature verifies the source, the content of the payload should still be treated carefully, especially if used directly in database queries or UI rendering. Sanitize data where appropriate, although JSON parsing provides some safety against injection if used correctly with an ORM like Prisma.
  • Rate Limiting: While Sinch's traffic might be predictable, consider adding rate limiting to your API endpoint (e.g., using Vercel's built-in features or middleware) as a general security measure against abuse, although Sinch's retries might conflict with overly strict limits.
  • Nonce/Timestamp Validation (Replay Attack Prevention): The verifySinchSignature function has comments mentioning optional nonce and timestamp checks. Implementing this adds protection against replay attacks, where an attacker captures a valid callback and resends it later. This requires storing recently seen nonces (e.g., in Redis or a database table with a TTL) and checking if the timestamp is within a reasonable window (e.g., 5 minutes) of the current time.

7. Troubleshooting and Caveats

  • Callback Not Received:
  • Check URL: Ensure the Target URL in the Sinch portal exactly matches your public endpoint URL (ngrok or deployment) including /api/sinch/webhook. Check for typos, HTTP vs HTTPS mismatches.
  • Check Server Logs: Are there any errors when your Next.js app starts? Are requests hitting the endpoint at all? Check Vercel logs or your local terminal.
  • Check ngrok: If using ngrok, is it running? Is the URL still active? Check the ngrok web interface (http://localhost:4040 by default) to see incoming requests and responses.
  • Firewall: If self-hosting, ensure firewalls allow incoming traffic on the relevant port (usually 443 for HTTPS).
  • Sinch App Status: Check the Sinch portal for any app or service issues.
  • HMAC Validation Failing (401 Unauthorized):
  • Secret Mismatch: Double-check that the Secret in the Sinch webhook configuration is identical to the SINCH\_WEBHOOK\_SECRET in your .env.local file. No extra spaces or encoding issues!
  • Raw Body Issue: Ensure raw-body is reading the stream correctly. Log the raw body length and the string representation before hashing to debug. Compare the signedData string construction (rawBody.nonce.timestamp) precisely with the Sinch example. Whitespace matters! Ensure no middleware is modifying the body before your handler.
  • Incorrect Headers: Log the incoming x-sinch-webhook-signature-\* headers to ensure they are present and correctly formatted.
  • Sinch Retrying Continuously:
  • Response Code: Your endpoint must return a 2xx status code (ideally 200 OK) quickly. If it returns 4xx, 5xx, or times out, Sinch will retry. Check your server logs for errors preventing a 200 OK response.
  • Slow Processing: If your processing logic (database updates, etc.) takes too long before sending the response, Sinch might time out and retry. Move heavy tasks to asynchronous processing after sending the 200 OK.

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 β†’