Search Audits
Search audit logs for account activity. Use this endpoint to find and filter audit records by actor, action type, resource, and time period. Audit logs provide a comprehensive trail of all actions performed on your account.
Request Parametersโ
Required - 1 fieldRequired Parameters
`scope`STRING(required)
Data type to search. Must be set to "audit" for audit log searches.
Recommended - 2 fieldsRecommended Parameters
`query`STRING(optional)
Search query text for full-text search. Searches across audit descriptions, actor information, and resource identifiers.
`filters`OBJECT(optional)
Search filters to narrow results. Available filters include created date, actor email, actor type, auditable type, auditable UID, and verb.
Filter Options - 6 fieldsFilter Properties
`filters[created]`DATE-TIME(optional)
Filter by creation date. Supports date ranges using format: YYYY/MM/DD..YYYY/MM/DD
`filters[actor_email]`ARRAY(optional)
Filter by actor email addresses. Accepts an array of email strings to match against the user who performed the action.
`filters[actor_type]`STRING(optional)
Filter by actor type. Specifies the type of entity that performed the action.
`filters[auditable_type]`STRING(optional)
Filter by auditable resource type. Specifies the type of resource that was affected by the action.
`filters[auditable_uid]`STRING(optional)
Filter by the unique identifier of the audited resource.
`filters[verb]`STRING(optional)
Filter by action verb. Specifies the type of action that was performed.
Pagination - 2 fieldsPagination Parameters
Responsesโ
200
Successful searchReturns a search object containing paginated audit log results in the data array.
Response structure:
object- String value "search"data- Array of audit objects matching the querypage- Current page numberper_page- Records per pagetotal- Total records matching querytotal_pages- Total number of pagesfilters- Applied search filtersquery- Search query usedscope- Resource type searched (audit)location- API endpoint path
object- String value "audit"id- Unique audit log identifieractor_email- Email of the user who performed the actionactor_type- Type of actor (e.g., user)auditable_type- Type of resource affectedauditable_uid- Unique ID of the affected resourceverb- Action performedcreated_at- Timestamp of the action
400
Bad requestRequest validation failed. Check the error message for details.
Common causes:
- Missing required
scopeparameter - Invalid scope value (must be "audit")
- Malformed filters object
- Invalid date format in filters
- Invalid enum value for actor_type, auditable_type, or verb
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
- Incorrect HTTP Basic Auth format
403
ForbiddenAccess denied. Your account does not have permission to access audit logs.
Common causes:
- Insufficient account permissions
- Audit logs not enabled for your account
- API key does not have audit read permissions
5xx
Server errorServer-side error occurred. These are rare but should be handled gracefully.
How to handle:
- Retry the request with exponential backoff
- Check status.omise.co for service incidents
- See Error Handling for detailed guidance
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/audits/search \
-X GET \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "scope=audit" \
-d "filters[created]=2024/01/01..2024/12/31" \
-d "filters[actor_email][]=admin@example.com" \
-d "filters[verb]=rules_switched"
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
search = Omise::Search.execute(
'audit',
filters: {
created: '2024/01/01..2024/12/31',
actor_email: ['admin@example.com'],
verb: 'rules_switched'
}
)
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
search = omise.Search.execute(
'audit',
filters={
'created': '2024/01/01..2024/12/31',
'actor_email': ['admin@example.com'],
'verb': 'rules_switched'
}
)
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const search = await omise.search.list({
scope: 'audit',
filters: {
created: '2024/01/01..2024/12/31',
actor_email: ['admin@example.com'],
verb: 'rules_switched'
}
});
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$search = OmiseSearch::execute([
'scope' => 'audit',
'filters' => [
'created' => '2024/01/01..2024/12/31',
'actor_email' => ['admin@example.com'],
'verb' => 'rules_switched'
]
]);
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
SearchResult<Audit> search = client.search()
.scope(SearchScope.Audit)
.filter("created", "2024/01/01..2024/12/31")
.filter("actor_email", Arrays.asList("admin@example.com"))
.filter("verb", "rules_switched")
.send();
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var search = await client.Search.Execute(new SearchRequest
{
Scope = "audit",
Filters = new Dictionary<string, object>
{
{ "created", "2024/01/01..2024/12/31" },
{ "actor_email", new[] { "admin@example.com" } },
{ "verb", "rules_switched" }
}
});
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
search, _ := client.Search(&operations.SearchOptions{
Scope: "audit",
Filters: map[string]interface{}{
"created": "2024/01/01..2024/12/31",
"actor_email": []string{"admin@example.com"},
"verb": "rules_switched",
},
})
Error and result codesโ
Common Filter Patternsโ
| Filter Syntax | Description | Example |
|---|---|---|
filters[created]=date..date | Date range | 2024/01/01..2024/12/31 |
filters[actor_email][]=value | Email array | admin@example.com |
filters[verb]=value | Exact match | rules_switched |
filters[auditable_type]=value | Resource type | routing_group |
Available Filtersโ
| Filter | Type | Description |
|---|---|---|
created | date-time | Filter by action timestamp |
actor_email | array | Filter by user email(s) |
actor_type | string | Filter by actor type (user) |
auditable_type | string | Filter by resource type (routing_group) |
auditable_uid | string | Filter by resource identifier |
verb | string | Filter by action type (rules_switched) |
API Credentials
Try it outโ
Required - 1 fields
Recommended - 3 fields
Additional - 6 fields
Your IP:
...Loading...