How-to · 4 min read

Phone verification in Next.js

Add SMS phone verification to a Next.js app — a route handler that provisions a number and a webhook that receives the code.

Keep your API key server-side. Provision the number in a route handler and receive the code via a webhook (or poll from the server).

// app/api/verify/start/route.ts
import { Eveses } from '@eveses/sdk';
const eveses = new Eveses({ key: process.env.EVESES_KEY! });

export async function POST() {
  const order = await eveses.orders.create({
    country: 'ua', mode: 'activation', service: 'yourapp',
  });
  return Response.json({ id: order.order_id, phone: order.phone });
}
// app/api/verify/webhook/route.ts  — Eveses POSTs the code here
export async function POST(req: Request) {
  // verify the HMAC-SHA256 signature header, then mark the user verified
  const { order_id, otp } = await req.json();
  await markVerified(order_id, otp);
  return new Response('ok');
}

Never expose EVESES_KEY to the client — all Eveses calls run in route handlers / server actions. Install with npm install @eveses/sdk.


Ready to build? Create a free Eveses account, top up a wallet, and grab your API key — no KYC. See the API docs or live pricing.

FAQ

▸How do I add SMS verification to Next.js?
Call the Eveses API from a route handler or server action (never the client), provision a number, and receive the code via a webhook route.
▸Where do I keep the API key?
Server-side only — in EVESES_KEY, used inside route handlers. Never ship it to the browser.
Related guides