Verifies a one-time password for a given email and optionally returns user information.
cURL
curl --request POST \ --url https://api.oneofnone.io/v1/access/otp/verify \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data ' { "email": "[email protected]", "code": "<string>", "include_user": false } '
{ "success": true, "message": "OTP verified successfully", "user": { "id": "5d162e6f-20ed-4a8c-b7bb-44a53b6f7d8a", "email": "[email protected]", "phone": "+15551234567", "metadata": { "preferences": { "notifications": true } }, "login_count": 5, "last_login_at": "2023-01-01T12:00:00Z", "created_at": "2023-01-01T12:00:00Z", "updated_at": "2023-01-01T12:00:00Z", "avatar_url": "https://example.com/avatars/user.jpg" } }
The API key required for accessing protected routes. It should be included in the request headers as x-api-key.
x-api-key
The email address for which the OTP was generated.
The OTP code to verify.
6
If true, includes user information in the response.
OTP verified successfully.
Indicates whether the OTP verification was successful.
true
Confirmation message that the OTP has been verified.
"OTP verified successfully"
User information, included only if include_user is true.
Show child attributes
The unique identifier of the user.
"5d162e6f-20ed-4a8c-b7bb-44a53b6f7d8a"
The email address of the user.
"[email protected]"
The phone number of the user, if available.
"+15551234567"
Additional metadata associated with the user.
{ "preferences": { "notifications": true } }
The number of times the user has logged in.
5
The timestamp of the user's last login.
"2023-01-01T12:00:00Z"
The timestamp when the user was created.
The timestamp when the user was last updated.
The URL to the user's avatar image, if available.
"https://example.com/avatars/user.jpg"