PgBeam Docs
Agents

ExportAuditLogs

Export agent audit logs as CSV

Streams the project's agent audit entries as a CSV file, newest first, honoring the same credential, event, decision, source and date-range filters as the list endpoint. The full filtered set is streamed (no pagination); the result is suitable for spreadsheets, SIEM ingestion, and compliance archives.

Usage

result, err := client.Agents.ExportAuditLogs(ctx, "prj_xxx", nil)

Parameters

ParameterTypeRequiredDescription
ctxcontext.ContextYesRequest context
projectIDstringYesUnique project identifier (prefixed, e.g. prj_xxx).
params*pgbeam.ExportAuditLogsParamsNoQuery parameters
params.CredentialIDstringNoFilter to a single agent credential.
params.EventstringNoFilter to a single event type (e.g. blocked, masked, query).
params.Decisionpgbeam.AuditDecisionNoCoarse outcome filter that groups events. allow = query; block = blocked, budget_exhausted, auth_failed, credential_expired; mask = masked; truncate = truncated.
params.Sourcepgbeam.AuditSourceNoFilter by statement origin (wire, mcp, or control).
params.StartstringNoReturn entries at or after this timestamp (inclusive lower bound).
params.EndstringNoReturn entries strictly older than this timestamp (cursor / upper bound).

Response

(*pgbeam.unknown, error) — the result.

Example

import pgbeam "go.pgbeam.com/sdk"

client := pgbeam.NewClient(&pgbeam.ClientOptions{
  APIKey: "pgb_your_api_key",
})

result, err := client.Agents.ExportAuditLogs(ctx, "prj_xxx", &pgbeam.ExportAuditLogsParams{
    CredentialID: "...",
    Event: "blocked",
    Decision: "...",
    Source: "...",
  })
if err != nil {
  log.Fatal(err)
}
fmt.Println(result)

Errors

StatusDescription
400Invalid request parameters.
401Missing or invalid authentication.
403Operation not allowed by current plan limits.
404Resource not found.
429Rate limited. Try again later.

On this page