> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/api-reference/platform-apis/audit-trails.md).

# Audit Trails

Read Harness audit events, save audit filters, and compare the YAML before and after a change with the Harness Audit Trails API.

The Audit Trails API reads the record of who changed what in your Harness account, and when.

## Request basics

* **API key token**: Send it in the `x-api-key` header on every request. Go to [Manage API keys](https://developer.harness.io/harness-platform/use-harness-platform/automation/api/add-and-manage-api-keys) to create a key and token.
* **Account, organization, and project IDs**: Send `accountIdentifier` as a query parameter on every request. Add `orgIdentifier` and `projectIdentifier` to narrow saved filters to an organization or project. Go to [Organizations and projects](https://developer.harness.io/harness-platform/use-harness-platform/organizations-and-projects) to find these identifiers.
* **Base URL**: Send requests to `https://app.harness.io/gateway/audit/api`, followed by the endpoint path.

## Example request

List the most recent audit events in your account:

```bash
curl -X POST "https://app.harness.io/gateway/audit/api/audits/list?accountIdentifier=ACCOUNT_ID&pageIndex=0&pageSize=20" \
  -H "x-api-key: $HARNESS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"filterType": "Audit"}'
```

Replace `ACCOUNT_ID` with your own values, and set `HARNESS_API_KEY` to your API key token.

## Find an endpoint

Endpoint paths are relative to the base URL.

* **Audit events**: A record of each create, update, delete, and login action, with the user, resource, and time. List events with `POST /audits/list`, and narrow them with the filter in the request body. Go to [Audit Trails overview](https://developer.harness.io/harness-platform/use-harness-platform/governance/audit-trail/audit-trail) to read audit events in the UI.
* **Audit filters**: Saved searches that narrow audit events by user, resource, or action. List saved filters with `GET /auditFilters` and create one with `POST /auditFilters`.
* **Audit YAML**: The YAML of a resource before and after a change, so you can see exactly what changed. Read the before and after YAML of a change with `GET /auditYaml`.
