Skip to main content
Pass options once, when you create the client. Only apiKey is required.

Options

Invalid options throw an AuthenticaValidationError when the client is created.
The SDK does not retry requests and has no per-call cancellation. Use timeout to bound how long a request can take.

Client identification

By default, every request includes this header:
Authentica uses it to recognize SDK traffic and see which SDK versions are in use.
  • It contains only the SDK name and version.
  • It contains no API key, account details or end-user data.
  • It is not used for authentication. Your key is sent only in X-Authorization.
To turn it off:
Disabling the header does not change SDK behavior. Every operation, header, error and timeout works the same either way.

Advanced options

baseUrl must use https. Plain http is allowed only for localhost, 127.0.0.1 and [::1]. It must not contain credentials, a query string or a fragment.The SDK sends your API key to whatever host you configure. Set baseUrl only from trusted server configuration, never from user input or tenant-editable settings.
A custom fetch receives every request, including your API key and request bodies. Use only implementations you control or fully trust.Your implementation must:
  • never log or store credentials or request bodies
  • not retry requests internally, since a retried OTP send can deliver a second message and use extra credits
  • honor redirect: 'manual', so your API key is never forwarded to another host
  • return a response with status, ok and text(); without headers, retryAfterSeconds is never set