Newer Version Available
LoginHistory
Represents the login history for all successful and failed login
attempts for organizations and enabled portals. This object is available in API version 21.0
and later.
Supported Calls
describeSObjects(), query(), retrieve()
Special Access Rules
With one exception, only users with Manage Users permissions can access this object. The exception is that, in API version 37.0 and later, all users can retrieve their own login history records.
Fields
| Field | Details |
|---|---|
| ApiType |
|
| APIVersion |
|
| Application |
|
| AuthenticationServiceId |
|
| Browser |
|
| ClientVersion |
|
| CipherSuite |
|
| CountryIso |
|
| LoginGeoId |
|
| LoginTime |
|
| LoginType | |
| LoginUrl |
|
| NetworkId |
|
| Platform |
|
| SourceIp |
|
| Status |
|
| TlsProtocol | |
| UserId |
|
Usage
Not all fields are filterable. You can only filter on the following fields:
- AuthenticationServiceId
- CipherSuite
- CountryIso
- Id
- LoginTime
- LoginType
- LoginUrl
- NetworkId
- TlsProtocol
- UserId
The API allows you to do many powerful queries. A few examples are:
| Sample Query | Query String |
|---|---|
| Simple query showing UserId & LoginTime for each user | SELECT UserId, LoginTime from LoginHistory; |
| Query showing logins only after a specified date and time | SELECT UserId, LoginTime from LoginHistory WHERE LoginTime > 2010-09-20T22:16:30.000Z; |
| Query showing logins for a specific time interval | SELECT UserId, LoginTime from LoginHistory WHERE LoginTime > 2010-09-20T22:16:30.000Z AND LoginTime < 2010-09-21T22:16:30.000Z; |
| Query showing the authentication service for a SAML login event, where Id=AuthenticationServiceId from LoginHistory | SELECT name, issuer, samlVersion FROM SamlSsoConfig WHERE Id = '0LE###############' |
| Query showing the authentication service for an authentication provider login event, where Id=AuthenticationServiceId from LoginHistory | SELECT Type, DeveloperName FROM AuthProvider WHERE Id = '0SO###############' |