> ## Documentation Index
> Fetch the complete documentation index at: https://docs.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tracking User Runtimes

When a user signs in to the platform from a new runtime (i.e., from a device or browser that has not previously been used to authenticate into Storefront Gateway), the system registers that runtime (as a Storefront Gateway Runtime entity) in the database for tracking purposes.

## Runtime Creation

After a successful user authentication, the system executes the following tasks:

* Creates the new ULM Runtime entity.
* Associates the Runtime entity to the currently authenticated user (i.e., to the unique Storefront Gateway User entity).
* Attaches the Runtime to the current authentication context.
* Creates an entry in Storefront Gateway's **login history** and **access** logs.
* Sends a JRUNTIMEID cookie to the browser.

**Runtime Unique ID**

The Storefront Gateway Runtime's unique internal identifier (saved as the id property on the entity) will be obtained through one of the following methods:

1. The system first checks for the existence of a GUID value in the request body of the POST /session/start API (i.e., the API that initiates the Authenticate User Process).
2. If no runtime is found, then the system checks for and reads from the JRUNTIMEID cookie value.
3. If the JRUNTIMEID cookie also does not exist, then the system fallbacks to generating a random universally unique identifier (UUID).

**Runtime User Agent**

From the standard HTTP [User Agent](https://en.wikipedia.org/wiki/User_agent) header, the following information about the device will be resolved:

* display name
* platform type
* device type

These pieces of data are captured as properties on the Storefront Gateway Runtime entity. See the Storefront Gateway Data Model section for more information on how properties (and attributes) are stored on Storefront Gateway data entities.

## Retrieve Current Runtime

The following methods are used to track current user runtime:

* The JRUNTIMEID cookie
* API requests

The following APIs can be used to track the current user's runtime:

**GET /runtime**

Retrieves information the Storefront Gateway runtime specified by the currently authenticated user's open session.

```
**RESPONSE - body**
{ 
   "id": 5023, 
   "type": "com.uxpsystems.mint.device.Runtime", 
   "displayName": "Device (1)", 
   "status": "activated", 
   "guid": "23784568-2bb4-4625-9bb0-9cf41afbd59d", 
   "version": "Unknown", 
   "platformType": "Unknown", 
   "deviceType": "UNKNOWN", 
   "userAgent": "PostmanRuntime/7.1.1", 
   "createdDate": 1541534787000 
}
```

**GET /user/loginHistory**

Retrieves a list of the currently authenticated user's login attempts and results. You can specify pagination query parameters in order to control the amount of responses per page.

```
**RESPONSE - body**
[ 
   { 
      "timestamp": 1541538186000, 
      "deviceIP": "69.150.27.29, 10.0.1.16", 
      "runtime": { 
         "guid": "23784568-2bb4-4625-9bb0-9cf41afbd59d" 
      }, 
      "requestedHost": "ulm.uxpsystemsdemo.com" }
   , 
   { 
      "timestamp": 1541536918000, 
      "deviceIP": "158.106.83.220", 
      "runtime": { 
         "guid": "000000000001A0" 
      }, 
      "requestedHost": "api.uxpsystemsdemo.com" 
   }, 
   { 
      "timestamp": 1541534519000, 
      "deviceIP": "69.150.27.29, 10.0.1.16", 
      "requestedHost": "ulm.uxpsystemsdemo.com" 
   }, 
   { 
      "timestamp": 1541100221000, 
      "relyingPartyId": "facebook", 
      "deviceIP": "158.106.83.220, 10.0.1.16", 
      "requestedHost": "ulm.uxpsystemsdemo.com", 
      "relyingPartyProtocol": "OIDC" 
   }, 
   { 
      "timestamp": 1541011149000, 
      "relyingPartyId": "https://slack.com", 
      "deviceIP": "69.150.27.29, 10.0.1.16", 
      "requestedHost": "ulm.uxpsystemsdemo.com", 
      "relyingPartyProtocol": "OIDC" 
   } 
]
```

**GET /user/runtimes/\{GUID}/loginHistory**

Retrieves a list of login attempts for the current user on specified runtime GUID.

```
**RESPONSE - body**
[ 
   { 
      "timestamp": 1541538186000, 
      "deviceIP": "69.150.27.29, 10.0.1.16", 
      "runtime": { 
         "guid": "23784568-2bb4-4625-9bb0-9cf41afbd59d" 
      }, 
      "requestedHost": "ulm.uxpsystemsdemo.com" 
   }, 
   { 
      "timestamp": 1541534787000, 
      "deviceIP": "69.150.27.29, 10.0.1.16", 
      "runtime": { 
         "guid": "23784568-2bb4-4625-9bb0-9cf41afbd59d" 
      }, 
      "requestedHost": "ulm.uxpsystemsdemo.com" 
   } 
]
```

See the APIs section of the [Knowledge Center](https://docs.saas.amdocs.com/) for the full Storefront Gateway REST API specification that includes these APIs.

**Parent topic:**[HTTP Headers](c_connectHTTPheaders)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.