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

# Search AuditTrailEntries

> Search and list AuditTrailEntry records with filtering, sorting, and pagination.

Represents a read-only log of entity creations and modifications by users or the system. Useful for troubleshooting issues or finding out when an entity was created and what modifications were made to it.

Creation entries (`AuditType = 1`) do not record the values for the individual fields. To infer the initial values, look at the first update entry for that entity and read the `OldValue` for each property.

Use `AuditTrailEntry_EntityId` to search by the integer ID of the audited record.

Not all entities are fully audited. These are the ones currently supported by the `AuditTrailEntry_EntityShortName` filter:

Charge, ContractSchedule, CoworkerBookingCredit, CoworkerContract, CoworkerExtraService, CoworkerInvoice, CoworkerLedgerEntry, CoworkerPaymentMethod, CoworkerProduct, FinancialAccount, CoworkerTask, CrmOpportunity, Booking, Checkin, Coworker, CoworkerIdentityCheck, Resource, Team, Visitor, Business, BusinessSetting, FloorPlanDesk, User.

The `AuditType` field uses the `eAuditType` enum: `1` = Create, `2` = Update, `3` = Delete.

## Authentication

<Note>
  This endpoint requires OAuth2 authentication. Include a valid bearer token in the `Authorization` header.
  The authenticated user must be a full unrestricted administrator or have the **`AuditTrailEntry-List`** role.
</Note>

## Enums

<Accordion title="eAuditType — AuditType values">
  | Value | Name   |
  | ----- | ------ |
  | 1     | Create |
  | 2     | Update |
  | 3     | Delete |
</Accordion>

## Query Parameters

### Pagination & Sorting

<ParamField query="page" type="integer" default="1">
  The page number to retrieve.
</ParamField>

<ParamField query="size" type="integer" default="25">
  The number of records per page.
</ParamField>

<ParamField query="orderBy" type="string">
  The property name to sort results by (e.g. `Name`, `CreatedOn`).
</ParamField>

<ParamField query="dir" type="integer">
  Sort direction. `0` for ascending, `1` for descending.
</ParamField>

### Filters

<ParamField query="AuditTrailEntry_Business" type="integer">
  Filter by iD of the business linked to this record.
</ParamField>

<ParamField query="AuditTrailEntry_EntityShortName" type="string">
  Filter by short name of the audited entity type (e.g. Coworker, Booking, Charge).
</ParamField>

<ParamField query="AuditTrailEntry_Description" type="string">
  Filter by human-readable description of the audit trail entry.
</ParamField>

<ParamField query="AuditTrailEntry_PropertyName" type="string">
  Filter by name of the property that was changed.
</ParamField>

<ParamField query="AuditTrailEntry_AuditType" type="integer">
  Filter by type of audit action: 1 = Create, 2 = Update, 3 = Delete.
</ParamField>

<ParamField query="AuditTrailEntry_OldValue" type="string">
  Filter by previous value of the property before the change.
</ParamField>

<ParamField query="AuditTrailEntry_NewValue" type="string">
  Filter by new value of the property after the change.
</ParamField>

<ParamField query="AuditTrailEntry_ActionBy" type="string">
  Filter by user or system account that performed the action.
</ParamField>

<ParamField query="AuditTrailEntry_EntityId" type="integer">
  Filter by integer ID of the audited record.
</ParamField>

### Range Filters

<ParamField query="from_AuditTrailEntry_EntityId" type="integer">
  Filter by integer ID of the audited record greater than or equal to this value.
</ParamField>

<ParamField query="to_AuditTrailEntry_EntityId" type="integer">
  Filter by integer ID of the audited record less than or equal to this value.
</ParamField>

<ParamField query="from_AuditTrailEntry_CreatedOn" type="string">
  Filter records created on or after this date. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="to_AuditTrailEntry_CreatedOn" type="string">
  Filter records created on or before this date. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="from_AuditTrailEntry_UpdatedOn" type="string">
  Filter records updated on or after this date. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="to_AuditTrailEntry_UpdatedOn" type="string">
  Filter records updated on or before this date. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

## Code Examples

### Simple listing

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    "https://spaces.nexudus.com/api/sys/audittrailentries?page=1&size=15&orderBy=EntityShortName&dir=0" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/sys/audittrailentries?' + new URLSearchParams({
      page: 1,
      size: 15,
      orderBy: 'EntityShortName',
      dir: 1 // Ascending
    }),
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN'
      }
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://spaces.nexudus.com/api/sys/audittrailentries',
      params={
          'page': 1,
          'size': 15,
          'orderBy': 'EntityShortName',
          'dir': 0 // Ascending
      },
      headers={
          'Authorization': 'Bearer YOUR_TOKEN'
      }
  )

  data = response.json()
  ```
</CodeGroup>

### Filtering by EntityShortName

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    "https://spaces.nexudus.com/api/sys/audittrailentries?AuditTrailEntry_EntityShortName=example-value&orderBy=EntityShortName&dir=0" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/sys/audittrailentries?' + new URLSearchParams({
      AuditTrailEntry_EntityShortName: 'example-value',
      orderBy: 'EntityShortName',
      dir: 1
    }),
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN'
      }
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://spaces.nexudus.com/api/sys/audittrailentries',
      params={
          'AuditTrailEntry_EntityShortName': 'example-value',
          'orderBy': 'EntityShortName',
          'dir': 0 // Ascending
      },
      headers={
          'Authorization': 'Bearer YOUR_TOKEN'
      }
  )

  data = response.json()
  ```
</CodeGroup>

### Range filters

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    "https://spaces.nexudus.com/api/sys/audittrailentries?from_AuditTrailEntry_UpdatedOn=2025-01-01T00:00&to_AuditTrailEntry_UpdatedOn=2025-12-31T23:59&orderBy=UpdatedOn&dir=0" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/sys/audittrailentries?' + new URLSearchParams({
      from_AuditTrailEntry_UpdatedOn: '2025-01-01T00:00',
      to_AuditTrailEntry_UpdatedOn: '2025-12-31T23:59',
      orderBy: 'UpdatedOn',
      dir: 1 // Descending
     }),
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN'
      }
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://spaces.nexudus.com/api/sys/audittrailentries',
      params={
          'from_AuditTrailEntry_UpdatedOn': '2025-01-01T00:00',
          'to_AuditTrailEntry_UpdatedOn': '2025-12-31T23:59',
          'orderBy': 'UpdatedOn',
          'dir': 1 // Descending
      },
      headers={
          'Authorization': 'Bearer YOUR_TOKEN'
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Response

### 200

<ResponseField name="Records" type="AuditTrailEntry[]">
  The list of AuditTrailEntry records matching the query. See the [Get one AuditTrailEntry](/rest-api/sys/get-audittrailentries-by-id) endpoint for the full list of properties returned for each record.
</ResponseField>

<Warning>
  **Partial records** — The listing endpoint returns a summary representation of each AuditTrailEntry. The following fields are **not populated** in the `Records[]` response: `OldValue`, `EntityId`.

  To get all fields, fetch the full record using the [Get one AuditTrailEntry](/rest-api/sys/get-audittrailentries-by-id) endpoint.

  **Important for updates:** When updating a record via `PUT`, always retrieve the full record with a `GET` request first, apply your changes to that complete data, and then send the updated record. Do not use data from a listing response as the base for a `PUT` request, as missing fields may be unintentionally cleared.
</Warning>

<ResponseField name="CurrentPage" type="integer">
  Current page number.
</ResponseField>

<ResponseField name="CurrentPageSize" type="integer">
  Number of records per page.
</ResponseField>

<ResponseField name="CurrentOrderField" type="string">
  The field used for sorting.
</ResponseField>

<ResponseField name="CurrentSortDirection" type="integer">
  The sort direction (`0` = ascending, `1` = descending).
</ResponseField>

<ResponseField name="FirstItem" type="integer">
  Index of the first item on the current page.
</ResponseField>

<ResponseField name="LastItem" type="integer">
  Index of the last item on the current page.
</ResponseField>

<ResponseField name="TotalItems" type="integer">
  Total number of matching records across all pages.
</ResponseField>

<ResponseField name="TotalPages" type="integer">
  Total number of pages.
</ResponseField>

<ResponseField name="HasNextPage" type="boolean">
  Whether there is a next page of results.
</ResponseField>

<ResponseField name="HasPreviousPage" type="boolean">
  Whether there is a previous page of results.
</ResponseField>

```json Example Response theme={null}
{
  "Records": [
    {
      "BusinessId": 0,
      "EntityShortName": "",
      "Description": "",
      "PropertyName": "",
      "AuditType": 0,
      "NewValue": null,
      "ActionBy": null,
      "Id": 87654321,
      "UpdatedOn": "2025-01-15T10:30:00Z",
      "CreatedOn": "2025-01-10T08:00:00Z",
      "UniqueId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "UpdatedBy": "admin@example.com",
      "IsNew": false,
      "SystemId": null,
      "ToStringText": "AuditTrailEntry Example",
      "LocalizationDetails": null,
      "CustomFields": null
    }
  ],
  "CurrentPageSize": 15,
  "CurrentPage": 1,
  "CurrentOrderField": "EntityShortName",
  "CurrentSortDirection": 1,
  "FirstItem": 1,
  "HasNextPage": false,
  "HasPreviousPage": false,
  "LastItem": 1,
  "PageNumber": 1,
  "PageSize": 15,
  "TotalItems": 1,
  "TotalPages": 1
}
```
