Retrieve Login Report

This report includes the number of login for a given application or across all applications. You must specify a date range for the report. The report is always calculated in hours. if you want to calculate daily logins, you'll need to roll up the results in the response.

Request#

Global API Key Authentication
Retrieve the login report
GET/api/report/login?start={start}&end={end}&applicationId={applicationId}
OpenAPI Spec
Global API Key Authentication
Retrieve the login report for an individual user by username or email address
GET/api/report/login?start={start}&end={end}&applicationId={applicationId}&loginId={loginId}
OpenAPI Spec
Global API Key Authentication
Retrieve the login report for an individual user by unique Id
GET/api/report/login?start={start}&end={end}&applicationId={applicationId}&userId={userId}
OpenAPI Spec

Request Parameters#

applicationIdUUIDoptional

A specific application to query for. If not provided a "Global" (across all applications) login report will be returned.

endLongrequired

The end of the query range. This is an instant but it is truncated to hours in the report timezone (which is set in the system settings).

startLongrequired

The start of the query range. This is an instant but it is truncated to hours in the report timezone (which is set in the system settings).

loginIdStringoptionalAvailable since 1.4.0

When this parameter is provided it will reduce the scope of the report to a single user. This parameter can be one of the following (see loginIdTypes for information on which of these identifiers will be used):

  • Email address
  • Phone number (if phoneNumber is included in loginIdTypes)
  • Username

This parameter is mutually exclusive with userId, if both are provided, the loginId will take precedence.

loginIdTypesArray<String>optionalDefaults to [email, username]Available since 1.59.0

The identity types that FusionAuth will compare the loginId to. Can be one or more of the following:

  • email
  • phoneNumber
  • username
The order is significant. If ["email", "username"] is supplied with a loginId value of terry@example.com, then a user with terry@example.com as their email address will match first before any user with terry@example.com as their username.
userIdUUIDoptionalAvailable since 1.4.0

When this parameter is provided it will reduce the scope of the report to a single user with the requested unique Id.

This parameter is mutually exclusive with loginId, if both are provided, the loginId will take precedence.

Response#

The response for this API contains the login report.

Response Codes
CodeDescription
200The request was successful. The response will contain a JSON body.
400The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present.
401You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.
404The object you requested doesn't exist. The response will be empty.
500There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty.
503The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body.

Response Body#

hourlyCounts

The list of login counts.

hourlyCounts[x].intervalInteger

The interval for this count. The interval values for the login report are the number of hours since Epoch UTC shifted to the report timezone.

hourlyCounts[x].countInteger

The number of login for this count.

totalInteger

The total (sum) of each count across the query range.

Example Response JSON

{
  "total": 100,
  "hourlyCounts": [
    {
      "interval": 401824,
      "count": 60
    },
    {
      "interval": 401825,
      "count": 40
    }
  ]
}