# Audit

**Base URL:** `https://api.welkinhealth.com/{tenantName}/{instanceName}/audit`

The Audit API provides access to the audit trail of all actions performed within a Welkin instance. Audit records are read-only and cannot be modified or deleted via the API.

***

## Get Audit Records

**GET** `/audit`

Returns a paginated list of audit records filtered by date range, actor, or entity.

### Query Parameters

| Parameter    | Type              | Required | Description                                        |
| ------------ | ----------------- | -------- | -------------------------------------------------- |
| `startDate`  | string (ISO 8601) | No       | Filter records from this date                      |
| `endDate`    | string (ISO 8601) | No       | Filter records to this date                        |
| `actorId`    | string            | No       | Filter by user who performed the action            |
| `patientId`  | string            | No       | Filter by associated patient                       |
| `entityType` | string            | No       | Entity type (e.g., `PATIENT`, `ENCOUNTER`, `TASK`) |
| `action`     | string            | No       | Action type (e.g., `CREATE`, `UPDATE`, `DELETE`)   |
| `page`       | integer           | No       | Page number (default: 0)                           |
| `size`       | integer           | No       | Page size (default: 20)                            |

### Example Request

```bash
curl -X GET "https://api.welkinhealth.com/acme/live/audit?startDate=2026-03-01T00:00:00Z&endDate=2026-03-19T23:59:59Z&entityType=PATIENT" \
  -H "Authorization: Bearer {access_token}"
```

### Example Response

```json
{
  "content": [
    {
      "id": "aud_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "actorId": "usr_1a2b3c4d-5e6f-7890-abcd-ef1234567890",
      "actorName": "Jane Smith",
      "entityType": "PATIENT",
      "entityId": "pt_7f3a9b2c-1d4e-4f8a-b5c6-d7e8f9a0b1c2",
      "action": "UPDATE",
      "changes": {
        "phoneNumber": { "from": "+15551234567", "to": "+15559876543" }
      },
      "timestamp": "2026-03-19T14:32:00Z",
      "ipAddress": "192.168.1.100"
    }
  ],
  "totalElements": 1,
  "totalPages": 1,
  "page": 0,
  "size": 20
}
```

> **Note:** Access to audit logs requires the `AUDIT_READ` permission on the API client. Records are retained per your organization's data retention policy.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.welkinhealth.com/developer-and-integration-guide/api-reference/audit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
