ed
03/27/2026, 9:49 PM400 error with:
{
"errorCode": "E011001",
"errorDescription": "Request is malformed"
}
https://docs.descope.com/api/management/users/users-auth-historyDevRev
03/27/2026, 9:49 PM{} in the request body.
Request Body Issue
The login history API requires an empty JSON object in the request body . You're getting a 400 error because the API expects a JSON body, even though it's empty.
curl -X POST "<https://api.descope.com/v1/mgmt/user/history>"
-H "Authorization: Bearer <token>"
-H "Content-Type: application/json"
-d '{}'
Why POST Instead of GET
The endpoint uses POST because it follows REST conventions for management APIs that may need to support filtering parameters in the future. The empty body structure allows for potential expansion without breaking changes.
Common Issues
1. Missing Content-Type: application/json header
2. Sending no body instead of empty JSON object {}
3. Invalid authorization token format
The API returns login history for all users in your project . Each entry includes userId, loginTime, city, country, IP, and selectedTenant.
Get User's Login History | API Reference | Descope Documentationed
03/27/2026, 9:51 PMDevRev
03/27/2026, 9:52 PM{} in the example. However, looking at other management APIs like "Log user out of all sessions" which accepts both loginId and userId parameters , it appears the login history API may support filtering but the documentation is incomplete.
Missing Documentation
The documentation for the login history API appears incomplete - it only shows an empty request body {} which would indeed return all users' login history . However, based on other similar management APIs, it likely supports filtering parameters.
Try These Parameters
Based on patterns from other Descope management APIs, try adding user identification to the request body:
curl -X POST "<https://api.descope.com/v1/mgmt/user/history>"
-H "Authorization: Bearer <token>"
-H "Content-Type: application/json"
-d '{
"loginId": "<mailto:user@example.com|user@example.com>"
}'
Or with userId:
curl -X POST "<https://api.descope.com/v1/mgmt/user/history>"
-H "Authorization: Bearer <token>"
-H "Content-Type: application/json"
-d '{
"userId": "U2FsdGVkX1..."
}'
Alternative Approach
If filtering isn't supported, you could use the Search Users API to get login history data, which does support filtering by specific users .
The documentation appears incomplete for this specific endpoint. I'd recommend testing the parameters above, and if they don't work, you may need to contact Descope support for the correct filtering syntax.
Log user out of all sessions | API Reference | Descope Documentation
Get User's Login History | API Reference | Descope Documentation
Search Users | API Reference | Descope Documentationed
03/27/2026, 9:53 PMuserIds array, but I just get the response that it’s malformed.DevRev
03/27/2026, 9:54 PMed
03/27/2026, 9:56 PMsearch API but it doesn’t give login history. I really just need the last login timestamp for this user…DevRev
03/27/2026, 9:57 PMuser.lastAuth.time that contains the last time the user logged in .
Setup Custom Claims
1. Go to your Descope console → Project Settings → JWT Templates
2. Add user.lastAuth.time to your session token custom claims
3. The timestamp will be included in every user's JWT
Alternative: Session History API
There's also a Session History API that requires the user's refresh token :
curl -X GET "<https://api.descope.com/v1/auth/history>"
-H "Authorization: Bearer <ProjectID:RefreshJWT>"
This returns the user's session history including geo-location and timestamps, but requires the user to be authenticated.
Recommendation
For your use case, custom claims with user.lastAuth.time is the most efficient approach - you'll get the last login timestamp directly in the JWT without additional API calls.
Dynamic Keys & Values | Descope Documentation
My Details | API Reference | Descope Documentationed
03/27/2026, 9:59 PMDevRev
03/27/2026, 9:59 PMloginId, userId, userIds array) and they're returning malformed request errors.
Possible Workarounds
1. Check if Load User API includes last login - The Load User API might include last login data in the user object, though it's not explicitly documented
2. Audit logs - If you have audit logging enabled, login events might be available there
3. Custom tracking - If you've been storing login events in your own database
Immediate Solution
Since the API documentation is incomplete and the standard filtering approaches aren't working, the Descope support team you're already connected with will need to provide:
1. The correct request body format for filtering login history by user
2. Or confirm if this filtering capability exists at all
3. Alternative approaches for getting historical login data
This appears to be a gap in the current API documentation/functionality that requires direct support assistance to resolve.Aditya Arakal
03/27/2026, 10:29 PMAditya Arakal
03/27/2026, 10:38 PMendpoint: <https://api.descope.com/v1/mgmt/audit/search>
payload: {
loginIds: [loginId],
actions: ["LoginSucceed", "LoginSucceeded"],
from: 0,
to: Date.now(),
limit: 10,
}
`Authorization: `Bearer ${process.env.DESCOPE_PROJECT_ID}:${process.env.DESCOPE_MANAGEMENT_KEY}``ed
03/27/2026, 10:54 PMloginIds did not work, nothing was filtered. But if I use userIds instead, then I get the results filtered down to the user I’m looking for. Thanks!