---
title: "Tenant Audit"
method: GET
path: "/tenant/audit"
tags: ["tenant"]
---

# Tenant Audit

`GET /tenant/audit`

## Request

- Base URL: `https://api.agent4.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agent4.io/tenant/audit`
- Auth: none declared

本租户的操作轨迹，按时间倒序。

记录由 ORM 层自动产生（app/audit_trail.py），所以经 REST、MCP、控制台、脚本做的改动
都在这里，不取决于哪个端点记得埋点。

**两种翻页方式，各有各的用处**：`offset` + `total` 支持跳页（控制台的表格用这个——要看
三周前的记录，一次次"加载更多"是走不到的）；`cursor` 是稳定游标，适合从头到尾拉一遍
（中途有新记录写入也不会重复或漏掉，脚本导出用这个）。传了 cursor 就走游标模式。

## Query parameters

- `action` string, nullable
- `entity` string, nullable
- `q` string, nullable
- `changes_only` boolean
- `date_from` string, nullable
- `date_to` string, nullable
- `limit` integer
- `offset` integer
- `cursor` string, nullable

## Response `200`

Successful Response

- TenantAuditPage
  - `items` TenantAuditOut[], required
    - `id` string, required
    - `created_at` string, date-time, required
    - `action` string, required
    - `entity` string, nullable
    - `entity_id` string, nullable
    - `target` string, nullable
    - `actor_type` string, required
    - `actor_label` string, nullable
    - `via` string, nullable
    - `request_id` string, nullable
    - `before` object, nullable
    - `after` object, nullable
    - `meta` object, nullable
  - `next_cursor` string, nullable
  - `total` integer, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/agent4/apis/chatagent-platform.md) · [All operations](https://skmtc.dev/agent4/apis/chatagent-platform/llms.txt) · [OpenAPI document](https://skmtc.dev/agent4/apis/chatagent-platform/revisions/18e58f082ce3?raw)
