Skip to content

Audit Activity API ​

Query SQL Server audit events captured by the kAudit agent. All endpoints require the read:audit-activity scope.

List audit activity events ​

http
GET /api/v1/public/audit-activity

Returns a paginated list of audit activity events, ordered by timestamp (newest first by default).

Query parameters ​

ParameterTypeDefaultDescription
pageinteger1Page number (1-based)
pageSizeinteger20Results per page (max 100)
searchstring—Full-text search across event fields
sortBystring—Column to sort by (e.g., Timestamp)
sortDirectionstringdescSort direction: asc or desc
actionIdstring—Filter by SQL action code (e.g., SL, IN, LO)
databaseNamestring—Filter by database name
principalNamestring—Filter by SQL login / principal name
startTimeISO 8601—Start of time range (e.g., 2026-05-01T00:00:00Z)
endTimeISO 8601—End of time range

Example request ​

bash
curl "https://api.kovoco.net/api/v1/public/audit-activity?actionId=SL&databaseName=customers_db&pageSize=10" \
  -H "X-Api-Key: your-api-key-here"

Example response ​

json
{
  "data": [
    {
      "recordId": "abc123-def456",
      "tenantId": "your-tenant-id",
      "eventTime": "2026-05-03T14:23:01Z",
      "actionId": "SL",
      "succeeded": true,
      "serverInstanceName": "Production SQL 01",
      "databaseName": "customers_db",
      "schemaName": "dbo",
      "objectName": "Orders",
      "serverPrincipalName": "app_service_account",
      "databasePrincipalName": "dbo",
      "applicationName": "MyApp",
      "hostName": "app-server-01",
      "clientIp": "10.0.1.50",
      "sourceType": "SqlAudit",
      "statementPreview": "SELECT TOP 100 * FROM dbo.Orders WHERE ..."
    }
  ],
  "meta": {
    "totalCount": 2483,
    "page": 1,
    "pageSize": 10,
    "totalPages": 249,
    "hasPreviousPage": false,
    "hasNextPage": true,
    "timestamp": "2026-05-03T14:25:00Z",
    "apiVersion": "1.0"
  }
}

Response fields ​

FieldTypeDescription
recordIdstringUnique identifier for this audit event
tenantIdstringThe tenant this event belongs to
eventTimeISO 8601When the event occurred on the SQL Server
actionIdstringSQL action code (SL, IN, UP, DL, EX, CR, AL, DR, LO, etc.)
succeededbooleanWhether the SQL action completed successfully
serverInstanceNamestringThe SQL Server instance name
databaseNamestringThe database the event occurred on
schemaNamestringThe schema of the accessed object
objectNamestringThe database object accessed or modified
serverPrincipalNamestringThe server-level login that performed the action
databasePrincipalNamestringThe database-level principal
applicationNamestringThe client application name (if captured)
hostNamestringThe client host machine name (if captured)
clientIpstringThe client IP address
sourceTypestringThe audit source type
statementPreviewstringA preview of the SQL statement (if captured)

Get event by ID ​

http
GET /api/v1/public/audit-activity/{recordId}

Returns a single audit activity event with full detail.

Path parameters ​

ParameterDescription
recordIdThe unique record identifier (string)

Example request ​

bash
curl "https://api.kovoco.net/api/v1/public/audit-activity/abc123-def456" \
  -H "X-Api-Key: your-api-key-here"

Example response ​

json
{
  "data": {
    "recordId": "abc123-def456",
    "tenantId": "your-tenant-id",
    "eventTime": "2026-05-03T14:23:01Z",
    "actionId": "SL",
    "succeeded": true,
    "serverInstanceName": "Production SQL 01",
    "databaseName": "customers_db",
    "schemaName": "dbo",
    "objectName": "Orders",
    "serverPrincipalName": "app_service_account",
    "databasePrincipalName": "dbo",
    "applicationName": "MyApp",
    "hostName": "app-server-01",
    "clientIp": "10.0.1.50",
    "statement": "SELECT TOP 100 * FROM dbo.Orders WHERE OrderDate > '2026-01-01'"
  },
  "meta": {
    "timestamp": "2026-05-03T14:25:00Z",
    "apiVersion": "1.0"
  }
}

Error responses ​

StatusMeaning
404Record not found within your authorized tenants
400Invalid record ID format

Get activity summary ​

http
GET /api/v1/public/audit-activity/summary

Returns aggregate metrics for audit activity across your tenants.

Query parameters ​

ParameterTypeDefaultDescription
startTimeISO 8601—Start of time range
endTimeISO 8601—End of time range (defaults to now)

Example request ​

bash
curl "https://api.kovoco.net/api/v1/public/audit-activity/summary?startTime=2026-05-01T00:00:00Z" \
  -H "X-Api-Key: your-api-key-here"

Example response ​

json
{
  "data": {
    "totalCount": 48291,
    "successfulCount": 47832,
    "failedCount": 459,
    "distinctDatabases": 12,
    "distinctPrincipals": 34,
    "latestEventTime": "2026-05-03T14:23:01Z"
  },
  "meta": {
    "timestamp": "2026-05-03T14:25:00Z",
    "apiVersion": "1.0"
  }
}

Summary fields ​

FieldTypeDescription
totalCountintegerTotal audit events in the time range
successfulCountintegerEvents where the SQL action succeeded
failedCountintegerEvents where the action failed or was denied
distinctDatabasesintegerNumber of distinct databases with activity
distinctPrincipalsintegerNumber of distinct SQL logins with activity
latestEventTimeISO 8601Timestamp of the most recent event

Common error responses ​

All endpoints in this section may return:

StatusCodeDescription
401unauthorizedAPI key is missing or invalid
403forbiddenAPI key does not have the read:audit-activity scope, or no tenant claims
429rate_limitedRate limit exceeded — check Retry-After header
503service_unavailableThe audit activity query service is temporarily offline

SQL Audit Monitoring, made simple.