API Request Logs

An ApiRequestLog is an audit log for monitoring and troubleshooting requests made via API to your site.

Logs available through this endpoint are retained for 6 months, after which they are automatically discarded. For longer retention, use Files.com SIEM integrations to stream logs in real time to your preferred SIEM, or configure SIEM streaming to a file.

List API Request Logs

SDK Function

ApiRequestLog.list()

Return Object

ListIterator<ApiRequestLog>

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

import com.files.ListIterator;
import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.ApiRequestLog;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  ListIterator<ApiRequestLog> apiRequestLogs = ApiRequestLog.list(parameters);
  for (ApiRequestLog apiRequestLog : apiRequestLogs.listAutoPaging()) {
    // Operate on apiRequestLog
  }
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

The ApiRequestLog Object

Some of the functions above return a ApiRequestLog object. The attributes of this object are listed below.

AttributeDescription
timestamp
date-time
Start Time of Action. Deprecrated: Use created_at.
api_key_id
int64
API Key ID, if applicable
api_key_prefix
string
API Key Prefix, if applicable
user_id
int64
User ID
username
string
Username
user_is_from_parent_site
boolean
true if this change was performed by a user on a parent site.
interface
string
API Interface
request_method
string
HTTP Method
request_path
string
Request path
request_ip
string
IP of requesting client
request_host
string
Hostname the request was sent to
request_id
string
Unique Id of the Request
api_name
string
Name of API Endpoint
user_agent
string
User-Agent
error_type
string
Error type, if applicable
error_message
string
Error message, if applicable
response_code
int64
HTTP Response Code
success
boolean
false if HTTP Response Code is 4xx or 5xx
duration_ms
int64
Duration (in milliseconds)
impersonator_user_id
int64
User ID of Site Admin user impersonating this user via a Read-Only session.
created_at
date-time
Start Time of Action