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

# List Audit Logs

> Lists audit logs with filtering and pagination options.

`Unary` · [`Events`](/docs/api-reference/generated/event/overview)

Lists audit logs with filtering and pagination options.

Use this method to:

* View audit history
* Track user actions
* Monitor system changes

### Examples

* List all logs:

  ```yaml theme={null}
  pagination:
    pageSize: 20
  ```

* Filter by actor:

  ```yaml theme={null}
  filter:
    actorIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"]
    actorPrincipals: ["PRINCIPAL_USER"]
  pagination:
    pageSize: 20
  ```

* Filter by time range:

  ```yaml theme={null}
  filter:
    from: "2024-01-01T00:00:00Z"
    to: "2024-02-01T00:00:00Z"
  pagination:
    pageSize: 20
  ```

## Endpoint

```text theme={null}
POST /api/gitpod.v1.EventService/ListAuditLogs
```

Send a Bearer token as described in [Authentication](/docs/api-reference#authenticate-requests). If your organization uses a custom management-plane domain, replace `https://app.ona.com` with that domain.

## Request example

<CodeGroup>
  ```bash cURL theme={null}
  export ONA_HOST=https://app.ona.com
  export ONA_API_KEY=<your-token>

  curl --request POST \
    --url "$ONA_HOST/api/gitpod.v1.EventService/ListAuditLogs" \
    --header "Authorization: Bearer $ONA_API_KEY" \
    --header "Content-Type: application/json" \
    --data '{
    "pagination": {
      "pageSize": 1
    }
  }'
  ```

  ```python Python theme={null}
  import gitpod.v1.event_pb2 as event_pb2
  import gitpod.v1.pagination_pb2 as pagination_pb2
  from ona_sdk import create_client_from_env

  ona = create_client_from_env()
  request = event_pb2.ListAuditLogsRequest(
      pagination=pagination_pb2.PaginationRequest(
          page_size=1,
      ),
  )
  response = ona.services.event.list_audit_logs(request)
  print(response)
  ```

  ```typescript TypeScript theme={null}
  import { create } from "@bufbuild/protobuf";
  import { createClientFromEnv } from "@gitpod/sdk";
  import { ListAuditLogsRequestSchema } from "@gitpod/sdk/gitpod/v1/event_pb";

  async function main() {
    const ona = createClientFromEnv();
    const request = create(ListAuditLogsRequestSchema, {
      pagination: {
        pageSize: 1,
      },
    });
    const response = await ona.services.event.listAuditLogs(request);
    console.log(response);
  }

  main().catch(console.error);
  ```

  ```go Go theme={null}
  package main

  import (
  	"context"
  	"fmt"
  	"log"

  	"connectrpc.com/connect"
  	"github.com/gitpod-io/gitpod-sdk-go/sdk"
  	gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
  )

  func main() {
  	ona, err := sdk.NewFromEnv()
  	if err != nil {
  		log.Fatal(err)
  	}

  	request := connect.NewRequest(&gitpodpb.ListAuditLogsRequest{
  		Pagination: &gitpodpb.PaginationRequest{
  			PageSize: 1,
  		},
  	})
  	response, err := ona.Services.Event.ListAuditLogs(context.Background(), request)
  	if err != nil {
  		log.Fatal(err)
  	}
  	fmt.Println(response.Msg)
  }
  ```

  ```json Request body theme={null}
  {
    "pagination": {
      "pageSize": 1
    }
  }
  ```
</CodeGroup>

## Request

`gitpod.v1.ListAuditLogsRequest`

| Field        | Type                                                     | Required | Description                                                                                                                                             |
| ------------ | -------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pagination` | [PaginationRequest](#type-gitpod-v1-pagination-request)  | No       | pagination contains the pagination options for listing audit logs                                                                                       |
| `filter`     | [Filter](#type-gitpod-v1-list-audit-logs-request-filter) | No       |                                                                                                                                                         |
| `sort`       | [Sort](#type-gitpod-v1-sort)                             | No       | sort specifies the order of results. When unspecified, results are sorted by creation time descending (newest first). Supported sort fields: createdAt. |

## Response

`gitpod.v1.ListAuditLogsResponse`

| Field        | Type                                                                               | Required | Description                                                         |
| ------------ | ---------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------- |
| `entries`    | array of [AuditLogEntry](#type-gitpod-v1-list-audit-logs-response-audit-log-entry) | No       |                                                                     |
| `pagination` | [PaginationResponse](#type-gitpod-v1-pagination-response)                          | No       | pagination contains the pagination options for listing environments |

## Related types

<a id="type-gitpod-v1-list-audit-logs-request-filter" />

<Accordion title="Filter">
  `gitpod.v1.ListAuditLogsRequest.Filter`

  | Field             | Type                                                   | Required | Description                                                                                        |
  | ----------------- | ------------------------------------------------------ | -------- | -------------------------------------------------------------------------------------------------- |
  | `actorIds`        | array of string                                        | No       | Constraints: `repeated.items.string.uuid=true, repeated.max_items=25, repeated.min_items=0`.       |
  | `actorPrincipals` | array of [Principal](#enum-gitpod-v1-principal)        | No       | Constraints: `repeated.items.enum.defined_only=true, repeated.max_items=25, repeated.min_items=0`. |
  | `subjectIds`      | array of string                                        | No       | Constraints: `repeated.items.string.uuid=true, repeated.max_items=25, repeated.min_items=0`.       |
  | `subjectTypes`    | array of [ResourceType](#enum-gitpod-v1-resource-type) | No       | Constraints: `repeated.items.enum.defined_only=true, repeated.max_items=25, repeated.min_items=0`. |
  | `from`            | RFC 3339 timestamp                                     | No       | from filters audit logs created at or after this timestamp (inclusive).                            |
  | `to`              | RFC 3339 timestamp                                     | No       | to filters audit logs created before this timestamp (exclusive).                                   |
</Accordion>

<a id="type-gitpod-v1-list-audit-logs-response-audit-log-entry" />

<Accordion title="AuditLogEntry">
  `gitpod.v1.ListAuditLogsResponse.AuditLogEntry`

  | Field            | Type                                                      | Required | Description |
  | ---------------- | --------------------------------------------------------- | -------- | ----------- |
  | `id`             | string                                                    | No       |             |
  | `actorId`        | string                                                    | No       |             |
  | `actorPrincipal` | [Principal](#enum-gitpod-v1-principal)                    | No       |             |
  | `subjectId`      | string                                                    | No       |             |
  | `subjectType`    | [ResourceType](#enum-gitpod-v1-resource-type)             | No       |             |
  | `action`         | string                                                    | No       |             |
  | `createdAt`      | RFC 3339 timestamp                                        | No       |             |
  | `kind`           | [AuditLogEntryKind](#enum-gitpod-v1-audit-log-entry-kind) | No       |             |
</Accordion>

<a id="type-gitpod-v1-pagination-request" />

<Accordion title="PaginationRequest">
  `gitpod.v1.PaginationRequest`

  | Field      | Type    | Required | Description                                                                                                                              |
  | ---------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
  | `pageSize` | integer | No       | Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. Constraints: `int32.gte=0, int32.lte=100`. |
  | `token`    | string  | No       | Token for the next set of results that was returned as next\_token of a PaginationResponse                                               |
</Accordion>

<a id="type-gitpod-v1-pagination-response" />

<Accordion title="PaginationResponse">
  `gitpod.v1.PaginationResponse`

  | Field       | Type   | Required | Description                                                                             |
  | ----------- | ------ | -------- | --------------------------------------------------------------------------------------- |
  | `nextToken` | string | No       | Token passed for retrieving the next set of results. Empty if there are no more results |
</Accordion>

<a id="type-gitpod-v1-sort" />

<Accordion title="Sort">
  `gitpod.v1.Sort`

  | Field   | Type                                    | Required | Description                          |
  | ------- | --------------------------------------- | -------- | ------------------------------------ |
  | `field` | string                                  | No       | Field name to sort by, in camelCase. |
  | `order` | [SortOrder](#enum-gitpod-v1-sort-order) | No       |                                      |
</Accordion>

<a id="enum-gitpod-v1-audit-log-entry-kind" />

<Accordion title="AuditLogEntryKind">
  AuditLogEntryKind identifies the coarse query and rendering family of an audit-log entry.

  | Value                                              | Number | Description     |
  | -------------------------------------------------- | -----: | --------------- |
  | `AUDIT_LOG_ENTRY_KIND_UNSPECIFIED`                 |      0 |                 |
  | `AUDIT_LOG_ENTRY_KIND_AGENT_SECURITY_EXEC_BLOCKED` |      1 | **Deprecated.** |
  | `AUDIT_LOG_ENTRY_KIND_AGENT_SECURITY_EXEC_AUDITED` |      2 | **Deprecated.** |
  | `AUDIT_LOG_ENTRY_KIND_RESOURCE_CHANGE`             |      3 |                 |
  | `AUDIT_LOG_ENTRY_KIND_CREDENTIAL_ACCESS`           |      4 |                 |
  | `AUDIT_LOG_ENTRY_KIND_ENVIRONMENT_VETO`            |      5 |                 |
</Accordion>

<a id="enum-gitpod-v1-principal" />

<Accordion title="Principal">
  | Value                       | Number | Description |
  | --------------------------- | -----: | ----------- |
  | `PRINCIPAL_UNSPECIFIED`     |      0 |             |
  | `PRINCIPAL_ACCOUNT`         |      1 |             |
  | `PRINCIPAL_USER`            |      2 |             |
  | `PRINCIPAL_RUNNER`          |      3 |             |
  | `PRINCIPAL_ENVIRONMENT`     |      4 |             |
  | `PRINCIPAL_SERVICE_ACCOUNT` |      5 |             |
  | `PRINCIPAL_RUNNER_MANAGER`  |      6 |             |
</Accordion>

<a id="enum-gitpod-v1-resource-type" />

<Accordion title="ResourceType">
  | Value                                        | Number | Description |
  | -------------------------------------------- | -----: | ----------- |
  | `RESOURCE_TYPE_UNSPECIFIED`                  |      0 |             |
  | `RESOURCE_TYPE_ENVIRONMENT`                  |      1 |             |
  | `RESOURCE_TYPE_RUNNER`                       |      2 |             |
  | `RESOURCE_TYPE_PROJECT`                      |      3 |             |
  | `RESOURCE_TYPE_TASK`                         |      4 |             |
  | `RESOURCE_TYPE_TASK_EXECUTION`               |      5 |             |
  | `RESOURCE_TYPE_SERVICE`                      |      6 |             |
  | `RESOURCE_TYPE_ORGANIZATION`                 |      7 |             |
  | `RESOURCE_TYPE_USER`                         |      8 |             |
  | `RESOURCE_TYPE_ENVIRONMENT_CLASS`            |      9 |             |
  | `RESOURCE_TYPE_RUNNER_SCM_INTEGRATION`       |     10 |             |
  | `RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN`    |     11 |             |
  | `RESOURCE_TYPE_GROUP`                        |     12 |             |
  | `RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN`        |     13 |             |
  | `RESOURCE_TYPE_USER_PREFERENCE`              |     14 |             |
  | `RESOURCE_TYPE_SERVICE_ACCOUNT`              |     15 |             |
  | `RESOURCE_TYPE_SECRET`                       |     16 |             |
  | `RESOURCE_TYPE_SSO_CONFIG`                   |     17 |             |
  | `RESOURCE_TYPE_DOMAIN_VERIFICATION`          |     18 |             |
  | `RESOURCE_TYPE_AGENT_EXECUTION`              |     19 |             |
  | `RESOURCE_TYPE_RUNNER_LLM_INTEGRATION`       |     20 |             |
  | `RESOURCE_TYPE_AGENT`                        |     21 |             |
  | `RESOURCE_TYPE_ENVIRONMENT_SESSION`          |     22 |             |
  | `RESOURCE_TYPE_USER_SECRET`                  |     23 |             |
  | `RESOURCE_TYPE_ORGANIZATION_POLICY`          |     24 |             |
  | `RESOURCE_TYPE_ORGANIZATION_SECRET`          |     25 |             |
  | `RESOURCE_TYPE_PROJECT_ENVIRONMENT_CLASS`    |     26 |             |
  | `RESOURCE_TYPE_BILLING`                      |     27 |             |
  | `RESOURCE_TYPE_PROMPT`                       |     28 |             |
  | `RESOURCE_TYPE_COUPON`                       |     29 |             |
  | `RESOURCE_TYPE_COUPON_REDEMPTION`            |     30 |             |
  | `RESOURCE_TYPE_ACCOUNT`                      |     31 |             |
  | `RESOURCE_TYPE_INTEGRATION`                  |     32 |             |
  | `RESOURCE_TYPE_WORKFLOW`                     |     33 |             |
  | `RESOURCE_TYPE_WORKFLOW_EXECUTION`           |     34 |             |
  | `RESOURCE_TYPE_WORKFLOW_EXECUTION_ACTION`    |     35 |             |
  | `RESOURCE_TYPE_SNAPSHOT`                     |     36 |             |
  | `RESOURCE_TYPE_PREBUILD`                     |     37 |             |
  | `RESOURCE_TYPE_ORGANIZATION_LLM_INTEGRATION` |     38 |             |
  | `RESOURCE_TYPE_CUSTOM_DOMAIN`                |     39 |             |
  | `RESOURCE_TYPE_ROLE_ASSIGNMENT_CHANGED`      |     40 |             |
  | `RESOURCE_TYPE_GROUP_MEMBERSHIP_CHANGED`     |     41 |             |
  | `RESOURCE_TYPE_WEBHOOK`                      |     42 |             |
  | `RESOURCE_TYPE_SCIM_CONFIGURATION`           |     43 |             |
  | `RESOURCE_TYPE_SERVICE_ACCOUNT_SECRET`       |     44 |             |
  | `RESOURCE_TYPE_ANNOUNCEMENT_BANNER`          |     45 |             |
  | `RESOURCE_TYPE_SERVICE_ACCOUNT_TOKEN`        |     46 |             |
  | `RESOURCE_TYPE_ROLE_ASSIGNMENT`              |     47 |             |
  | `RESOURCE_TYPE_WARM_POOL`                    |     48 |             |
  | `RESOURCE_TYPE_NOTIFICATION`                 |     49 |             |
  | `RESOURCE_TYPE_SECURITY_POLICY`              |     50 |             |
</Accordion>

<a id="enum-gitpod-v1-sort-order" />

<Accordion title="SortOrder">
  | Value                    | Number | Description |
  | ------------------------ | -----: | ----------- |
  | `SORT_ORDER_UNSPECIFIED` |      0 |             |
  | `SORT_ORDER_ASC`         |      1 |             |
  | `SORT_ORDER_DESC`        |      2 |             |
</Accordion>
