API7 Docs
API7 GatewayAPI7 Enterprise Admin APIsList all audit logs

List all audit logs

GET /api/audit_logs

GET /api/audit_logs

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Query Parameters

event_type?string

The event type. Event types can be looked up using the /api/audit_logs/event_types endpoint.

operator_id?string

The user ID of the operator.

gateway_group_id?string

Gateway group ID.

Length1 <= length
resource_id?string

The resource ID.

start_at?integer

Start at timestamp to filter the audit logs.

end_at?integer

End at timestamp to filter the audit logs.

order_by?"event_time"

Index to order audit logs by.

Default"event_time"

Value in

  • "event_time"
direction?string

Order to list the resources by. The sorting index follows the configuration of order_by.

Default"desc"

Value in

  • "asc"
  • "desc"
page_size?integer

Number of resources listed per page. Used together with page. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.

Formatint32
Range1 <= value
page?integer

Page number of the listed resources. Used together with page_size. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.

Formatint32
Range1 <= value

Response Body

application/json

curl -X GET "$API_BASE_URL/api/audit_logs?event_type=AddConsumerCredential"

Successfully retrieved the paginated list of audit log entries.

{
  "total": 1,
  "list": [
    {
      "event_time": 1742288230,
      "operator_id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
      "operator": {
        "id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
        "username": "admin",
        "name": "admin",
        "email": "test@email.com",
        "email_verified": true
      },
      "gateway_group_id": "bc1b95c9-b348-4832-acc3-e257d2342df1",
      "source": "dashboard",
      "token_name": "docs",
      "event_type": "string",
      "resource_id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
      "ip_address": "10.15.101.5",
      "error_message": "Duplicate key in test2's credentials",
      "http_request": {
        "method": "POST",
        "uri": "/apisix/admin/consumers/test2/credentials?gateway_group_id=default",
        "body": {
          "name": "test",
          "plugins": {
            "key-auth": {
              "key": "********"
            }
          }
        },
        "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
      },
      "http_response": {
        "status_code": 400,
        "body": {}
      }
    }
  ]
}
Complete operation details and schema variants

GET /api/audit_logs

List all audit logs

Retrieve immutable audit log records for administrative and configuration actions, including who performed each action and when. Use filters such as event type, operator, resource, gateway group, and time range to narrow the result set.

Required IAM Permission: Action iam:GetAudit, Resource arn:api7:iam:organization/*

Parameters

  • event_type (query, string, optional): The event type. Event types can be looked up using the /api/audit_logs/event_types endpoint.
  • operator_id (query, string, optional): The user ID of the operator.
  • gateway_group_id (query, string, optional): Gateway group ID.
  • resource_id (query, string, optional): The resource ID.
  • start_at (query, integer, optional): Start at timestamp to filter the audit logs.
  • end_at (query, integer, optional): End at timestamp to filter the audit logs.
  • order_by (query, string, optional):
  • direction (query, string, optional): Order to list the resources by. The sorting index follows the configuration of order_by.
  • page_size (query, integer, optional): Number of resources listed per page. Used together with page. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.
  • page (query, integer, optional): Page number of the listed resources. Used together with page_size. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.

Responses

  • 200: Successfully retrieved the paginated list of audit log entries.
  • allOf variant 1
  • list (array, optional): An array of resources.
  • total (integer, optional): Total number of objects.
  • allOf variant 2
  • list (array, optional): An array of audit logs.
  • list[].event_time (integer, optional): The object timestamp.
  • list[].operator_id (string, optional): The object ID.
  • list[].operator (object, optional): Operator details.
  • list[].operator.id (string, optional): Operator ID.
  • list[].operator.username (string, optional): Operator username.
  • list[].operator.name (string, optional): Operator name.
  • list[].operator.email (string, optional): Operator email.
  • list[].operator.email_verified (boolean, optional): If true, the operator email is verified.
  • list[].gateway_group_id (string, optional): The gateway group ID.
  • list[].source (string, optional): Source of the alert log.
  • list[].token_name (string, optional): The name of the token used for authentication.
  • list[].event_type (string, optional): The event type.
  • list[].resource_id (string, optional): The resource ID.
  • list[].ip_address (string, optional): The IP address.
  • list[].error_message (string, optional): The error message.
  • list[].http_request (object, optional): HTTP request details.
  • list[].http_request.method (string, optional): HTTP request method.
  • list[].http_request.uri (string, optional): HTTP request URI path.
  • list[].http_request.body (object, optional): HTTP request body.
  • list[].http_request.user_agent (string, optional): HTTP request user agent.
  • list[].http_response (object, optional): HTTP response details.
  • list[].http_response.status_code (integer, optional): HTTP response status code.
  • list[].http_response.body (object, optional): HTTP response body.

cURL

curl -X GET '$API_BASE_URL/api/audit_logs'