Skip to content

Alert API Reference

Complete API reference for the Alert resource in the beeps SDK.

List all alerts in your organization.

Returns: Promise<Alert[]>

Example:

const alerts = await client.alert.list();

List all active (unresolved) alerts.

Returns: Promise<Alert[]>

Example:

const activeAlerts = await client.alert.listActive();

List all resolved alerts.

Returns: Promise<Alert[]>

Example:

const resolvedAlerts = await client.alert.listResolved();

Get a specific alert by ID.

Parameters:

  • alertId: string

Returns: Promise<Alert>

Example:

const alert = await client.alert.get("alr_abc123");

Signal that a user is responding to an alert. Creates a responder record. If userId is not provided, the authenticated user is used.

Parameters:

  • alertId: string
  • input?: OnItInput

Returns: Promise<AlertResponder>

Example:

const responder = await client.alert.onIt("alr_abc123", {
userId: "usr_alice",
});
// Or as the authenticated user
const responder = await client.alert.onIt("alr_abc123");

List all responders for an alert.

Parameters:

  • alertId: string

Returns: Promise<AlertResponder[]>

Example:

const responders = await client.alert.listResponders("alr_abc123");

List agent jobs associated with an alert.

Parameters:

  • alertId: string

Returns: Promise<AgentJob[]>

Example:

const jobs = await client.alert.listAgents("alr_abc123");

Get a foreground fix context bundle for an alert, including responders, agent jobs, and suggested next actions.

Parameters:

  • alertId: string

Returns: Promise<AlertFixContext>

Example:

const fixContext = await client.alert.getFixContext("alr_abc123");
console.log(fixContext.nextActions);

client.alert.updateResponderStatus(alertId, responderId, input)

Section titled “client.alert.updateResponderStatus(alertId, responderId, input)”

Update a responder’s status to done or dropped. Optionally attach a PR URL.

Parameters:

  • alertId: string
  • responderId: string
  • input: UpdateResponderStatusInput

Returns: Promise<AlertResponder>

Example:

const updated = await client.alert.updateResponderStatus(
"alr_abc123",
"rsp_def456",
{ status: "done", prUrl: "https://github.com/org/repo/pull/42" },
);

Mark an alert as resolved.

Parameters:

  • alertId: string

Returns: Promise<Alert>

Example:

const alert = await client.alert.resolve("alr_abc123");

Assign an alert to a user.

Parameters:

  • alertId: string
  • userId: string

Returns: Promise<Alert>

Example:

const alert = await client.alert.assign("alr_abc123", "usr_bob");

All methods have corresponding *Safe variants that return Result<T> instead of throwing:

  • client.alert.listSafe()
  • client.alert.listActiveSafe()
  • client.alert.listResolvedSafe()
  • client.alert.getSafe(alertId)
  • client.alert.onItSafe(alertId, input?)
  • client.alert.listRespondersSafe(alertId)
  • client.alert.listAgentsSafe(alertId)
  • client.alert.getFixContextSafe(alertId)
  • client.alert.updateResponderStatusSafe(alertId, responderId, input)
  • client.alert.resolveSafe(alertId)
  • client.alert.assignSafe(alertId, userId)

Example:

const result = await client.alert.onItSafe("alr_abc123", {
userId: "usr_alice",
});
if (result.error) {
console.error(result.error.message);
} else {
console.log(`Responder joined: ${result.data.id}`);
}
type AlertSeverity = "critical" | "high" | "medium" | "low" | "info";
type Alert = {
id: string;
organizationId: string;
webhookId: string;
title: string;
message: string | null;
severity: AlertSeverity;
source: string;
externalId: string | null;
metadata: Record<string, unknown> | null;
assignedToUserId: string | null;
resolvedAt: string | null;
resolvedBy: ResolutionSource | null;
resolvedByUserId: string | null;
resolvedByProvider: string | null;
createdAt: string;
updatedAt: string;
};
type ResolutionSource = "user" | "monitoring_system";
type AlertResponder = {
id: string;
alertId: string;
organizationId: string;
responderType: ResponderType;
userId: string | null;
integrationId: string | null;
agentSessionId: string | null;
status: ResponderStatus;
prUrl: string | null;
joinedAt: string;
completedAt: string | null;
};
type ResponderType = "user" | "agent";
type ResponderStatus = "on_it" | "done" | "dropped";
type OnItInput = {
userId?: string;
};
type UpdateResponderStatusInput = {
status: "done" | "dropped";
prUrl?: string;
};
GET /v0/alerts
GET /v0/alerts/active
GET /v0/alerts/resolved
GET /v0/alerts/:alertId
POST /v0/alerts/:alertId/on-it

Request Body:

{
"userId": "usr_alice"
}
GET /v0/alerts/:alertId/responders
GET /v0/alerts/:alertId/agents
GET /v0/alerts/:alertId/fix-context
PATCH /v0/alerts/:alertId/responders/:responderId

Request Body:

{
"status": "done",
"prUrl": "https://github.com/org/repo/pull/42"
}
POST /v0/alerts/:alertId/resolve
POST /v0/alerts/:alertId/assign

Request Body:

{
"userId": "usr_bob"
}

All API requests require authentication using your API key:

Terminal window
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.beeps.dev/v0/alerts