Audit Logging via API | Clarifai Docs
Track what was performed, who did it, and the results
Clarifai's Audit Logging feature helps you monitor platform activities for better visibility, security, and governance. It captures detailed logs of operations so you can know what was done, who did it, and the results.
With Audit Logging, you can assess the actions performed on users and their resources, track resource changes to identify potential security issues, and maintain comprehensive activity logs to meet regulatory requirements.
Supported Operations
The Audit Logging feature currently supports tracking the following critical resource operations ( we're planning to support more resources in the future):
- Organization and team membership activities — Includes creating, updating, or deleting organizations and teams, sending invitations, and managing team users and applications.
- Compute Orchestration – Cover creating, modifying, deleting clusters, nodepools, deployments
- Module activities — Tracks the creation, updating, and deletion of modules.
- Model activities — Tracks actions such as creating, training, publishing, and deleting models.
- Workflow activities — Covers the creation, publishing, updating, and deletion of workflows.
- Application activities — Includes creating, updating, duplicating, and deleting applications.
- Collaborator activities — Includes adding collaborators, editing their scopes, and removing them.
Here is a table that showcases the supported operations.
- Default
- Organization Memberships and Teams
- Compute Orchestration
- Modules
- Models
- Workflows
- Applications
- Collaborators
- Users
| Event Type |
Code |
Description |
EVENT_TYPE_NOT_SET |
0 |
Event type is not specified, lists all the supported audit log events |
| Event Type |
Code |
Description |
ORGANIZATION_MEMBER_ADD |
100 |
Organization members added |
ORGANIZATION_MEMBER_CHANGE |
101 |
Organization members' roles changed |
ORGANIZATION_MEMBER_REMOVE |
102 |
Organization members removed |
ORGANIZATION_MEMBER_INVITATION_CREATE |
103 |
Organization member invitations created |
ORGANIZATION_MEMBER_INVITATION_CANCEL |
104 |
Organization member invitations canceled |
ORGANIZATION_MEMBER_INVITATION_ACCEPT |
105 |
Organization member invitations accepted |
ORGANIZATION_MEMBER_INVITATION_DECLINE |
106 |
Organization member invitations declined |
ORGANIZATION_TEAM_CREATE |
107 |
Organization teams created |
ORGANIZATION_TEAM_UPDATE |
108 |
Organization teams updated |
ORGANIZATION_TEAM_DELETE |
109 |
Organization teams deleted |
ORGANIZATION_TEAM_MEMBER_ADD |
110 |
Organization team members added |
ORGANIZATION_TEAM_MEMBER_REMOVE |
111 |
Organization team members removed |
ORGANIZATION_TEAM_APP_ADD |
112 |
Organization team applications added |
ORGANIZATION_TEAM_APP_REMOVE |
113 |
Organization team applications removed |
| Event Type |
Code |
Description |
COMPUTE_CLUSTER_CREATE |
900 |
Compute clusters created |
COMPUTE_CLUSTER_DELETE |
901 |
Compute clusters deleted |
NODEPOOL_CREATE |
1000 |
Nodepools created |
NODEPOOL_UPDATE |
1001 |
Nodepools updated |
NODEPOOL_DELETE |
1002 |
Nodepool deleted |
DEPLOYMENT_CREATE |
1100 |
Deployments created |
DEPLOYMENT_UPDATE |
1101 |
Deployments updated |
DEPLOYMENT_DELETE |
1102 |
Deployments deleted |
| Event Type |
Code |
Description |
MODULE_CREATE |
200 |
Modules created |
MODULE_UPDATE |
201 |
Modules updated |
MODULE_DELETE |
202 |
Modules deleted |
MODULE_VERSION_CREATE |
203 |
Module versions created |
MODULE_VERSION_UPDATE |
204 |
Module versions updated |
MODULE_VERSION_DELETE |
205 |
Module versions deleted |
| Event Type |
Code |
Description |
MODEL_CREATE |
300 |
Models created |
MODEL_UPDATE |
301 |
Models updated |
MODEL_DELETE |
302 |
Models deleted |
MODEL_VERSION_CREATE |
303 |
Model versions created |
MODEL_VERSION_UPDATE |
304 |
Model versions updated |
MODEL_VERSION_DELETE |
305 |
Model versions deleted |
| Event Type |
Code |
Description |
WORKFLOW_CREATE |
400 |
Workflows created |
WORKFLOW_UPDATE |
401 |
Workflows updated |
WORKFLOW_DELETE |
402 |
Workflows deleted |
WORKFLOW_VERSION_CREATE |
403 |
Workflow versions created |
WORKFLOW_VERSION_UPDATE |
404 |
Workflow versions updated |
WORKFLOW_VERSION_DELETE |
405 |
Workflow versions deleted |
| Event Type |
Code |
Description |
APPLICATION_CREATE |
600 |
Applications created |
APPLICATION_UPDATE |
601 |
Applications updated |
APPLICATION_DELETE |
602 |
Applications deleted |
| Event Type |
Code |
Description |
COLLABORATOR_ADD |
700 |
Collaborators added |
COLLABORATOR_UPDATE |
701 |
Collaborators updated |
COLLABORATOR_REMOVE |
702 |
Collaborators removed |
| Event Type |
Code |
Description |
USER_UPDATE |
800 |
Users updated |
List Audit Log Events
Here is how you can list all the supported audit log events performed by a user on the Clarifai platform.
#########################################################################
# In this section, we set the user authentication and user ID.
# Change these strings to run your own example.
#########################################################################
# Your PAT (Personal Access Token) can be found in the Account's Security section
PAT = 'YOUR_PAT_HERE'
USER_ID = 'YOUR_USER_ID_HERE'
###########################################################################
# YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE TO RUN THIS EXAMPLE
###########################################################################
from clarifai_grpc.channel.clarifai_channel import ClarifaiChannel
from clarifai_grpc.grpc.api import resources_pb2, service_pb2, service_pb2_grpc
from clarifai_grpc.grpc.api.status import status_code_pb2
channel = ClarifaiChannel.get_grpc_channel()
stub = service_pb2_grpc.V2Stub(channel)
metadata = (('authorization', 'Key ' + PAT),)
userDataObject = resources_pb2.UserAppIDSet(user_id=USER_ID)
post_audit_log_searches = stub.PostAuditLogSearches(
service_pb2.PostAuditLogSearchesRequest(
user_app_id=userDataObject # The userDataObject is created in the overview and is required when using a PAT
),
metadata=metadata
)
if post_audit_log_searches.status.code != status_code_pb2.SUCCESS:
print(post_audit_log_searches.status)
raise Exception("Post audit log searches failed, status: " + post_audit_log_searches.status.description)
print(post_audit_log_searches)
<!-- index.html file -->
<script>
///////////////////////////////////////////////////////////////////////////////////
// In this section, we set the user authentication and user ID.
// Change these strings to run your own example.
//////////////////////////////////////////////////////////////////////////////////
// Your PAT (Personal Access Token) can be found in the Account's Security section
const PAT = 'YOUR_PAT_HERE';
const USER_ID = 'YOUR_USER_ID_HERE';
//////////////////////////////////////////////////////////////////////////////////
// YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE TO RUN THIS EXAMPLE
/////////////////////////////////////////////////////////////////////////////////
const raw = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: {
'Accept': 'application/json',
'Authorization': 'Key ' + PAT
},
body: raw
};
fetch(`https://api.clarifai.com/v2/users/${USER_ID}/audit_log/searches`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
</script>
// index.js file
////////////////////////////////////////////////////////////////////////////////////
// In this section, we set the user authentication and user ID.
// Change these strings to run your own example.
////////////////////////////////////////////////////////////////////////////////////
// Your PAT (Personal Access Token) can be found in the Account's Security section
const PAT = 'YOUR_PAT_HERE';
const USER_ID = 'YOUR_USER_ID_HERE';
///////////////////////////////////////////////////////////////////////////////////
// YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE TO RUN THIS EXAMPLE
///////////////////////////////////////////////////////////////////////////////////
const { ClarifaiStub, grpc } = require("clarifai-nodejs-grpc");
const stub = ClarifaiStub.grpc();
// This will be used by every Clarifai endpoint call
const metadata = new grpc.Metadata();
metadata.set("authorization", "Key " + PAT);
stub.PostAuditLogSearches(
{
user_app_id: {
user_id: USER_ID,
},
},
metadata,
(err, response) => {
if (err) {
throw new Error(err);
}
if (response.status.code !== 10000) {
console.log(response.status);
throw new Error(
"Post audit log searches failed, status: " + response.status.description
);
}
console.log(response);
}
);
Filter Searches
You can optionally refine your searches to retrieve only the operations of interest. This enables targeted audit trails for the activities performed on the Clarifai platform.