> For the complete documentation index, see [llms.txt](https://docs.api.intratool.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.intratool.de/api-reference/user-activities.md).

# UserActivities

## Introduction

`UserActivities` track certain activities that the related [User](/api-reference/users.md) initiates and record the [Department](/api-reference/departments.md) in which the activity took place.

Each `UserActivity` has a concrete `type` which defines the kind of activity that is tracked.

An activity is uniquely identified by the combination of the `type` and the related [User](/api-reference/users.md). The associated [Department](/api-reference/departments.md) reflects the user's most recently active location.

The fields `created_at` and `updated_at` indicate the time of the first and most recent occurrence of the activity, respectively.

Activities are only recorded through the use of the intratool application itself and not via the API.

## Model Definition

**Alias**

`userActivity`

**Relations**

| Key          | Relation                                    | Type       | Relation Field(s) |
| ------------ | ------------------------------------------- | ---------- | ----------------- |
| `user`       | [User](/api-reference/users.md)             | Belongs to | `user_id`         |
| `department` | [Department](/api-reference/departments.md) | Belongs to | `department_id`   |

**Types**

* `general` - Any activity of the related [User](/api-reference/users.md).
* `login` - A login by the related [User](/api-reference/users.md).
* `logout` - Any logout of the related User, recorded together with its reason-specific activity.
* `logoutAdministrative` - A logout caused by an administrative logout marker.
* `logoutPasswordChanged` - A logout caused by a password change.
* `logoutSelf` - A logout initiated by the related User.
* `logoutTokenLogin` - A logout caused when a login token replaces the current user session.
* `logoutUnknown` - A logout for which no more specific reason is available.
* `logoutUserDisabled` - A logout caused when the related User is disabled.

## List

List visible `UserActivities`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/user-activities`

**Request Keys**

| Key         | Type      | Default           | Description                          |
| ----------- | --------- | ----------------- | ------------------------------------ |
| `selects`   | `string`  | All fields        | Comma-separated fields to return.    |
| `relations` | `string`  | Default relations | Pipe-separated relations to include. |
| `limit`     | `integer` | No limit          | Maximum number of activities.        |
| `filter`    | `object`  | No filters        | Supported repository filters.        |

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/user-activities', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": 31,
    "user_id": 7,
    "department_id": 6,
    "type": "logout",
    "created_at": "2026-08-06 10:45:00",
    "updated_at": "2026-08-06 10:45:00"
  },
  {
    "id": 32,
    "user_id": 7,
    "department_id": 6,
    "type": "logoutSelf",
    "created_at": "2026-08-06 10:45:00",
    "updated_at": "2026-08-06 10:45:00"
  }
]
```

## Show

Show one visible `UserActivity`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/user-activities/{userActivity}`

**Route Parameters**

| Parameter      | Type      | Description      |
| -------------- | --------- | ---------------- |
| `userActivity` | `integer` | UserActivity ID. |

**Request Keys**

| Key         | Type     | Default           | Description                          |
| ----------- | -------- | ----------------- | ------------------------------------ |
| `selects`   | `string` | All fields        | Comma-separated fields to return.    |
| `relations` | `string` | Default relations | Pipe-separated relations to include. |

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/user-activities/31', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": 31,
  "user_id": 7,
  "department_id": 6,
  "type": "login",
  "created_at": "2026-08-06 08:00:00",
  "updated_at": "2026-08-06 08:00:00"
}
```
