Docs home

Get API Key with Email/Contact Number and Password

Logs a user in with their email, username or contact number and password, and returns an API key for that user. Use it on a website or app where learners sign in with Edmingle credentials.

POST/tutor/login
Get API Key with Email/Contact Number and Password
curl --request POST \
  --url 'https://<your-api-host>/nuSource/api/v1/tutor/login' \
  --form 'JSONString={"username":"harshit@edmingle.com","password":"test","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:

BodyJSONString
usernamestringrequired
Email, username or contact number. Up to 50 characters. Not case-sensitive.
passwordstringOne of password or otp
The user's password.
otpstringOne of password or otp
Login OTP from "Login OTP Send". Only works with an email or contact number as username.
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).
1 web (default), 2 Android, 3 iOS, 4 API.
Device identifier used by Edmingle's apps. Integrations can leave it out.
Device session key returned by an earlier login on the same device. Integrations can leave it out.
Response200application/json
codeinteger
Example: 200
messagestring
Example: Login successful
userobject
Show child attributesHide child attributes
Example: harshit
Send it as the APIKEY header
Example: ac1955b3f4805529b34f260f8c4c9699
user.roleinteger
0 tutor, 1 learner, 2 admin or institute admin, 4 parent, 7 custom role
Example: 2
Example: 1
user.namestring
Example: Gaurav Kapoor
Example: 9437855924
Example: harshit@edmingle.com

Notes:

  • 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.users lists each account as [id, name, email, contact_number, username]. Send the login again with the chosen user_id.
  • If is_user_mfa_enabled is 1 after 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.

Updated yesterday

Ask AI