Agents
listAuditLogs
List agent audit logs
Returns agent statement audit entries for the project, newest first, with optional credential, event, decision, source and date-range filters.
Usage
const result = await api.agents.listAuditLogs({
pathParams: { project_id: "prj_xxx" },
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| pathParams.project_id | string | Yes | Unique project identifier (prefixed, e.g. prj_xxx). |
| queryParams.credential_id | string | No | Filter to a single agent credential. |
| queryParams.event | string | No | Filter to a single event type (e.g. blocked, masked, query). |
| queryParams.decision | AuditDecision | No | Coarse outcome filter that groups events. allow = query; block = blocked, budget_exhausted, auth_failed, credential_expired; mask = masked; truncate = truncated. |
| queryParams.source | AuditSource | No | Filter by statement origin (wire, mcp, or control). |
| queryParams.start | string | No | Return entries at or after this timestamp (inclusive lower bound). |
| queryParams.end | string | No | Return entries strictly older than this timestamp (cursor / upper bound). |
| queryParams.before | string | No | Return entries strictly older than this timestamp (keyset pagination cursor). |
| queryParams.page_size | number | No | Maximum number of items to return (1-100, default 20). |
Response
Promise<ListAuditLogsResponse> — page of audit entries.
Example
import { PgBeamClient } from "pgbeam";
const client = new PgBeamClient({
token: "pbk_...",
baseUrl: "https://api.pgbeam.com",
});
const result = await client.api.agents.listAuditLogs({
pathParams: { project_id: "prj_xxx" },
queryParams: {
credential_id: "...",
event: "blocked",
decision: "...",
source: "...",
start: "...",
end: "...",
before: "...",
page_size: 20,
},
});Errors
| Status | Description |
|---|---|
| 400 | Invalid request parameters. |
| 401 | Missing or invalid authentication. |
| 403 | Operation not allowed by current plan limits. |
| 404 | Resource not found. |
| 429 | Rate limited. Try again later. |