Skip to main content

Audit Logs API

Overview

The Audit Logs API provides comprehensive audit trail capabilities for Digital.ai OKRs, tracking all user actions and system changes. Monitor who made changes, when changes occurred, and what was modified across objectives, key results, sessions, and other OKR entities. This API enables compliance reporting, change tracking, and detailed analysis of user activities within your OKR system.

Every action performed in the Digital.ai OKRs interface—including creates, updates, deletes, and user interactions—is automatically audited and accessible through these endpoints.

Authentication

The Audit Logs API uses the same authentication methods as other Digital.ai Agility APIs:

  • Access Tokens (Recommended): Use Bearer token authentication
  • Basic Authentication: Username and password
  • Windows Integrated Authentication: For domain-authenticated users

Setting Up Authentication

Include the appropriate authentication header with your requests:

Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

For detailed authentication setup, see API Authentication.

API Endpoints

Get Audit Logs

Retrieve a list of audit log entries with optional filtering and pagination.

GET /okr/audit_logs

Returns basic audit log information including actions, timestamps, and user IDs.

Query Parameters

ParameterTypeDescriptionRequired
startintegerOffset of the first fetched itemNo
countintegerMaximum number of fetched items (default: 20, max: 100)No
sortstringSort ordering (default: "id")No
user_idsarray<string>Filter by specific user IDsNo
target_entity_idstringFilter by target entity ID (e.g., specific objective or key result)No
target_entity_typestringFilter by entity type (Session, Objective, KeyResult, etc.)No
base_entity_idstringFilter by base entity ID (parent entity)No
idstringFilter by specific audit log IDNo

Example Request

GET /okr/audit_logs?start=0&count=100&sort=id
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Get Audit Logs with Details

Retrieve audit logs with comprehensive details and enhanced information.

GET /okr/audit_logs/view

This endpoint provides the same filtering capabilities as the basic endpoint but includes detailed information for all entities and changes.

Query Parameters

Same parameters as GET /okr/audit_logs, with identical filtering capabilities.

Example Request

GET /okr/audit_logs/view?target_entity_type=Session&count=50
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Get Single Audit Log

Retrieve detailed information for a specific audit log entry.

GET /okr/audit_logs/{id}

Path Parameters

ParameterTypeDescriptionRequired
idstringUnique audit log entry IDYes

Create Audit Log Entry

Create a new audit log entry (primarily for testing purposes).

POST /okr/audit_logs

Note: This endpoint is mainly used for testing and internal purposes. Most audit entries are created automatically by the system when users perform actions in the interface.

Response Format

Response Field Descriptions

Pagination Object

FieldTypeDescription
countintegerNumber of items returned in current response
next_startintegerStarting index for next page (null if no more pages)
previous_startintegerStarting index for previous page (null if on first page)
startintegerStarting index of current page
total_availableintegerTotal number of audit log entries available

Audit Log Entry Object

FieldTypeDescription
actionstringType of action performed (create, update, delete, login, etc.)
base_entity_idstringID of the parent entity (null for top-level entities)
changesarrayArray of field changes made during the action
created_dtstringTimestamp when the audit log entry was created (ISO 8601)
idstringUnique identifier for the audit log entry
target_entity_idstringID of the entity that was acted upon
target_entity_typestringType of entity (Session, Objective, KeyResult, User, etc.)
updated_dtstringTimestamp when the audit log entry was last updated (ISO 8601)
user_idstringID of the user who performed the action
userobjectDetailed user information (only in /view endpoint)

Changes Array Object

FieldTypeDescription
fieldstringName of the field that was changed
new_valuemixedNew value after the change (null for deletions)
old_valuemixedPrevious value before the change (null for creations)

User Object (in /view endpoint)

FieldTypeDescription
created_dtstringTimestamp when user account was created
emailstringUser's email address
external_keystringExternal identifier for the user
family_namestringUser's last name
given_namestringUser's first name
idstringUnique user identifier
namestringUser's full display name
updated_dtstringTimestamp when user account was last updated

Basic Audit Log Response Structure

{
"pagination": {
"count": 20,
"next_start": 20,
"previous_start": null,
"start": 0,
"total_available": 242
},
"results": [
{
"action": "create",
"changes": [
{
"field": "id",
"new_value": "68da5888724d737055984adf",
"old_value": null
},
{
"field": "begin",
"new_value": "Wed, 08 Oct 2025 00:00:00 GMT",
"old_value": null
},
{
"field": "end",
"new_value": "Tue, 28 Oct 2025 00:00:00 GMT",
"old_value": null
},
{
"field": "name",
"new_value": "testing for demo",
"old_value": null
}
],
"created_dt": "2025-10-17T14:25:16.597000",
"id": "68f251cc44b15057a5beb37e",
"target_entity_id": "68f251cc44b15057a5beb37e",
"target_entity_type": "Session",
"updated_dt": "2025-10-17T14:25:16.597000",
"user_id": "68da5871005b23c01bf21ccd"
}
]
}

Detailed Audit Log Response (with User Details)

{
"pagination": {
"count": 20,
"next_start": null,
"previous_start": null,
"start": 0,
"total_available": 1
},
"results": [
{
"action": "login",
"base_entity_id": null,
"changes": [],
"created_dt": "2025-10-22T11:36:56.421000",
"id": "68f8c1d89df32c35a039f7a0",
"target_entity_id": "68f8367f793810074a29b67e",
"target_entity_type": "user",
"updated_dt": "2025-10-22T11:36:56.421000",
"user": {
"created_dt": "2025-10-22T01:42:23.901000",
"email": "john.doe@company.com",
"external_key": "john.doe@company.com",
"family_name": "Doe",
"given_name": "John",
"id": "68f8367f793810074a29b67e",
"name": "John Doe",
"updated_dt": "2025-10-22T01:42:23.901000"
},
"user_id": "68f8367f793810074a29b67e"
}
]
}

Single Audit Log Entry Response

When requesting a specific audit log entry by ID, the response contains the individual audit log object without pagination wrapper:

{
"action": "update",
"changes": [
{
"field": "name",
"new_value": "testing for demo update",
"old_value": "testing for demo"
}
],
"created_dt": "2025-10-17T14:26:04.092000",
"id": "68f251fc44b15057a5beb37f",
"target_entity_id": "68f251cc44b15057a5beb37e",
"target_entity_type": "Session",
"updated_dt": "2025-10-17T14:26:04.092000",
"user_id": "68da5871005b23c01bf21ccd"
}

Common Use Cases

Track All Changes to a Specific Entity

Monitor all changes to a particular session, objective, or key result by using the target_entity_id:

GET /okr/audit_logs?target_entity_id=68f251cc44b15057a5beb37e&target_entity_type=Session

Monitor All Activities for an Entity Type

Track all changes across all objectives or sessions by specifying the target_entity_type:

GET /okr/audit_logs/view?target_entity_type=Objective&count=100

View Changes to Child Entities

Track all key result modifications under a specific objective using base_entity_id:

GET /okr/audit_logs?base_entity_id=68fdd97e1fd625dac9b3df&target_entity_type=KeyResult

This shows all key result changes where the base entity (parent objective) matches the specified ID.

User Activity Monitoring

Monitor specific user actions across the system:

GET /okr/audit_logs/view?user_ids=68da5871005b23c01bf21ccd&count=50

Compliance Reporting

Track all system activities over a date range by combining filters:

GET /okr/audit_logs/view?start=0&count=1000&sort=created_dt

System Integration

Integrate audit data with external monitoring or SIEM systems by regularly polling the endpoints and processing the JSON responses.

Understanding Entity Relationships

Target Entity vs Base Entity

  • Target Entity: The direct entity being audited (the object that was created, updated, or deleted)
  • Base Entity: The parent entity that contains the target entity

Entity Hierarchy Examples

Target Entity TypeBase Entity TypeDescription
SessionNoneSessions are top-level entities
ObjectiveSessionObjectives belong to sessions
KeyResultObjectiveKey results belong to objectives
CustomFieldVariousCustom fields can belong to different entity types

Supported Entity Types

Based on the demo, the following entity types are tracked:

  • Session: OKR planning sessions
  • Objective: Individual objectives within sessions
  • KeyResult: Key results associated with objectives
  • User: User accounts and authentication
  • CustomField: Custom field definitions
  • CustomFieldValue: Values for custom fields

Tracked Actions

The audit system captures various action types:

  • create: Entity creation
  • update: Entity modifications
  • delete: Entity removal
  • login: User authentication
  • archive: Session or objective archival

Error Handling

The API returns standard HTTP status codes:

  • 200 OK: Successful request
  • 400 Bad Request: Invalid parameters
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Audit log entry not found
  • 500 Internal Server Error: Server error

Performance Considerations

  • Use pagination (start and count parameters) for large result sets
  • Filter results using target_entity_type and target_entity_id to reduce response size
  • The /view endpoint includes more data but may be slower for large datasets
  • Maximum count per request is typically 100 items