Get API Key with Login OTP
Exchanges a login OTP for an API key. First call "Login OTP Send" with the user's email or contact number, then call this with the same value as `username` and the code received as `otp`.
POST
/tutor/loginGet API Key with Login OTP
curl --request POST \
--url 'https://<your-api-host>/nuSource/api/v1/tutor/login' \
--form 'JSONString={"username":"hemal@edmingle.com","otp":"205627","persistent_login":true}'{
"code": 200,
"message": "Login successful",
"user": {
"username": "DemoHemal2944375",
"apikey": "2514e6e496a4dfa5ee22759b55040959",
"role": 1,
"user_id": 89158911,
"name": "DemoHemal",
"contact_number": "7359943259",
"email": "hemal@edmingle.com",
"is_sign_up": 0,
"server_key": "d43015e672cd3b3c76c7d42a6c26b3c5",
"is_user_mfa_enabled": 0
}
}Access: Public, no API key.
Request body: form-data with one field, JSONString, containing this JSON:
Body
JSONStringEmail, username or contact number. Up to 50 characters. Not case-sensitive.
The user's password.
Login OTP from "Login OTP Send". Only works with an email or contact number as
username.persistent_loginboolean
true (default) gives a key valid for 30 days (1 day for some institutes); false gives 5 hours. Send a JSON boolean.user_idinteger
Picks one account when the same credentials match several (see Notes).
device_typeinteger
1 web (default), 2 Android, 3 iOS, 4 API.device_keystring
Device identifier used by Edmingle's apps. Integrations can leave it out.
server_keystring
Device session key returned by an earlier login on the same device. Integrations can leave it out.
Response
codeinteger
Example:
200messagestring
Example:
Login successfuluserobject
Show child attributesHide child attributes
user.usernamestring
Example:
DemoHemal2944375user.user_idinteger
Example:
89158911user.namestring
Example:
DemoHemaluser.contact_numberstring
Example:
7359943259user.emailstring
Example:
hemal@edmingle.comuser.server_keystring
Example:
d43015e672cd3b3c76c7d42a6c26b3c5user.is_user_mfa_enabledinteger
Example:
0Notes:
- Log in on your institute's own API host; the institute is taken from the host name and only its users can log in.
- If the credentials match more than one account, there is no
apikey:payload.userslists each account as[id, name, email, contact_number, username]. Send the login again with the chosenuser_id. - If
is_user_mfa_enabledis1after a password login, the key is not active: your institute requires OTP login for this role. Use the OTP flow instead. - Errors: "PLEASE ENTER PASSWORD / OTP" (neither sent),
invalid.credentials, "Invalid OTP", a blocked-user error, "Please Contact Admin." (user has no active organization), "Please login using mobile application" (learners, when the institute allows app-only login) and "You already have N active sessions" when the institute limits learner sessions. With a session limit and no such error, the learner's oldest sessions are logged out. - Rate limit: 30 requests per minute; going over locks you out for 30 minutes.
- The OTP is valid for 30 minutes and only the latest one sent works. OTP login skips the multi-factor check, so the key is always active.