401 — Authentication error
401 — Authentication error
The SDK throws
AuthenticaAuthenticationError: the API key is missing or invalid.- Check that
AUTHENTICA_API_KEYis set in the process that runs your server, not only in your local shell. - Make sure the key has no surrounding quotes or whitespace.
- Confirm the key is still active in the Authentica portal.
422 — Request rejected
422 — Request rejected
The request reached the API, but the input was rejected. The SDK throws
AuthenticaApiError with status 422.- Check required fields and formats, such as international phone numbers.
- For OTP verification, the code may be wrong or expired. Treat it as a failed verification.
- For face and voice verification, check that the images or audio meet the service requirements.
429 — Rate limited
429 — Rate limited
You are sending too many requests. The SDK throws
AuthenticaApiError with status 429.- Check
error.retryAfterSeconds. If set, wait that long before trying again. - Do not resend OTPs automatically; ask the user to try again later.
Connection errors
Connection errors
The SDK throws
AuthenticaConnectionError when no response is received.- Check that your server allows outbound HTTPS to
api.authentica.sa. - Check DNS, proxy and firewall settings.
- If you set a custom
baseUrlorfetch, check those first. - If everything looks correct, contact Authentica support.
Timeouts
Timeouts
The SDK throws
AuthenticaTimeoutError when a request exceeds timeout (30 seconds by default).- Check network latency between your server and Authentica.
- Adjust
timeoutif needed. See Configuration. - The operation may still have completed. Do not resend an OTP automatically.
Unexpected response
Unexpected response
The SDK throws
AuthenticaResponseError when a 2xx response is empty, not valid JSON or missing expected fields.- Upgrade to the latest SDK version.
- If it continues, contact Authentica support with the time of the request and the error name. Do not share API keys or user data.
Node.js version
Node.js version
The SDK requires Node.js 22 or later. Check your version:Upgrade Node.js in every environment that runs your server, including CI and production.
Using the SDK in the browser
Using the SDK in the browser
The SDK throws if you create a client in a browser, because doing so would expose your API key.
- Move all Authentica calls to your backend.
- Expose your own endpoint for your frontend to call.
- If your API key was included in a frontend bundle, rotate it immediately.