get__policy_{policyId}_alerts
GET /policy/{policyId}/alerts
Get Policy Alerts by Policy ID
Retrieve all alerts for a specific policy. This endpoint is a convenience method that filters alerts by policy ID, making it easier to analyze alerts for a particular policy.
Key Features:
Automatically filters alerts by the specified policy ID
Same filtering and pagination options as the general alerts endpoint
Workspace and repository filtering still available
Date range filtering supported
Returns detailed alert information
Query Filtering:
workspaceId- Filter alerts by workspace (optional)repoId- Filter alerts by repository (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:
The
policyIdis provided in the URL path, not as a query parameterOnly returns alerts for the specified policy
User must have access to the policy to view its alerts
Alerts are sorted by timestamp in descending order (newest first)
Maximum
takevalue is 100Organization boundaries are enforced - only alerts for policies in the user's organization are returned
Use Cases:
Analyze alerts for a specific policy
Monitor effectiveness of a particular policy
Generate compliance reports for individual policies
Track alert trends for a specific policy over time
Investigate policy-specific issues
TypeScript Client Library
Code Samples
Parameters
policyId
path
string
true
Unique identifier of the policy
workspaceId
query
string
false
Filter alerts by workspace ID
repoId
query
string
false
Filter alerts by repository 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
Response Schema
Status Code 200
» 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
» 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
» 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
» 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?