Welcome Offer: 100 free verifications when you register!Claim your 100 free verifications
Authentica
HomeDevelopersCode Samples

Recipes for the most common scenarios

Copy-paste-ready examples organized by language. Send an OTP, verify it, and handle the response in your preferred stack.

cURLNode.jsPythonJavaGoPHP

Send an OTP

Trigger a one-time code on the channel of your choice.

NODE.JS
import { Authentica } from "@authentica/sdk";
const client = new Authentica({ apiKey: process.env.AUTHENTICA_API_KEY! });

const { id } = await client.otp.send({
  channel: "sms",
  phone: "+9665XXXXXXXX",
});

Verify the code

Confirm what the user entered and approve the verification.

NODE.JS
const result = await client.otp.verify({
  id: "otp_8f2c1a9b4d",
  code: "123456",
});
console.log(result.status); // "verified"