Skip to main content

Requirements

Quick start

1

Install the SDK

2

Add your API key

Store your API key in a server-side environment variable named AUTHENTICA_API_KEY.
.env
Creating a .env file is not enough on its own: plain Node.js does not read it automatically. Load it explicitly when you start your app with the --env-file flag (shown in the last step).In production, use your hosting platform’s environment settings or a secrets manager.
Do not use frontend-exposed variable prefixes such as NEXT_PUBLIC_, VITE_, REACT_APP_ or EXPO_PUBLIC_. Bundlers copy those values into code that ships to browsers.
3

Create an Authentica client

The SDK sends your key in the X-Authorization header on every request. You do not need to set any headers yourself.
4

Make your first request

Choose one of these examples and save it with the filename shown:
Run it, loading your .env file:
If this prints your credit balance, your integration is working.
The .mjs extension selects ES modules and .cjs selects CommonJS, so these examples run without changing the module setting in your package.json. TypeScript projects can use the same SDK methods with their existing build setup.

Next steps

Send an OTP

Send and verify your first one-time password.

Handle errors

Catch and handle typed SDK errors.