Audit Reporting API v2
The Audit Reporting API v2 lets you retrieve audit records for login activity, file actions, permission changes, configuration changes, and more. This streaming API provides near real-time access to events from the last 7 days.
Note: Version 2 uses cursors to stream audit events continuously. Version 1 requires creating reports with specific time ranges. For events older than 7 days, use Audit Reporting API v1.
Base URL
https://{domain}.egnyte.com/pubapi/v2/audit
Authentication
All requests require an OAuth 2.0 Bearer token in the Authorization header:
Authorization: Bearer {access_token}
Only admin users or power users with the "can run reports" role can access this API. See Authentication for details on obtaining a token.
Rate Limits
- 10 requests per minute
- 100 requests per hour
When rate limited, the API returns HTTP 429 with a Retry-After header indicating the number of seconds to wait before retrying. Implement exponential backoff or respect the Retry-After value.
How It Works
The Audit Reporting API v2 streams events using a cursor-based pagination model:
- Initial request: Specify a
startDatewithin the last 7 days - Parse response: Extract the
nextCursorandeventsarray (up to 5,000 events per request) - Subsequent requests: Use the
nextCursorto retrieve the next batch - Check
moreEvents: Whenfalse, you've retrieved all available events up to the current time - Repeat: Continue polling with the latest cursor to retrieve new events as they occur
Each request returns events spanning up to 30 minutes of history. If fewer than 5,000 events occurred in that window, the nextCursor advances to the next 30-minute span. If 5,000 events are returned, the cursor points to the last event to ensure no events are missed.
Warning: Cursors expire after 7 days. If you receive a 400 error, restart from Step 1 with a new startDate.
Retrieve Audit Events
Retrieve audit events for a specified date range or continue streaming from a cursor.
Request
GET /pubapi/v2/audit/stream
POST /pubapi/v2/audit/stream
Query Parameters (GET)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
startDate | string | Yes* | — | Start of date range. Format: YYYY-MM-DD or ISO 8601 YYYY-MM-DDTHH:MM:SSZ. Must be within the last 7 days. |
endDate | string | No | — | End of date range. Format: YYYY-MM-DD or ISO 8601 YYYY-MM-DDTHH:MM:SSZ. |
nextCursor | string | Yes* | — | Cursor from the previous response. Use this for subsequent requests. |
auditType | string | No | ANY | Filter events by type. Repeat the parameter to specify multiple types (e.g., auditType=FILE_AUDIT&auditType=LOGIN_AUDIT). Accepts: FILE_AUDIT, LOGIN_AUDIT, PERMISSION_AUDIT, USER_AUDIT, GROUP_AUDIT, WG_SETTINGS_AUDIT, WORKFLOW_AUDIT, WORKFLOW_TEMPLATES_AUDIT, QUALITY_DOCS_AUDIT, QUALITY_DOCS_CATEGORIES_AUDIT, QUALITY_DOCS_COURSES_AUDIT, ETMF_AUDIT, SNAPSHOT_RESTORE_AUDIT, ESIGNATURE_AUDIT, UPLOAD_REQUESTS_AUDIT, AI_SAFEGUARDS_ENTRY_ALLOWED_AUDIT, AI_SAFEGUARDS_ENTRY_REJECTED_AUDIT, AI_SAFEGUARDS_ENTRY_REPORTED_AUDIT, ANY. |
* Either startDate or nextCursor is required, but not both.
Request Body (POST)
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
startDate | string | Yes* | — | Start of date range. Format: YYYY-MM-DD or ISO 8601 YYYY-MM-DDTHH:MM:SSZ. Must be within the last 7 days. |
endDate | string | No | — | End of date range. Format: YYYY-MM-DD or ISO 8601 YYYY-MM-DDTHH:MM:SSZ. |
nextCursor | string | Yes* | — | Cursor from the previous response. Use this for subsequent requests. |
auditType | array | No | ANY | Filter events by type. Accepts one or more of: FILE_AUDIT, LOGIN_AUDIT, PERMISSION_AUDIT, USER_AUDIT, GROUP_AUDIT, WG_SETTINGS_AUDIT, WORKFLOW_AUDIT, WORKFLOW_TEMPLATES_AUDIT, QUALITY_DOCS_AUDIT, QUALITY_DOCS_CATEGORIES_AUDIT, QUALITY_DOCS_COURSES_AUDIT, ETMF_AUDIT, SNAPSHOT_RESTORE_AUDIT, ESIGNATURE_AUDIT, UPLOAD_REQUESTS_AUDIT, AI_SAFEGUARDS_ENTRY_ALLOWED_AUDIT, AI_SAFEGUARDS_ENTRY_REJECTED_AUDIT, AI_SAFEGUARDS_ENTRY_REPORTED_AUDIT, ANY. |
* Either startDate or nextCursor is required, but not both.
Example Request (GET)
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v2/audit/stream?startDate=2021-12-08" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Example Request (POST)
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/audit/stream" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "startDate": "2021-12-08", "endDate": "2021-12-10", "auditType": [ "FILE_AUDIT", "LOGIN_AUDIT", "PERMISSION_AUDIT" ] }'
Example Request with Cursor
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/audit/stream" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "nextCursor": "QmlnVGFibGVLZXk=" }'
Response
200 OK
| Field | Type | Description |
|---|---|---|
nextCursor | string | Cursor to use in the next request to retrieve subsequent events. |
events | array | Array of audit event objects. May contain 0 to 5,000 events. |
moreEvents | boolean | true if more events are available; false if all events up to the current time have been retrieved. |
Event Object (FILE_AUDIT)
| Field | Type | Description |
|---|---|---|
date | integer | Event timestamp in milliseconds since epoch. |
sourcePath | string | Path of the file or folder involved in the action. |
targetPath | string | Target path for move/copy actions. N/A if not applicable. |
user | string | User who performed the action (name and email). |
userId | string | Unique identifier of the user. |
action | string | Action performed (e.g., Preview, Upload, Download, Delete). |
access | string | Access method (e.g., Web UI, Desktop App, Mobile). |
ipAddress | string | IP address of the user. |
actionInfo | string | Additional information about the action. |
auditSource | string | Type of audit event. Value: FILE_AUDIT. |
Event Object (USER_AUDIT)
| Field | Type | Description |
|---|---|---|
date | integer | Event timestamp in milliseconds since epoch. |
actor | string | User who performed the action (name and email). |
subject | string | User affected by the action (name and email). |
action | string | Action performed (e.g., Create, Disable, Delete). |
actionInfo | string | Additional information about the action. |
source | string | Source of the action (e.g., Web UI, API). |
auditSource | string | Type of audit event. Value: USER_AUDIT. |
Event Object (GROUP_AUDIT)
| Field | Type | Description |
|---|---|---|
date | integer | Event timestamp in milliseconds since epoch. |
actor | string | User who performed the action (name and email). |
group | string | Name of the group affected. |
action | string | Action performed (e.g., Create, Delete, Add Member). |
actionInfo | string | Additional information about the action. |
source | string | Source of the action (e.g., Web UI, API). |
auditSource | string | Type of audit event. Value: GROUP_AUDIT. |
Example Response
{
"nextCursor": "AAN_lwABAX1zZe9AAAAAAAAAAAAAAAAAAAAAAA",
"events": [
{
"date": 1638936585716,
"sourcePath": "/Shared/Departments/Marketing/Branding/Logo.jpg",
"targetPath": "N/A",
"user": "Jack Smith ( jsmith@company.com )",
"userId": "101",
"action": "Preview",
"access": "Web UI",
"ipAddress": "173.226.89.189",
"actionInfo": "",
"auditSource": "FILE_AUDIT"
},
{
"date": 1638937051697,
"sourcePath": "/Shared/Departments/Engineering/ProductY/Photo.png",
"targetPath": "N/A",
"user": "Adam Jackson ( ajackson@company.com )",
"userId": "146",
"action": "Upload",
"access": "Web UI",
"ipAddress": "172.8.18.17",
"actionInfo": "",
"auditSource": "FILE_AUDIT"
},
{
"date": 1638940605824,
"actor": "Jennifer Watkins ( jwatkins@company.com )",
"subject": "Paul Chen ( pchen@company.com )",
"action": "Disable",
"actionInfo": "",
"source": "Web UI",
"auditSource": "USER_AUDIT"
},
{
"date": 1638942414189,
"actor": "Jennifer Watkins ( jwatkins@company.com )",
"group": "Engineering",
"action": "Create",
"actionInfo": "",
"source": "Web UI",
"auditSource": "GROUP_AUDIT"
}
],
"moreEvents": true
}
Error Codes
| Status | Error | Description | Resolution |
|---|---|---|---|
| 400 | Bad Request | The cursor is older than 7 days or the request is malformed. | Restart the request flow with a new startDate within the last 7 days. |
| 401 | Unauthorized | Invalid or expired OAuth token. | Refresh your OAuth token. See Authentication. |
| 403 | Forbidden | User lacks permission to access audit records or the domain plan does not support audit reporting. | Ensure the user is an admin or power user with "can run reports" role. Verify the domain plan includes audit reporting. |
| 429 | Too Many Requests | Rate limit exceeded (10 requests/minute or 100 requests/hour). | Retry after the number of seconds specified in the Retry-After response header, or implement exponential backoff. |
Code Examples
GET /pubapi/v2/audit/stream?startDate=2021-12-08
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v2/audit/stream?startDate=2021-12-08" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
POST /pubapi/v2/audit/stream
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/audit/stream" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "nextCursor": "AAN_lwABAX1zZe9AAAAAAAAAAAAAAAAAAAAAAA" }'
POST /pubapi/v2/audit/stream
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/audit/stream" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "startDate": "2021-12-08", "auditType": [ "FILE_AUDIT", "LOGIN_AUDIT", "PERMISSION_AUDIT" ] }'
POST /pubapi/v2/audit/stream
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/audit/stream" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "startDate": "2021-12-08" }'
POST /pubapi/v2/audit/stream
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/audit/stream" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "startDate": "2021-12-08" }'
Related Resources
- Audit Reporting API v1 — For retrieving audit events older than 7 days
- Authentication — How to obtain and refresh OAuth tokens
- User Management API — Manage users and permissions
