Generate API Key for APIs
Logs in with a username and password and returns an API key. This is how an integration gets the `APIKEY` header for every other call. Use an admin account for admin-level integrations.
POST
/tutor/loginGenerate API Key for APIs
curl --request POST \
--url 'https://<your-api-host>/nuSource/api/v1/tutor/login' \
--form 'JSONString={"username":"","password":"","persistent_login":true}'{
"code": 200,
"message": "Login successful",
"user": {
"username": "harshit",
"apikey": "ac1955b3f4805529b34f260f8c4c9699",
"role": 2,
"user_id": 1,
"name": " Gaurav Kapoor",
"contact_number": "9437855924",
"email": "harshit@edmingle.com"
}
}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:
harshituser.user_idinteger
Example:
1user.namestring
Example:
Gaurav Kapooruser.contact_numberstring
Example:
9437855924user.emailstring
Example:
harshit@edmingle.comNotes:
- 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.