Authorization header, and OTP.ID validates it before processing the request. There are no cookies, sessions, or OAuth flows to configure. If the key is valid, the request proceeds; if not, you receive a clear error response telling you exactly what went wrong.
Get Your API Key
Your API key lives in the OTP.ID dashboard:- Log in at https://otp.id.
- Go to Settings → API Keys.
- Copy your active key.
otpid_live_ for production environments. Keep a secure copy — the dashboard only shows the full key once at creation time.
API keys are scoped per merchant account. All balance deductions, rate limits, and transaction records are tracked per key. If you manage multiple projects or environments, create a separate key for each.
Include the Key in Every Request
Pass your API key as a Bearer token in theAuthorization header on every request to any /v3/* endpoint:
curl:
Code Examples
The following examples show how to attach theAuthorization header when making requests from common environments.
Authentication Errors
All authentication failures return HTTP401 with success: false. The error.code is always "UNAUTHORIZED", and error.message describes the specific problem.
Missing Authorization Header
If you omit theAuthorization header entirely:
Empty API Key
If you include the header but provide an empty string as the token:Unknown or Invalid API Key
If the key is present but does not match any active key in OTP.ID’s system:Best Practices
- Use environment variables to store your API key rather than hardcoding it in source files. Reference it as
process.env.OTPID_API_KEY(Node.js) oros.environ["OTPID_API_KEY"](Python). - Rotate keys periodically and immediately if you suspect exposure.
- Use separate keys per environment (development, staging, production) so a leaked development key never touches production data or balance.
- Monitor
last_balancein send responses to detect unexpected usage spikes that could indicate a leaked key.

