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

# Audit Logs

## Introduction

LILT Translate stores audit logs for all actions performed throughout the platform. The audit logs can be queried by calling the **/activities** endpoint. The logs are stored and returned as JSON blobs. Users can pass request parameters in to query logs based on certain criteria.

## Querying Audit Logs

### Path:

GET **/activities**

```shell CODE theme={null}
https://lilt.com/2/activities
```

### Description:

Fetches audit logs related to your organization/team.

Example curl command:

```shell CODE theme={null}
curl -X GET https://lilt.com/2/activities?key=API_KEY&organizationId=274&from=2021-06-25T00:48:45Z
```

### Request Parameters:

Enlarges the table by opening it in a full screen dialogOpen

| **Parameter**      | **Description**                                                             | **Example Value**    | **Type**           |
| ------------------ | --------------------------------------------------------------------------- | -------------------- | ------------------ |
| **organizationId** | Your organization id                                                        | 274                  | Integer (Required) |
| **from**           | A date and time in ISO8601 format.                                          | 2021-06-05T00:45:42Z | String (Optional)  |
| **to**             | A date and time in ISO8601 format.                                          | 2021-06-05T00:45:42Z | String (Optional)  |
| **actionType**     | One of DATABASE\_ACCESS\_EVENT, API\_CALL\_EVENT, LOGIN\_EVENT              | API\_REQUEST         | String (Optional)  |
| **userId**         | The user id you want to query                                               | 2344                 | Integer (Required) |
| **userName**       | The username of the user                                                    | testuser             | String (Optional)  |
| **resourceType**   | The type of the resource being accessed (i.e. MEMORY, DOCUMENT, JOB, etc.). | MEMORY               | String (Optional)  |
| **requestResult**  | One of ATTEMPT or SUCCESS                                                   | ATTEMPT              | String (Optional)  |
| **correlationId**  | A UUID generated for a specific request.                                    |                      | String (Optional)  |

### Response:

The audit log response is a single JSON object with one field, containing an array with multiple log records. The base schema has the following fields return, irrespective of which action type is requested.

Enlarges the table by opening it in a full screen dialogOpen

| **Field**         | **Description**                                                                                                      | **Type** |
| ----------------- | -------------------------------------------------------------------------------------------------------------------- | -------- |
| **auditLogs**     | An array of JSON blobs containing each audit log.<br />Depending on the actionType, they will have different fields. | Array    |
| **id**            | Unique identifier for the audit log                                                                                  | Long     |
| **timestamp**     | UTC date in ISO 8601 format                                                                                          | String   |
| **userName**      | string identifier for the user,<br />usually an email                                                                | String   |
| **userId**        | unique identifier for the user                                                                                       | Integer  |
| **teamId**        | unique identifier for the team                                                                                       | Integer  |
| **eventType**     | one of "LOGIN\_EVENT",<br />"API\_CALL\_EVENT",<br />"DATABASE\_ACCESS\_EVENT"                                       | String   |
| **requestResult** | enum of either ATTEMPT, SUCCESS                                                                                      | String   |
| **correlationId** | UUID of the request                                                                                                  | String   |

### Response Types

Response types are based on the `actionType` submitted within the request parameter. The available actionType values are API\_CALL\_EVENT, LOGIN\_EVENT, and DATABASE\_ACCESS\_EVENT.

**DATABASE\_ACCESS\_EVENT log:**

Enlarges the table by opening it in a full screen dialogOpen

| **Field**          | **Description**                                                                  | **Type** |
| ------------------ | -------------------------------------------------------------------------------- | -------- |
| **resourceType**   | The type of resource being accessed.                                             | String   |
| **resourceId**     | The id of the resource being accessed.                                           | Integer  |
| **action**         | CREATE, READ, UPDATE, or DELETE                                                  | String   |
| **queryArguments** | Parameters being changed in the resource<br />if it is a CREATE or UPDATE event. | String   |
| **serviceSource**  | The name of the service generating the event.                                    | String   |

**API\_CALL\_EVENT log:**

Enlarges the table by opening it in a full screen dialogOpen

| **Field**          | **Description**                                               | **Type** |
| ------------------ | ------------------------------------------------------------- | -------- |
| **urlSlug**        | The url being requested.                                      | String   |
| **httpMethod**     | The http method of the request                                | String   |
| **requestHeaders** | The request headers.                                          | String   |
| **queryArguments** | The request body.                                             | String   |
| **statusCode**     | The status code of the response.                              | Integer  |
| **endpoint**       | Enum with human readable<br />name for what the endpoint does | String   |

**LOGIN\_EVENT log:**

Enlarges the table by opening it in a full screen dialogOpen

| **Field**     | **Description**                    | **Type** |
| ------------- | ---------------------------------- | -------- |
| **loginType** | enum of either “LOGIN” or “LOGOUT” | String   |

Example Response:

```json JSON theme={null}
{
    "error": "",
    "auditLogs": [
        "{\"_id\": {\"$oid\": \"62c5dc0dd41f7023116bffb1\"}, \"resourceType\": \"FeatureFlag\", \"resourceId\": 1, \"action\": \"READ\", \"type\": \"DATABASE_ACCESS_EVENT\", \"timestamp\": \"2022-07-06T19:01:33.879Z\", \"userId\": 1, \"userName\": \"admin@lilt.com\", \"orgId\": 1, \"teamId\": 1, \"requestResult\": \"ATTEMPT\", \"correlationId\": \"89a954e2-a92f-4df9-8ce7-e20f2892882e\"}",
        "{\"_id\": {\"$oid\": \"62c5dc0ed41f7023116bffb3\"}, \"resourceType\": \"FeatureFlag\", \"resourceId\": 1, \"action\": \"READ\", \"type\": \"DATABASE_ACCESS_EVENT\", \"timestamp\": \"2022-07-06T19:01:34.386Z\", \"userId\": 1, \"userName\": \"admin@lilt.com\", \"orgId\": 1, \"teamId\": 1, \"requestResult\": \"SUCCESS\", \"correlationId\": \"89a954e2-a92f-4df9-8ce7-e20f2892882e\"}",
        "{\"_id\": {\"$oid\": \"62c5dc0ed41f7023116bffb4\"}, \"resourceType\": \"FeatureFlag\", \"resourceId\": 2, \"action\": \"READ\", \"type\": \"DATABASE_ACCESS_EVENT\", \"timestamp\": \"2022-07-06T19:01:34.386Z\", \"userId\": 1, \"userName\": \"admin@lilt.com\", \"orgId\": 1, \"teamId\": 1, \"requestResult\": \"ATTEMPT\", \"correlationId\": \"89a954e2-a92f-4df9-8ce7-e20f2892882e\"}",
}
```
