import and require, and has no runtime dependencies. It needs Node 20 or later (we recommend 22 or 24), or any runtime with a global fetch, and TypeScript 5.0 or later if you use TypeScript.
The SDK is for server-side code. An API key in a browser is readable by anyone who loads the page, and the API doesn’t send the CORS headers a browser would need to call it directly.
Installing
Your first request
You’ll need an API key from Settings > API keys (see API keys). Then:Finding an endpoint
Endpoints are grouped into one class per API resource and version, all built from the sameConfiguration. The endpoint the API reference calls Incidents V2 › List is incidentsV2List on IncidentsV2Api, and Alert Routes V2 › Create is alertRoutesV2Create on AlertRoutesV2Api. Field and parameter names are the API’s own, in snake_case, so they match the reference exactly.
Each method takes one object holding the endpoint’s parameters. A request body goes under body:
...Raw variant that returns the Response alongside the parsed body.
Pagination
List endpoints are cursor-paginated. Read the next cursor frompagination_meta.after and pass it back until there isn’t one:
Filtering
List endpoints take filters as nested objects, keyed by operator:Errors
A response with a non-2xx status throws aResponseError. Its body is the API’s standard error format, and ErrorResponseFromJSON gives you a typed version of it:
request_id. A network failure throws a FetchError instead.
Configuration
AbortSignal in a request’s options, for example { signal: AbortSignal.timeout(10_000) } as the second argument to any method.
The client makes a single attempt per request and doesn’t retry. When you hit the rate limit, the API answers with a 429 and a Retry-After header in seconds. The simplest place to retry is a wrapper around fetch, passed as fetchApi in the configuration. The README has an example.
Enums and new values
Enum fields are typed as a union of their known values. We add enum values as a backwards-compatible change, and a value your version doesn’t know about comes through as the string the API sent rather than failing the response. So if youswitch over an enum, give it a default branch.
Deprecated endpoints
Endpoints we’ve deprecated stay available, but they’re marked@deprecated, so your editor strikes them through and linters can flag them. Don’t go by the version in the name: some v2 endpoints are deprecated too.
Versioning
The SDK is kept up to date with the API automatically. Additions to the API are minor versions. A change that would break your code, like a removed field, is released as a new major version, and its release notes list what changed.Resources
npm
The
@incident-io/sdk package and its versions.GitHub
Source, README, and issues for the TypeScript SDK.
API reference
Endpoints, authentication, rate limits, and errors.
All SDKs
Clients for Go, Python, Rust, Ruby, PHP, and .NET.