> For the complete documentation index, see [llms.txt](https://fusionauth.io/docs/llms.txt)

# Retrieve Recent Logins

API documentation for the FusionAuth Retrieve Recent Logins API.

# Retrieve Recent Logins

version

Available Since Version 1.4.0

This API is used to retrieve recent logins.

## Request

[!Global API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#global-api-key-authentication)

Retrieve recent logins

GET/api/user/recent-login?limit={limit}&offset={offset}&userId={userId}

OpenAPI Spec

### Request Parameters

`limit`IntegeroptionalDefaults to 10

This parameter indicates the maximum amount of logins to return for a single request.

`offset`IntegeroptionalDefaults to 0

This parameter provides the offset into the result set. Generally speaking if you wish to paginate the results, you will increment this parameter on subsequent API request by the size of the `limit` parameter.

`userId`UUIDoptional

This parameter will narrow the results to only logins for a particular user. When this parameter is omitted, the most recent logins for all of FusionAuth will be returned.

## Response

The response will contain recent logins containing no more than the value set by the `limit` parameter. By design, this API does not return the total number of results and only lets paginate through the results from newest to oldest.

*Response Codes*

| Code | Description |
| --- | --- |
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an [Errors](https://fusionauth.io/docs/apis/errors.md) JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You 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](https://fusionauth.io/docs/apis/authentication.md). |
| 404 | The object you requested doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 503 | The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body. |

### Response Body

`logins`Array

A list of recent logins.

`logins[x].applicationId`UUID

The unique Id of the application that is represented by this login record.

`logins[x].applicationName`String

The name of the application at the time this record was created.

`logins[x].instant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) this login occurred.

`logins[x].ipAddress`String

The IP address if provided during the login request.

`logins[x].location.city`StringAvailable since 1.30.0

The city where the login request originated.

**Note:** To use login location, you'll need an Enterprise plan.

`logins[x].location.country`StringAvailable since 1.30.0

The country where the login request originated.

**Note:** To use login location, you'll need an Enterprise plan.

`logins[x].location.latitude`DoubleAvailable since 1.30.0

The latitude where the login request originated.

**Note:** To use login location, you'll need an Enterprise plan.

`logins[x].location.longitude`DoubleAvailable since 1.30.0

The longitude where the login request originated.

**Note:** To use login location, you'll need an Enterprise plan.

`logins[x].location.region`StringAvailable since 1.30.0

The geographic location where the login request originated.

**Note:** To use login location, you'll need an Enterprise plan.

`logins[x].location.zipcode`StringAvailable since 1.30.0

The zipcode where the login request originated.

**Note:** To use login location, you'll need an Enterprise plan.

`logins[x].loginId`String

The User's email address or username at the time of the login request.

`logins[x].userId`UUID

The unique Id of the user that is represented by this login record.

*Example Response JSON*

```json
{
  "logins": [
    {
      "applicationId": "3c219e58-ed0e-4b18-ad48-f4f92793ae32",
      "applicationName": "PiedPiper",
      "instant": 1549493410058,
      "ipAddress": "42.42.42.42",
      "location": {
        "city": "Seattle",
        "country": "US",
        "latitude": 47.60621,
        "longitude": -122.33207,
        "region": "WA"
      },
      "loginId": "jared@piedpiper.com",
      "userId": "4469bea7-8b10-4ad3-94f2-bc8df962b489"
    },
    {
      "applicationId": "3c219e58-ed0e-4b18-ad48-f4f92793ae32",
      "applicationName": "Acme Corp.",
      "instant": 1549485962036,
      "ipAddress": "42.42.42.42",
      "location": {
        "city": "Denver",
        "country": "US",
        "latitude": 39.73913,
        "longitude": -104.9845,
        "region": "CO"
      },
      "loginId": "admin@acme.com",
      "userId": "4469bea7-8b10-4ad3-94f2-bc8df962b489"
    },
    {
      "applicationId": "3c219e58-ed0e-4b18-ad48-f4f92793ae32",
      "applicationName": "Support Portal",
      "instant": 1549387234024,
      "ipAddress": "42.42.42.42",
      "location": {
        "city": "Dhaka",
        "country": "BD",
        "latitude": 23.7104,
        "longitude": 90.40744,
        "region": "81"
      },
      "loginId": "bob@gmail.com",
      "userId": "6a802b03-17e3-404f-830f-ea5c30ca50df"
    }
  ]
}
```