# Audit API

Use the Audit API to query and retrieve audit log entries so you can monitor system and user activities, ensure compliance and security, and search, filter, sort, or export audit data for further analysis. <br><br> This REST API lets you query, scroll through, and download the following audit logs:

   - <i>Action audit logs</i> for system actions, executions, and operations.
   - <i>Business audit logs</i> for entity lifecycle events and user activities.
   - <i>Raw audit logs</i> for low-level system events and operational data.
   - <i>Operational audit logs</i> for internal system operations.
   - <i>Scripting audit logs</i> for script executions and automation events.
   - <i>Trigger audit logs</i> for automated system triggers and workflows.

{% admonition type="info" name="Note" %}You can also use the [command line interface (CLI)](https://doc.sitecore.com/ch/en/developers/cloud-dev/content-hub-command-line-interface--cli-.html) and the [tail command](https://doc.sitecore.com/ch/en/developers/api-reference/cli--sitecore.ch.cli.plugin.audit.commands.html) in particular to query logs.{% /admonition %}

 ## Authentication

 To use the Audit API, you need:

  - The URL of your Content Hub server. You can get this from your Content Hub Administrator. Enter this URL in the <b>{{server}}</b> variable by hovering your mouse over the variable in the <b>Try it</b> pane and then clicking <b>Edit</b>.
  - An [access token and the client ID](https://doc.sitecore.com/ch/en/developers/cloud-dev/oauth-tokens.html#making-requests). Both are sent with every request. You can create a token through the [Content Hub interface](https://doc.sitecore.com/ch/en/users/content-hub/create-an-oauth-client.html)  or by [requesting one using the API itself](https://doc.sitecore.com/ch/en/developers/cloud-dev/oauth-tokens.html#making-requests).


Version: v1.0
License: closed source
Metadata:
  - product: Content Hub

## Servers

```
https://{server}
```

Variables:
- `server`
Default: "your-server"

## Security

### OAuth2

Type: oauth2

## Download OpenAPI description

[Audit API](https://api-docs.sitecore.com/_bundle/ch/audit-api/index.yaml)

## Actions

Query and scroll through action audit log entries for system actions, executions, and operations.

### Query action audit log entries

 - [GET /api/audit/action/query/{entityId}](https://api-docs.sitecore.com/ch/audit-api/actions/auditactionquery.md): Queries the action audit log for entries that match the specified filter and paging parameters. The maximum allowed value for the take parameter is 100.

### Scroll through action audit log entries

 - [GET /api/audit/action/scroll/{entityId}](https://api-docs.sitecore.com/ch/audit-api/actions/auditactionscroll.md): Allows you to scroll through the action audit log in batches using the specified parameters. The maximum allowed value for the take or batchSize parameters is 100.

### Request a download order for action audit log entries

 - [POST /api/audit/action/generate](https://api-docs.sitecore.com/ch/audit-api/actions/auditactiongenerate.md): Creates a download order for action audit log entries.

## Business

Query and scroll through business audit log entries for entity lifecycle events and user activities.

### Query business audit log entries

 - [GET /api/audit/business/query/{entityId}](https://api-docs.sitecore.com/ch/audit-api/business/auditbusinessquery.md): Queries the business audit log for entries that match the specified filter and paging parameters. The maximum allowed value for the take parameter is 100.

### Scroll through business audit log entries

 - [GET /api/audit/business/scroll/{entityId}](https://api-docs.sitecore.com/ch/audit-api/business/auditbusinessscroll.md): Allows you to scroll through the business audit log in batches using the specified parameters. The maximum allowed value for the take or batchSize parameters is 100.

### Request a download order for business audit log entries

 - [POST /api/audit/business/generate](https://api-docs.sitecore.com/ch/audit-api/business/auditbusinessgenerate.md): Creates a download order for business audit log entries.

### Aggregate business audit log entries

 - [POST /api/audit/business/aggregate](https://api-docs.sitecore.com/ch/audit-api/business/auditbusinessaggregate.md): Aggregates business audit log entries using the specified parameters.

## Raw

Query and scroll through raw audit log entries for low-level system events and operational data.

### Query raw audit log entries

 - [GET /api/audit/raw/query/{entityId}](https://api-docs.sitecore.com/ch/audit-api/raw/auditrawquery.md): Queries the raw audit log for entries that match the specified filter and paging parameters. The maximum allowed value for the take parameter is 100.

### Scroll through raw audit log entries

 - [GET /api/audit/raw/scroll/{entityId}](https://api-docs.sitecore.com/ch/audit-api/raw/auditrawscroll.md): Allows you to scroll through the raw audit log in batches using the specified parameters. The maximum allowed value for the take or batchSize parameters is 100.

### Request a download order for raw audit log entries

 - [POST /api/audit/raw/generate](https://api-docs.sitecore.com/ch/audit-api/raw/auditrawgenerate.md): Creates a download order for raw audit log entries. For nonbusiness audit types, only supported file formats are allowed.

## Operational

Query and scroll through raw operational audit log entries for internal system operations.

### Query raw operational audit log entries

 - [GET /api/audit/raw/operational/query/{entityId}](https://api-docs.sitecore.com/ch/audit-api/operational/auditrawoperationalquery.md): Queries the raw operational audit log for entries that match the specified filter and paging parameters. The maximum allowed value for the take parameter is 100.{% admonition type="info" name="Note" %}This endpoint is used exclusively for operational events, encompassing entity updates for M.Job, M.Target, M.JobDescription, M.Agent, and M.AgentActivity entities.{% /admonition %}"

### Scroll through raw operational audit log entries

 - [GET /api/audit/raw/operational/scroll/{entityId}](https://api-docs.sitecore.com/ch/audit-api/operational/auditrawoperationalscroll.md): Allows you to scroll through the raw operational audit log in batches using the specified parameters. The maximum allowed value for the take or batchSize parameters is 100.

### Request a download order for raw operational audit log entries

 - [POST /api/audit/raw/operational/generate](https://api-docs.sitecore.com/ch/audit-api/operational/auditrawoperationalgenerate.md): Creates a download order for raw operational audit log entries.

## Scripting

Query and scroll through scripting audit log entries for script executions and automation events.

### Query scripting audit log entries

 - [GET /api/audit/scripting/query/{entityId}](https://api-docs.sitecore.com/ch/audit-api/scripting/auditscriptingquery.md): Queries the scripting audit log for entries that match the specified filter and paging parameters. The maximum allowed value for the take parameter is 100.

### Scroll through scripting audit log entries

 - [GET /api/audit/scripting/scroll/{entityId}](https://api-docs.sitecore.com/ch/audit-api/scripting/auditscriptingscroll.md): Allows you to scroll through the scripting audit log in batches using the specified parameters. The maximum allowed value for the take or batchSize parameters is 100.

### Requests a download order for scripting audit log entries

 - [POST /api/audit/scripting/generate](https://api-docs.sitecore.com/ch/audit-api/scripting/auditscriptinggenerate.md): This endpoint creates a download order for scripting audit log entries based on the specified parameters.

## Triggers

Query and scroll through trigger audit log entries for automated system triggers and workflows.

### Query trigger audit log entries

 - [GET /api/audit/trigger/query/{entityId}](https://api-docs.sitecore.com/ch/audit-api/triggers/audittriggerquery.md): Queries the trigger audit log for entries that match the specified filter and paging parameters. The maximum allowed value for the take parameter is 100.

### Scroll through trigger audit log entries

 - [GET /api/audit/trigger/scroll/{entityId}](https://api-docs.sitecore.com/ch/audit-api/triggers/audittriggerscroll.md): Allows you to scroll through the trigger audit log in batches using the specified parameters. The maximum allowed value for the take or batchSize parameters is 100.

### Requests a download order for trigger audit log entries

 - [POST /api/audit/trigger/generate](https://api-docs.sitecore.com/ch/audit-api/triggers/audittriggergenerate.md): Creates a download order for trigger audit log entries based on the specified parameters.

