Requirements
- Node.js 22 or later
- An Authentica account
- An API key from the Authentica portal
Quick start
1
Install the SDK
2
Add your API key
Store your API key in a server-side environment variable named Creating a
AUTHENTICA_API_KEY..env
.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.3
Create an Authentica client
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 If this prints your credit balance, your integration is working.
.env file: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.