Skip to main content
The Go SDK gives you a typed client for the whole incident.io API. There’s a method for every endpoint and a Go type for every request and response, all generated from our OpenAPI specification, so it keeps up with the API without you having to write any of the plumbing yourself. It requires Go 1.24 or later.

Installing

Your first request

You’ll need an API key from Settings > API keys (see API keys). Then create a client and make a call:

How responses work

Every endpoint has a ...WithResponse method that returns a typed response. Rather than returning an error for a non-2xx status, the response carries a field per documented status code: JSON200 for a successful list, JSON404 for a not-found, and so on. If JSON200 is nil, the API returned something other than a success, and resp.StatusCode() and resp.Body tell you what. The err return is for failures that never got a response, like a network error or a cancelled context.

Configuration

New takes functional options, so you only set what you need:

Retries

By default the client makes a single attempt per request. WithRetries() turns on exponential backoff for network errors, 429s, and 5xxs, and it honours the Retry-After header the API sends when you hit the rate limit. WithRetries(n) caps the number of retries (the default is 4). One thing to watch out for: WithRetries works by installing its own HTTP client, so combining it with WithHTTPClient doesn’t do what you’d expect. Whichever option comes last wins.

Deprecated endpoints

Endpoints we’ve deprecated stay available, but they’re marked with // Deprecated:, so your editor and staticcheck will flag any calls to 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, with each update released as a new minor version. Go handles major versions differently from other languages: a new major version of a Go module has a different import path (github.com/incident-io/sdk-go/v2), and every caller has to change their imports to upgrade. To avoid that, the Go SDK only releases minor versions, which means a change that only affects Go names, like a field being removed from a response, can arrive in a minor release. If you depend on a field, check the API changelog when upgrading.

Resources

Package reference

Every type and method on pkg.go.dev.

GitHub

Source, README, and issues for the Go SDK.

API reference

Endpoints, authentication, rate limits, and errors.

All SDKs

Clients for TypeScript, Python, Rust, Ruby, PHP, and .NET.