milmilmilmil
API 参考

Audit

Audit log of write actions and undo support

GET
/api/v1/audit

Returns the caller's audit entries (newest first). Use action to filter to one action type and since to limit to entries on/after an RFC3339 timestamp.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Query Parameters

action?string

Exact action_type filter (e.g. match.apply, download.add)

since?string

Only entries created at or after this RFC3339 timestamp

Formatdate-time
limit?integer

Page size (1-200, default 50)

Range1 <= value <= 200
Default50
offset?integer

Zero-based offset (default 0)

Range0 <= value
Default0

Response Body

application/json

curl -X GET "https://example.com/api/v1/audit"
{  "items": [    {      "id": "string",      "user_id": "string",      "token_id": "string",      "agent_label": "string",      "action_type": "string",      "target_type": "string",      "target_id": "string",      "before_json": "string",      "after_json": "string",      "confidence": 0.1,      "parent_id": "string",      "dry_run": 0,      "undone_at": "2019-08-24T14:15:22Z",      "undone_by": "string",      "created_at": "2019-08-24T14:15:22Z"    }  ],  "limit": 0,  "offset": 0}
POST
/api/v1/audit/undo

Reverses a single entry (when id is provided) or every entry created since the given timestamp. Set dry_run to preview without applying.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/audit/undo" \  -H "Content-Type: application/json" \  -d '{}'
{  "items": [    {      "audit_id": "string",      "status": "reversed",      "reason": "string"    }  ]}
GET
/api/v1/audit/{id}

Returns the entry and any child entries written by macro execution. 403 if the entry belongs to another user.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Path Parameters

id*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/audit/string"
{  "entry": {    "id": "string",    "user_id": "string",    "token_id": "string",    "agent_label": "string",    "action_type": "string",    "target_type": "string",    "target_id": "string",    "before_json": "string",    "after_json": "string",    "confidence": 0.1,    "parent_id": "string",    "dry_run": 0,    "undone_at": "2019-08-24T14:15:22Z",    "undone_by": "string",    "created_at": "2019-08-24T14:15:22Z"  },  "children": [    {      "id": "string",      "user_id": "string",      "token_id": "string",      "agent_label": "string",      "action_type": "string",      "target_type": "string",      "target_id": "string",      "before_json": "string",      "after_json": "string",      "confidence": 0.1,      "parent_id": "string",      "dry_run": 0,      "undone_at": "2019-08-24T14:15:22Z",      "undone_by": "string",      "created_at": "2019-08-24T14:15:22Z"    }  ]}