Getting Started with the AlertOps .NET SDK
Add the AlertOps.Sdk NuGet package, set ALERTOPS_API_KEY and create a new AlertOpsClient(); every AlertOps endpoint is then an async method such as ao.Groups.ListAsync().
Overview
Relevant for .NET developers automating AlertOps
The AlertOps .NET SDK (AlertOps.Sdk) brings the whole AlertOps API to C# and .NET in one client. Each endpoint is an async method on a resource, such as ao.Groups.ListAsync() or ao.EscalationPolicies.CreateAsync(...), and results are System.Text.Json nodes. Teams use it to onboard responders automatically, send alerts from their own services and publish status updates straight from their deployment pipelines. It fits naturally into ASP.NET apps, worker services and console tools alike.
Key benefits:
- Complete — every AlertOps endpoint is available as a method.
- Idiomatic .NET — async/await with a CancellationToken on every call, and an injectable HttpClient.
- Modern runtime — targets .NET 8.
- Helpers included — find-or-create, alert ingestion and the semantic layer for planning on-call setups.
Install the SDK
Relevant for Developers setting up a project
dotnet add package AlertOps.Sdk
using AlertOps;
Set your API key
Relevant for Developers connecting to an AlertOps account
Create an API key in AlertOps, then make it available to the SDK in one of three ways:
| Option | How |
| Environment variable | ALERTOPS_API_KEY=<your key> |
| .env file | new AlertOpsClient(new AlertOpsOptions { Dotenv = ".env" }) reads ALERTOPS_API_KEY from the file |
| Client option | new AlertOpsClient(new AlertOpsOptions { ApiKey = key }) |
Keep the key on servers, in scripts and in CI secrets.
Make your first calls
Relevant for Developers checking that the connection works
using AlertOps;
using var ao = new AlertOpsClient();
Console.WriteLine(await ao.Account.TimeZoneAsync()); // your account's time zone
var (group, _) = await ao.Groups.EnsureAsync("Network Ops"); // find or create a group
await ao.Groups.Members.AddUsersAsync(group!["group_id"]!, new object?[] { 7, 8 });
Paginated endpoints also have …AllAsync() to collect every page and …IterAsync() for an IAsyncEnumerable, for example ao.Groups.ListAllAsync().
Common tasks
Relevant for Developers looking for the right method
| Task | Method |
| Find or create a group | ao.Groups.EnsureAsync |
| Create an on-call shift | ao.Schedules.CreateShiftAsync |
| Create an API integration | ao.Inbound.CreateApiAsync |
| Send an alert | ao.Ingest.PostToIntegrationAsync |
| List recent alerts | ao.Alerts.ListRecentAsync |
| Post a status page incident | ao.StatusHub.Incidents.CreateAsync |
Every other AlertOps feature follows the same pattern, one resource per area of the app.
What you can build
Relevant for Teams planning their first automation
| Goal | Where to start |
| Keep on-call teams in sync with your HR or identity system | Users, groups and schedules |
| Send alerts from your own services | Inbound integrations and alert ingestion |
| Roll out a complete on-call setup from a short description | The semantic layer |
| Publish incidents to customers | Status Hub pages and incidents |
Next steps
Relevant for Developers building their first automation
- Follow the guides for each area: people and schedules, escalation, alert sources, alerts, workflows, status pages and administration. Each guide shows C# alongside the other SDKs.
- The full developer documentation, with every method, ships with the library: github.com/alertops/alertops-dotnet.
Related Articles
- AlertOps SDKs for Python, TypeScript, Go, Java and .NET
- Users, Groups and On-Call Schedules with the AlertOps SDKs
- Inbound Integrations, Alert Ingestion and Heartbeats with the AlertOps SDKs
- Planning On-Call Setups with the AlertOps Semantic Layer
Need help?
Email support@alertops.com or contact your AlertOps representative.