Administration, Account, Analytics and Lookups with the AlertOps SDKs
Manage AlertOps alert types, roles, topics and account settings, check plan usage and export analytics reports from code with the AlertOps SDKs.
Overview
Relevant for Admins and developers automating account-wide settings
Account-wide configuration — alert types, roles, topics and other admin objects, your plan and usage, the lookup lists behind the app's pickers, and analytics — is all available through the AlertOps SDKs. Script a consistent baseline for every account, and pull incident metrics into your own dashboards.
Key benefits:
- Repeatable setup — admin.alert_types.ensure and the find helpers let scripts run again without creating duplicates.
- Plan-aware automation — lookups.can_add tells you whether your plan has room for another user, group, policy or workflow.
- Ready-to-use metrics — analytics.dashboard_sections returns the dashboard as a map keyed by section, such as mean time to acknowledge.
Alert types and custom fields
Relevant for Admins defining alert templates
An alert type is a template of custom fields that integrations, workflows and escalation policies share. Find or create a type, add a field, then make it required:
Python
at, created = ao.admin.alert_types.ensure("Database Alert")
field = ao.admin.alert_types.fields.create(at["alert_type_id"], alert_field_name="Cluster",
data_type="ShortString", group_name="")
ao.admin.alert_types.fields.modify(at["alert_type_id"], field["alert_field_id"], required=True)
TypeScript
const [at, created] = await ao.admin.alertTypes.ensure("Database Alert");
const field = await ao.admin.alertTypes.fields.create(at.alert_type_id, {
alert_field_name: "Cluster", data_type: "ShortString", group_name: "",
});
await ao.admin.alertTypes.fields.modify(at.alert_type_id, field.alert_field_id, { required: true });
Go
at, created, err := ao.Admin.AlertTypes.Ensure(ctx, "Database Alert")
if err != nil {
return err
}
atID := alertops.Get(at, "alert_type_id")
field, err := ao.Admin.AlertTypes.Fields.Create(ctx, atID, &alertops.Request{Fields: alertops.M{
"alert_field_name": "Cluster", "data_type": "ShortString", "group_name": "",
}})
if err != nil {
return err
}
_, err = ao.Admin.AlertTypes.Fields.Modify(ctx, atID, alertops.Get(field, "alert_field_id"), alertops.M{"required": true})
Java
Shared.Ensured at = ao.admin().alertTypes().ensure("Database Alert"); // at.record(), at.created()
JsonNode atId = at.record().get("alert_type_id");
JsonNode field = ao.admin().alertTypes().fields().create(atId, Request.of(
"alert_field_name", "Cluster", "data_type", "ShortString", "group_name", ""));
ao.admin().alertTypes().fields().modify(atId, field.get("alert_field_id"), Map.of("required", true));
.NET
var (at, created) = await ao.Admin.AlertTypes.EnsureAsync("Database Alert");
var atId = at!["alert_type_id"]!;
var field = await ao.Admin.AlertTypes.Fields.CreateAsync(atId, new Kwargs
{
["alert_field_name"] = "Cluster", ["data_type"] = "ShortString", ["group_name"] = "",
});
await ao.Admin.AlertTypes.Fields.ModifyAsync(atId, field!["alert_field_id"]!, new Kwargs { ["required"] = true });
Postmortem fields work the same way through admin.postmortem_fields.
Roles, topics and other admin objects
Relevant for Admins managing access and routing settings
| Object | What you can do | Operations |
| Custom roles | Create a role from entitlements and assign users | admin.roles.create, admin.roles.assign_users |
| Topics | Create topics with a priority and add groups | admin.topics.create, admin.topics.groups.add |
| User attributes | Define attributes such as a badge number, then set values per user | admin.user_attributes.create, users.attributes |
| Bridges | Save conference bridges for war rooms | admin.bridges.create |
| Audit trail | Read account activity between two dates | admin.audit_trail.between |
Account, plan and lookups
Relevant for Admins and developers reading account settings
| Task | Operation |
| Read account details, time zone and plan | account.summary, account.time_zone |
| See notification usage per channel | account.notification_usage |
| Update SSO settings | account.sso.modify |
| Fill pickers with users, groups, priorities and time zones | lookups |
| Check whether the plan allows one more user, group, policy or workflow | lookups.can_add |
| Convert an IANA zone to its AlertOps name | lookups.time_zone_name |
Analytics reports
Relevant for Analysts and developers exporting incident metrics
Pull AlertOps analytics into your own BI tools and team reviews.
| Task | Operation |
| Read the dashboard by section (MTTA, alert status and more) | analytics.dashboard_sections |
| Run any report, such as time to acknowledge or time to resolve | analytics.report |
| See who is on call right now | analytics.on_call.now |
Filter reports by date range, priority and group, for example the last week's High-priority alerts for the NOC group.
Add-ons and saved views
Relevant for Developers using AlertOps add-ons and the new UI
- Call routing — manage call-routing numbers, options and voice prompts with call_routing.
- AIOps — read and tune alert correlation profiles and run simulations on past alerts with aiops.
- Saved views — save, share and set default alert list views with user_filters.
Best Practices
Relevant for Teams scripting account configuration
- Use ensure and find helpers so setup scripts are safe to run again.
- Check plan room first with lookups.can_add before bulk-creating users or groups.
- Export metrics on a schedule to track MTTA and resolution time over time.
Related Articles
- AlertOps SDKs for Python, TypeScript, Go, Java and .NET
- Users, Groups and On-Call Schedules with the AlertOps SDKs
- Working with Alerts in the AlertOps SDKs
Need help?
Email support@alertops.com or contact your AlertOps representative.