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:

  1. Initial request: Specify a startDate within the last 7 days
  2. Parse response: Extract the nextCursor and events array (up to 5,000 events per request)
  3. Subsequent requests: Use the nextCursor to retrieve the next batch
  4. Check moreEvents: When false, you've retrieved all available events up to the current time
  5. 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)

ParameterTypeRequiredDefaultDescription
startDatestringYes*—Start of date range. Format: YYYY-MM-DD or ISO 8601 YYYY-MM-DDTHH:MM:SSZ. Must be within the last 7 days.
endDatestringNo—End of date range. Format: YYYY-MM-DD or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.
nextCursorstringYes*—Cursor from the previous response. Use this for subsequent requests.
auditTypestringNoANYFilter 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)

FieldTypeRequiredDefaultDescription
startDatestringYes*—Start of date range. Format: YYYY-MM-DD or ISO 8601 YYYY-MM-DDTHH:MM:SSZ. Must be within the last 7 days.
endDatestringNo—End of date range. Format: YYYY-MM-DD or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.
nextCursorstringYes*—Cursor from the previous response. Use this for subsequent requests.
auditTypearrayNoANYFilter 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

FieldTypeDescription
nextCursorstringCursor to use in the next request to retrieve subsequent events.
eventsarrayArray of audit event objects. May contain 0 to 5,000 events.
moreEventsbooleantrue if more events are available; false if all events up to the current time have been retrieved.

Event Object (FILE_AUDIT)

FieldTypeDescription
dateintegerEvent timestamp in milliseconds since epoch.
sourcePathstringPath of the file or folder involved in the action.
targetPathstringTarget path for move/copy actions. N/A if not applicable.
userstringUser who performed the action (name and email).
userIdstringUnique identifier of the user.
actionstringAction performed (e.g., Preview, Upload, Download, Delete).
accessstringAccess method (e.g., Web UI, Desktop App, Mobile).
ipAddressstringIP address of the user.
actionInfostringAdditional information about the action.
auditSourcestringType of audit event. Value: FILE_AUDIT.

Event Object (USER_AUDIT)

FieldTypeDescription
dateintegerEvent timestamp in milliseconds since epoch.
actorstringUser who performed the action (name and email).
subjectstringUser affected by the action (name and email).
actionstringAction performed (e.g., Create, Disable, Delete).
actionInfostringAdditional information about the action.
sourcestringSource of the action (e.g., Web UI, API).
auditSourcestringType of audit event. Value: USER_AUDIT.

Event Object (GROUP_AUDIT)

FieldTypeDescription
dateintegerEvent timestamp in milliseconds since epoch.
actorstringUser who performed the action (name and email).
groupstringName of the group affected.
actionstringAction performed (e.g., Create, Delete, Add Member).
actionInfostringAdditional information about the action.
sourcestringSource of the action (e.g., Web UI, API).
auditSourcestringType 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

StatusErrorDescriptionResolution
400Bad RequestThe cursor is older than 7 days or the request is malformed.Restart the request flow with a new startDate within the last 7 days.
401UnauthorizedInvalid or expired OAuth token.Refresh your OAuth token. See Authentication.
403ForbiddenUser 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.
429Too Many RequestsRate 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"
}'