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

Endpoint

GET/api_request_logs

Return Object

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

curl https://app.files.com/api/rest/v1/api_request_logs.json \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

[
  {
    "timestamp": "2000-01-01T01:00:00Z",
    "api_key_id": 1,
    "api_key_prefix": "example",
    "user_id": 1,
    "username": "example",
    "user_is_from_parent_site": false,
    "interface": "example",
    "request_method": "example",
    "request_path": "example",
    "request_ip": "example",
    "request_host": "example",
    "request_id": "example",
    "api_name": "example",
    "user_agent": "example",
    "error_type": "example",
    "error_message": "example",
    "response_code": 1,
    "success": true,
    "duration_ms": 1,
    "impersonator_user_id": 1,
    "created_at": "2000-01-01T01:00:00Z"
  }
]

The ApiRequestLog Object

Some of the endpoints 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

Example ApiRequestLog Object

{
  "timestamp": "2000-01-01T01:00:00Z",
  "api_key_id": 1,
  "api_key_prefix": "example",
  "user_id": 1,
  "username": "example",
  "user_is_from_parent_site": false,
  "interface": "example",
  "request_method": "example",
  "request_path": "example",
  "request_ip": "example",
  "request_host": "example",
  "request_id": "example",
  "api_name": "example",
  "user_agent": "example",
  "error_type": "example",
  "error_message": "example",
  "response_code": 1,
  "success": true,
  "duration_ms": 1,
  "impersonator_user_id": 1,
  "created_at": "2000-01-01T01:00:00Z"
}