githubEdit

get__policy_alerts

GET /policy/alerts

Get Policy Alerts

Retrieve all policy alerts across your organization, with optional filtering by workspace, repository, policy, and date range. This endpoint provides comprehensive alert monitoring capabilities for AI policy enforcement.

Key Features:

  • Filter alerts by workspace, repository, or policy

  • Date range filtering for time-based analysis

  • Pagination support with configurable page size

  • Returns detailed alert information including user and API key details

  • Automatic organization-level access control

  • Workspace and repository access validation

Query Filtering:

  • workspaceId - Filter alerts by workspace (optional)

  • repoId - Filter alerts by repository (optional)

  • policyId - Filter alerts by specific policy (optional)

  • from - Start date for date range (ISO 8601 format, optional)

  • to - End date for date range (ISO 8601 format, optional)

  • llmType - Filter alerts by LLM type (comma-separated for multiple values, optional)

  • llmModel - Filter alerts by LLM model (comma-separated for multiple values, optional)

  • host - Filter alerts by host (comma-separated for multiple values, optional)

  • skip - Number of records to skip (for pagination, default: 0)

  • take - Number of records to return (default: 50, max: 100)

Important Notes:

  • Only returns alerts for policies within the user's organization

  • Organization admins can view all alerts across all workspaces

  • Regular users can only view alerts for workspaces they have access to

  • Alerts are sorted by timestamp in descending order (newest first)

  • Maximum take value is 100

  • If a user doesn't have access to a requested workspace/repo, an empty result is returned (not an error)

Use Cases:

  • Monitor all policy alerts across the organization

  • Track alert trends over time

  • Generate compliance reports

  • Investigate policy violations and alerts

  • Audit AI usage and policy enforcement

TypeScript Client Library

Code Samples

Parameters

Name
In
Type
Required
Description

workspaceId

query

string

false

Filter alerts by workspace ID

repoId

query

string

false

Filter alerts by repository ID

policyId

query

string

false

Filter alerts by policy ID

from

query

string

false

Start date for date range filter (ISO 8601)

to

query

string

false

End date for date range filter (ISO 8601)

llmType

query

string

false

Filter alerts by LLM type (comma-separated for multiple values)

llmModel

query

string

false

Filter alerts by LLM model (comma-separated for multiple values)

host

query

string

false

Filter alerts by host (comma-separated for multiple values)

take

query

integer

false

Number of records to return (default: 50, max: 100)

skip

query

integer

false

Number of records to skip (default: 0)

Example responses

200 Response

Responses

Status
Meaning
Description
Schema

200

Successfully retrieved alerts

Inline

400

Invalid request parameters

Inline

404

Repo not found (when repoId provided)

Inline

500

Failed to retrieve alerts

Inline

Response Schema

Status Code 200

Name
Type
Required
Restrictions
Description

» success

boolean

true

none

Operation success status

» alerts

[object]

true

none

Array of policy alert objects

»» id

string

true

none

Unique identifier for the alert

»» policyId

string

true

none

Policy ID that triggered the alert

»» policyName

string

true

none

Name of the policy that triggered the alert

»» timestamp

string

true

none

ISO 8601 timestamp when alert was triggered

»» message

string

true

none

Alert message describing what triggered the alert

»» conversationId

string

true

none

Conversation ID where alert occurred (null if not applicable)

»» repoId

string

true

none

Repository ID where alert occurred

»» repoName

string

true

none

Repository name where alert occurred

»» userId

string

true

none

User ID who triggered the alert

»» userName

string

true

none

Full name of the user who triggered the alert

»» repoAiApiKeyId

string

true

none

API key ID used in the operation

»» repoAiApiKeyName

string

true

none

API key name used in the operation

»» llmType

string

true

none

LLM provider type (e.g., "OPENAI", "ANTHROPIC", "GOOGLE", "AWS", "OTHER")

»» llmModel

string

true

none

LLM model name (e.g., "gpt-4", "claude-3")

»» host

string

true

none

Host/domain of the LLM API endpoint

» total

integer

true

none

Total number of alerts matching the query (for pagination)

» skip

integer

true

none

Number of records skipped

» take

integer

true

none

Number of records returned

Status Code 400

Name
Type
Required
Restrictions
Description

» success

boolean

true

none

Always false for error responses

» alerts

array

true

none

Empty array

» total

integer

true

none

Always 0

» skip

integer

true

none

Always 0

» take

integer

true

none

Always 0

Status Code 404

Name
Type
Required
Restrictions
Description

» success

boolean

true

none

Always false for error responses

» alerts

array

true

none

Empty array

» total

integer

true

none

Always 0

» skip

integer

true

none

Always 0

» take

integer

true

none

Always 0

» message

string

false

none

Error message (e.g., "Repo not found")

Status Code 500

Name
Type
Required
Restrictions
Description

» success

boolean

true

none

Always false for error responses

» alerts

array

true

none

Empty array

» total

integer

true

none

Always 0

» skip

integer

true

none

Always 0

» take

integer

true

none

Always 0

» message

string

false

none

Error message (e.g., "Failed to fetch policy alerts")

To perform this operation, you must be authenticated by means of one of the following methods: BearerAuth

Last updated

Was this helpful?