checkly

package module
v2.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Checkly Go SDK

Tests Go Reference Go Report Card GitHub go.mod Go version GitHub tag (latest by date)

The Checkly Go SDK is a Go client for the Checkly public REST API. It manages checks and monitors, check groups, alert channels, dashboards, status pages, maintenance windows, environment variables, snippets, private locations and more. The Checkly Terraform provider is built on it.

Installation

go get github.com/checkly/checkly-go-sdk/v2
import "github.com/checkly/checkly-go-sdk/v2"

Getting Started

Most methods need an API key and the ID of the Checkly account it acts on, a UUID. You can create an API key in the Checkly web app.

Creating a client

NewClient builds a client, configured by options. WithAuthFromEnv reads the API key and account ID from the CHECKLY_API_KEY and CHECKLY_ACCOUNT_ID environment variables, the same ones the Checkly CLI and the Terraform provider use. NewClient fails if either is not set:

client, err := checkly.NewClient(checkly.WithAuthFromEnv())
if err != nil {
	log.Fatal(err)
}

WithAuth takes the credentials as arguments instead, and WithHTTPClient sets the HTTP client, for example to bound how long a single request may take. NewClient returns an error for an invalid option, such as an empty value or an account ID that is not a UUID:

client, err := checkly.NewClient(
	checkly.WithAuth(apiKey, accountID),
	checkly.WithHTTPClient(&http.Client{Timeout: 10 * time.Second}),
)
if err != nil {
	log.Fatal(err)
}

Without an auth option, only the public methods GetStaticIPs and GetRuntime work; every other method fails with checkly.ErrMissingAPIKey without sending a request.

Creating an API check

An API check sends an HTTP request every Frequency minutes from each of its locations and fails when an assertion does not hold. Set both response time limits: they are always sent, so leaving them at 0 sets a limit of 0 milliseconds.

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

check, err := client.CreateAPICheck(ctx, checkly.APICheck{
	Name:                   "Example API",
	Frequency:              10,
	Activated:              true,
	Locations:              []string{"eu-west-1", "us-east-1"},
	Tags:                   []string{"example"},
	DegradedResponseTime:   5000,
	MaxResponseTime:        20000,
	UseGlobalAlertSettings: true,
	Request: checkly.Request{
		Method:          http.MethodGet,
		URL:             "https://example.com/api/health",
		FollowRedirects: true,
		Headers: []checkly.KeyValue{
			{Key: "Accept", Value: "application/json"},
		},
		Assertions: []checkly.Assertion{
			{Source: checkly.AssertionSourceStatusCode, Comparison: checkly.AssertionComparisonEquals, Target: "200"},
			{Source: checkly.AssertionSourceResponseTime, Comparison: checkly.AssertionComparisonLessThan, Target: "2000"},
		},
	},
})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("created API check %q with ID %s\n", check.Name, check.ID)

Each check and monitor type has its own type and methods, such as GetAPICheck, UpdateAPICheck and DeleteAPICheck for API checks. GetCheck reads a check whose type is not known and returns a pointer to its type, and DeleteCheck deletes one.

Creating a URL monitor

A URL monitor requests a URL with GET and checks the response status, which is cheaper than an API check when that is all you need:

monitor, err := client.CreateURLMonitor(ctx, checkly.URLMonitor{
	Name:                   "Example homepage",
	Frequency:              5,
	Activated:              true,
	Locations:              []string{"eu-west-1", "us-east-1"},
	Tags:                   []string{"example"},
	DegradedResponseTime:   3000,
	MaxResponseTime:        10000,
	UseGlobalAlertSettings: true,
	Request: checkly.URLRequest{
		URL:             "https://example.com/",
		FollowRedirects: true,
		Assertions: []checkly.Assertion{
			{Source: checkly.AssertionSourceStatusCode, Comparison: checkly.AssertionComparisonEquals, Target: "200"},
		},
	},
})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("created URL monitor %q with ID %s\n", monitor.Name, monitor.ID)
Handling errors

When the API answers with a status a method does not accept, the method returns a *checkly.APIError. Its text names the request, the status and the backend's message, for example GET /v1/checks/abc: 404 Not Found. Match it with errors.Is and the sentinel errors such as checkly.ErrNotFound, checkly.ErrForbidden or checkly.ErrRateLimited, or inspect it with errors.As, rather than matching the text:

_, err := client.GetAPICheck(ctx, id)
if errors.Is(err, checkly.ErrNotFound) {
	// The check does not exist.
}
var apiErr *checkly.APIError
if errors.As(err, &apiErr) {
	log.Printf("Checkly API answered %d: %s", apiErr.StatusCode, apiErr.Message)
}

A request the API rejects as invalid matches checkly.ErrBadRequest. If it failed schema validation it also matches checkly.ErrValidation, and apiErr.Details lists the fields it names, if any.

Creating or updating a Slack App alert channel fails with a *checkly.SlackIntegrationNotConnectedError, matching checkly.ErrSlackIntegrationNotConnected, when the account has no connected Slack workspace, and with a *checkly.UnresolvableSlackDestinationsError, matching checkly.ErrUnresolvableSlackDestinations, when the workspace cannot resolve some of its #channels or @handles, which Destinations lists with the reason for each. Earlier versions of the API report only handles, with a *checkly.UnresolvableSlackHandlesError matching checkly.ErrUnresolvableSlackHandles, whose Handles lists them; handle both. Their texts leave out the request and the response: they say what is wrong and how to fix it. errors.As still finds the *checkly.APIError that each wraps.

Errors for requests that got no response wrap their cause, so errors.Is(err, context.DeadlineExceeded) works too. A request answered with HTTP 429 is retried a few times, waiting as the API asks while the context's deadline allows. A request that can safely be re-sent, such as a GET, PUT or DELETE, is also retried twice when it gets no response, for example because its connection was reset, unless the cause is one a retry would only repeat: a timeout, a DNS failure, a rejected certificate or a failure to connect. Errors returned by a custom transport or redirect policy passed to WithHTTPClient are retried too.

The SDK never adds the API key or the request body to an error. It does keep the backend's error message, and the start of an error body that is not JSON, cut at 500 bytes. A validation message can quote a submitted value, and so can the text of such a body, so take care when logging errors from requests that carry secrets.

Documentation

Questions

For questions and support, please open a discussion. The issue list of this repository is for bug reports and feature or documentation requests only.

Issues

Please choose the matching issue template when opening an issue. Issues that do not follow the templates may be closed.

Contributing

Please read the Contributing Guide before opening a pull request.

License

MIT

Documentation

Overview

Package checkly is a Go client for the Checkly public API.

NewClient builds a Client, configured by options:

client, err := checkly.NewClient(checkly.WithAuthFromEnv())
if err != nil {
	log.Fatal(err)
}
check, err := client.GetAPICheck(ctx, "a1b2c3d4-0000-4000-8000-000000000001")

WithAuthFromEnv reads the API key and account ID from CHECKLY_API_KEY and CHECKLY_ACCOUNT_ID; WithAuth takes them as arguments. A client without auth can only call the public endpoints, GetRuntime and GetStaticIPs.

Each check and monitor type has its own type and methods, such as APICheck with CreateAPICheck, GetAPICheck, UpdateAPICheck and DeleteAPICheck. For an ID whose check type is not known, Client.GetCheck returns a Check and Client.DeleteCheck deletes it.

Errors, cancellation and retries

A method returns an *APIError when the API answers with a status the method does not accept. It matches the sentinel errors, such as ErrNotFound and ErrRateLimited, with errors.Is; getting a resource by a well-formed but unknown ID, for example, fails with an error matching ErrNotFound.

Requests are sent with the context the method is given: when the context is cancelled or its deadline passes, the request and any wait before a retry are abandoned. A request answered with HTTP 429 is retried a few times, waiting as the API asks for up to a minute and while the context's deadline allows; UploadCodeBundle, which streams its body, is not retried. A GET, PUT or DELETE request that gets no response, for example because its connection was reset, is retried twice after short waits, also while the deadline allows, and so is PeekCodeBundle. A timeout, a DNS failure, a rejected certificate or a failure to connect is not retried, since a retry would only repeat it. Other POST requests are not retried, because a create may have happened even though its response was lost. The error of a request that was retried says how often: a re-sent DELETE, for example, gets a 404 if the first attempt succeeded.

Updates

An Update method stores every settable field of the value it is given, so zero values are applied. A field's comment says so when an update keeps the stored value for a nil, empty or zero field, when such a value means a default (on create, or also on update), or when it has another specific meaning. Fields nested in AlertSettings, in a group's APICheckDefaults, or in an alert channel's or status page component's configuration are replaced together with the object they are in, as is the request of a DNS monitor. To change some fields, start from the value a Get returns.

Creates and updates of checks, monitors and check groups ask the API not to subscribe alert channels automatically, so a resource written with an empty AlertChannelSubscriptions has no alert channel subscriptions.

Index

Examples

Constants

View Source
const DefaultBaseURL = "https://api.checklyhq.com"

DefaultBaseURL is the root of the Checkly public API, which a client uses unless WithBaseURL sets another.

Variables

View Source
var (
	// ErrBadRequest matches any 400 response.
	ErrBadRequest = errors.New("bad request")
	// ErrValidation matches a 400 response whose body has a validation block,
	// which the API sends when a request fails schema validation, such as a
	// missing field or a value of the wrong type. [APIError].Details lists
	// the fields it names, if any. Such an error also matches ErrBadRequest.
	// Most other rule failures, such as a date range that ends before it
	// starts, have no block, so they match only ErrBadRequest and only their
	// Message says what is wrong.
	ErrValidation = errors.New("validation failed")
	// ErrNotFound matches a 404 response.
	ErrNotFound = errors.New("not found")
	// ErrUnauthorized matches a 401 response: the server rejected the API
	// key. A client without an API key fails with ErrMissingAPIKey instead,
	// before sending the request.
	ErrUnauthorized = errors.New("unauthorized")
	// ErrForbidden matches any 403 response.
	ErrForbidden = errors.New("forbidden")
	// ErrAccountNotAccessible matches a 403 response with the error code
	// ERR_ACCOUNT_NOT_ACCESSIBLE: the API key has no access to the account
	// passed to WithAuth. Such an error also matches ErrForbidden.
	ErrAccountNotAccessible = errors.New("account not accessible")
	// ErrPlanLimit matches a 402 response: the action exceeds the account's
	// plan.
	ErrPlanLimit = errors.New("plan limit reached")
	// ErrConflict matches a 409 response, such as creating a resource that
	// already exists.
	ErrConflict = errors.New("conflict")
	// ErrRateLimited matches a 429 response that was still rate limited after
	// the client's retries.
	ErrRateLimited = errors.New("rate limited")
	// ErrSlackIntegrationNotConnected matches a 400 response with the error
	// code ERR_SLACK_INTEGRATION_NOT_CONNECTED, or
	// slack_integration_not_connected as the API sends it today: a Slack App
	// alert channel was created or updated on an account without a connected
	// Slack workspace. The error is a [*SlackIntegrationNotConnectedError].
	// Such an error also matches ErrBadRequest.
	ErrSlackIntegrationNotConnected = errors.New("slack integration not connected")
	// ErrUnresolvableSlackDestinations matches a 400 response with the error
	// code ERR_UNRESOLVABLE_SLACK_DESTINATIONS: a Slack App alert channel
	// names #channels or @handles that the connected Slack workspace cannot
	// resolve. The error is an [*UnresolvableSlackDestinationsError], which
	// lists them. Such an error also matches ErrBadRequest.
	ErrUnresolvableSlackDestinations = errors.New("unresolvable slack destinations")
	// ErrUnresolvableSlackHandles matches a 400 response with the code
	// unresolvable_handles, or ERR_UNRESOLVABLE_SLACK_HANDLE: a Slack App
	// alert channel names @handles that the connected Slack workspace has no
	// single member for. The error is an [*UnresolvableSlackHandlesError],
	// which lists them. Such an error also matches ErrBadRequest. Versions of
	// the API that report unresolvable #channels too answer with
	// [ErrUnresolvableSlackDestinations] instead, for handles and channels
	// alike, so handle both.
	ErrUnresolvableSlackHandles = errors.New("unresolvable slack handles")
)

Sentinel errors for the API failures callers commonly branch on. An *APIError matches them with errors.Is according to its status code (and, for ErrAccountNotAccessible, ErrValidation, ErrSlackIntegrationNotConnected, ErrUnresolvableSlackDestinations and ErrUnresolvableSlackHandles, its body), also when wrapped:

if errors.Is(err, checkly.ErrNotFound) { ... }
View Source
var (
	// ErrMissingAPIKey is matched by the error an authenticated method of a
	// client without auth returns, without sending the request, prefixed
	// with the request as in "GET /v1/checks/abc: no API key configured; set
	// one with WithAuth". It also matches the error NewClient returns for
	// WithAuth with an empty API key and for WithAuthFromEnv when
	// CHECKLY_API_KEY is not set.
	ErrMissingAPIKey = errors.New("no API key configured; set one with WithAuth")
	// ErrMissingAccountID is matched by the error NewClient returns for
	// WithAuth with an empty account ID and for WithAuthFromEnv when
	// CHECKLY_ACCOUNT_ID is not set.
	ErrMissingAccountID = errors.New("an API key needs an account ID")
	// ErrInvalidAPIKey is matched by the error NewClient returns when
	// WithAuth or WithAuthFromEnv gets an API key with a character that HTTP
	// headers do not allow, such as a trailing newline.
	ErrInvalidAPIKey = errors.New("the API key contains a character that HTTP headers do not allow")
	// ErrInvalidAccountID is matched by the error NewClient returns when
	// WithAuth or WithAuthFromEnv gets an account ID that is not a UUID, such
	// as an API key passed in its place.
	ErrInvalidAccountID = errors.New("the account ID is not a UUID")
)

Sentinel errors for auth that cannot authenticate a request. They are not *APIError values and do not match ErrUnauthorized, which means the server rejected the key.

View Source
var ErrCheckTypeMismatch = errors.New("check type mismatch")

ErrCheckTypeMismatch is matched by the error a check or monitor getter, such as GetAPICheck or GetURLMonitor, returns when the ID belongs to a check of another type, prefixed with the request and naming both types as in "GET /v1/checks/abc: check is of type \"BROWSER\", not \"API\"". It is not an *APIError: the API answered successfully.

View Source
var ErrCodeBundleNotFound = errors.New("code bundle not found")

ErrCodeBundleNotFound is returned, wrapping the *APIError, when PeekCodeBundle finds no code bundle for the key.

View Source
var ErrUnsupportedCheckType = errors.New("unsupported check type")

ErrUnsupportedCheckType is matched by the *UnsupportedCheckTypeError that GetCheck returns for a check of a type the SDK has no resource type for.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether err is, or wraps, an API error for a 404 response. It is equivalent to errors.Is(err, ErrNotFound).

Types

type APICheck

type APICheck struct {
	// ID is the check's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 0, 1, 2, 5, 10, 15,
	// 30, 60, 120, 180, 360, 720 or 1440.
	Frequency int `json:"frequency"`
	// FrequencyOffset is 10, 20 or 30 when Frequency is 0, for a run every
	// that many seconds. For any other Frequency the API picks the offset
	// itself and keeps it until Frequency changes: a value sent has no
	// effect, and the value read back is the API's. The API still rejects a
	// value above Frequency * 10 for a Frequency up to 60, or above
	// Frequency / 5 rounded up for a higher one. With Frequency 0, an update
	// with a zero FrequencyOffset keeps the stored offset.
	FrequencyOffset int  `json:"frequencyOffset,omitempty"`
	Activated       bool `json:"activated"`
	// Muted stops notifications when the check fails or recovers.
	Muted bool `json:"muted"`
	// ShouldFail inverts the result: a run that would fail passes, and the
	// other way around.
	ShouldFail bool `json:"shouldFail"`
	// RunParallel runs the check in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// DegradedResponseTime and MaxResponseTime are the degraded and failing
	// response time limits in milliseconds, each at most 45000.
	DegradedResponseTime int      `json:"degradedResponseTime"`
	MaxResponseTime      int      `json:"maxResponseTime"`
	Tags                 []string `json:"tags"`
	// AlertSettings nil means the API's default settings on create, and an
	// update with nil keeps the stored settings.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool    `json:"useGlobalAlertSettings"`
	Request                Request `json:"request"`
	// SetupSnippetID and TearDownSnippetID are the IDs of the [Snippet] run
	// in the setup and teardown phase; 0 means none.
	SetupSnippetID    int64 `json:"setupSnippetId,omitempty"`
	TearDownSnippetID int64 `json:"tearDownSnippetId,omitempty"`
	// LocalSetupScript and LocalTearDownScript are Node.js code run in the
	// setup and teardown phase.
	LocalSetupScript    *string `json:"localSetupScript"`
	LocalTearDownScript *string `json:"localTearDownScript"`
	// GroupID is the ID of the check group the check belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the check's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// check's alerts. The SDK disables automatic assignment, so an empty
	// list leaves the check without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from.
	PrivateLocations *[]string `json:"privateLocations"`
	// RuntimeID is the runtime version the check runs with, such as
	// "2025.04".
	RuntimeID *string `json:"runtimeId"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the check open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
	// Intent describes what the check protects, for automatic AI repair; nil
	// removes it.
	Intent *CheckIntent `json:"intent"`
	// AIAutoRepairEnabled overrides the account's automatic AI repair
	// setting for this check; nil uses the account setting.
	AIAutoRepairEnabled *bool `json:"aiAutoRepairEnabled"`
}

APICheck is an API check: it sends an HTTP request and runs assertions on the response. It is the input and result of Client.CreateAPICheck and Client.UpdateAPICheck, and the result of Client.GetAPICheck.

type APICheckDefaults

type APICheckDefaults struct {
	// BaseURL is the group's base URL, which the checks' request URLs can
	// reference as {{GROUP_BASE_URL}}.
	BaseURL         string      `json:"url"`
	Headers         []KeyValue  `json:"headers,omitempty"`
	QueryParameters []KeyValue  `json:"queryParameters,omitempty"`
	Assertions      []Assertion `json:"assertions,omitempty"`
	BasicAuth       BasicAuth   `json:"basicAuth,omitempty"`
}

APICheckDefaults are request settings of a GroupV2 for the API checks in it.

type APICheckResult

type APICheckResult map[string]interface{}

APICheckResult is the request and response detail of an API check run, decoded as an untyped JSON object.

type APIError

type APIError struct {
	// Method is the HTTP method of the request, such as "GET".
	Method string
	// Path is the request path without the query string, such as
	// "/v1/checks/abc".
	Path string
	// StatusCode is the HTTP status of the response.
	StatusCode int
	// Code is the machine-readable error code from the response body, such
	// as "ERR_ACCOUNT_NOT_ACCESSIBLE", if any. It is the body's errorCode
	// field, or its code field when errorCode is absent, as some endpoints,
	// such as the Slack App alert channel writes, send it there.
	Code string
	// Message is the error message from the response body, or the body
	// itself if it is not JSON, with whitespace collapsed and truncated to
	// 500 bytes.
	Message string
	// Details lists the request fields a validation error refers to, from
	// the validation.keys field of the response body. It is non-nil, though
	// possibly empty, when the body has a validation block, and that is
	// what [ErrValidation] matches.
	Details []string
	// RetryAfter is how long the server asked the client to wait before
	// retrying a rate-limited (429) request, if it said so in a Retry-After
	// or X-RateLimit-Reset header. It is the server's value, not capped like
	// the client's own waits between retries.
	RetryAfter time.Duration
	// contains filtered or unexported fields
}

APIError is returned when the API answers with a status the method does not accept, wrapped in a SlackIntegrationNotConnectedError, an UnresolvableSlackDestinationsError or an UnresolvableSlackHandlesError for those Slack App alert channel errors. Use errors.As to inspect it, or errors.Is with the sentinel errors above to classify it.

The error text has the form

METHOD /v1/path: 404 Not Found[ [ERROR_CODE]][: message][ (keys: ...)]

and may end with a sentence suggesting what to check. It never contains the API key, request headers, the request body or, for an unexpected success status, the response body. Message is the backend's own error text, which for a validation error can quote a submitted value.

Example

Match an error with errors.Is and the sentinel errors to branch on the kind of failure, and use errors.As to read the details of an *APIError.

package main

import (
	"context"
	"errors"
	"fmt"
	"log"
	"time"

	"github.com/checkly/checkly-go-sdk/v2"
)

func main() {
	client, err := checkly.NewClient(checkly.WithAuthFromEnv())
	if err != nil {
		log.Fatal(err)
	}

	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
	defer cancel()

	_, err = client.GetAPICheck(ctx, "00000000-0000-4000-8000-000000000000")
	switch {
	case err == nil:
		fmt.Println("the check exists")
	case errors.Is(err, checkly.ErrNotFound):
		fmt.Println("the check does not exist")
	case errors.Is(err, checkly.ErrValidation):
		var apiErr *checkly.APIError
		if errors.As(err, &apiErr) {
			fmt.Println("invalid request fields:", apiErr.Details)
		}
	case errors.Is(err, checkly.ErrRateLimited):
		fmt.Println("rate limited; try again later")
	default:
		var apiErr *checkly.APIError
		if errors.As(err, &apiErr) {
			fmt.Printf("the API answered %d %s: %s\n", apiErr.StatusCode, apiErr.Code, apiErr.Message)
		} else {
			// No response, for example a network failure or an expired
			// context.
			fmt.Println("request failed:", err)
		}
	}
}

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface.

func (*APIError) Is

func (e *APIError) Is(target error) bool

Is reports whether e matches one of the sentinel errors of this package.

type Account added in v2.5.0

type Account struct {
	ID   string `json:"id"`
	Name string `json:"name"`

	// Features lists the account's feature flags that clients can act on,
	// such as AccountFeatureExtendedResponseTimeLimits.
	Features []AccountFeature `json:"features"`

	// Integrations lists integrations of the account, such as
	// AccountIntegrationSlack, each with whether it is connected. A type
	// that is not listed is one the API does not report, which says nothing
	// about whether it is connected.
	Integrations []AccountIntegration `json:"integrations"`
}

Account is a Checkly account, as returned by GetAccount.

func (*Account) HasFeature added in v2.5.0

func (a *Account) HasFeature(feature AccountFeature) bool

HasFeature reports whether the account has the feature flag feature, such as AccountFeatureExtendedResponseTimeLimits.

func (*Account) Integration added in v2.5.0

func (a *Account) Integration(integrationType AccountIntegrationType) (AccountIntegration, bool)

Integration returns the account's integration of type integrationType, such as AccountIntegrationSlack. It returns false if the API does not report that type.

type AccountFeature added in v2.5.0

type AccountFeature string

AccountFeature is a feature flag of an account, in Account.Features.

const (
	// AccountFeatureExtendedResponseTimeLimits marks accounts whose checks
	// may set response time limits above the standard runner timeouts: such
	// checks currently wait up to 45 seconds for a response, instead of 30
	// seconds for API checks and URL monitors and 5 seconds for TCP
	// monitors.
	AccountFeatureExtendedResponseTimeLimits AccountFeature = "EXTENDED_RESPONSE_TIME_LIMITS"
)

Account feature flags, the values of Account.Features.

type AccountIntegration added in v2.5.0

type AccountIntegration struct {
	Type      AccountIntegrationType `json:"type"`
	Connected bool                   `json:"connected"`
}

AccountIntegration is an integration of an Account.

type AccountIntegrationType added in v2.5.0

type AccountIntegrationType string

AccountIntegrationType is the type of an account integration, in AccountIntegration.Type.

const (
	// AccountIntegrationSlack is the Checkly Slack app, which alert channels
	// of type [AlertChannelTypeSlackApp] need.
	AccountIntegrationSlack AccountIntegrationType = "SLACK"
)

Account integration types, the values of AccountIntegration.Type.

type AlertChannel

type AlertChannel struct {
	ID   int64            `json:"id,omitempty"`
	Type AlertChannelType `json:"type"`

	// Email, Slack, SlackApp, SMS, CALL, Opsgenie, Webhook and Pagerduty
	// hold the config of the channel. Only the one that matches Type is
	// used, and a read sets only that one.
	Email     *AlertChannelEmail     `json:"-"`
	Slack     *AlertChannelSlack     `json:"-"`
	SlackApp  *AlertChannelSlackApp  `json:"-"`
	SMS       *AlertChannelSMS       `json:"-"`
	CALL      *AlertChannelCall      `json:"-"`
	Opsgenie  *AlertChannelOpsgenie  `json:"-"`
	Webhook   *AlertChannelWebhook   `json:"-"`
	Pagerduty *AlertChannelPagerduty `json:"-"`

	// SendRecovery, SendFailure and SendDegraded select which alerts the
	// channel sends: on recovery, on failure, and on degraded results. Nil
	// means the API's default on create, and an update with nil keeps the
	// stored value.
	SendRecovery *bool `json:"sendRecovery"`
	SendFailure  *bool `json:"sendFailure"`
	SendDegraded *bool `json:"sendDegraded"`

	// SSLExpiry enables alerts for expiring SSL certificates, and
	// SSLExpiryThreshold, between 1 and 30, sets when they start. Nil means
	// the API's defaults, false and 30, also on update.
	SSLExpiry          *bool  `json:"sslExpiry"`
	SSLExpiryThreshold *int   `json:"sslExpiryThreshold"`
	CreatedAt          string `json:"created_at"`
	UpdatedAt          string `json:"updated_at"`

	// AutoSubscribe subscribes checks created later to the channel. Nil
	// means the API's default, false, also on update.
	AutoSubscribe *bool `json:"autoSubscribe"`
}

AlertChannel is a destination for alerts, such as an email address or a Slack channel. It is the input of CreateAlertChannel and UpdateAlertChannel, which use the config field that matches Type, and their result.

type AlertChannelCall

type AlertChannelCall struct {
	Name   string `json:"name"`
	Number string `json:"number"`
}

AlertChannelCall is the config of an AlertChannelTypeCall alert channel, which alerts by phone call. The API rejects a Number in a country it does not support.

type AlertChannelEmail

type AlertChannelEmail struct {
	Address string `json:"address"`
}

AlertChannelEmail is the config of an AlertChannelTypeEmail alert channel.

type AlertChannelOpsgenie

type AlertChannelOpsgenie struct {
	Name     string           `json:"name"`
	APIKey   string           `json:"apiKey"`
	Region   OpsgenieRegion   `json:"region"`
	Priority OpsgeniePriority `json:"priority"`
}

AlertChannelOpsgenie is the config of an AlertChannelTypeOpsgenie alert channel. Every field is required.

type AlertChannelPagerduty

type AlertChannelPagerduty struct {
	Account     string `json:"account,omitempty"`
	ServiceKey  string `json:"serviceKey"`
	ServiceName string `json:"serviceName,omitempty"`
}

AlertChannelPagerduty is the config of an AlertChannelTypePagerduty alert channel. Only ServiceKey is required.

type AlertChannelSMS

type AlertChannelSMS struct {
	Name   string `json:"name"`
	Number string `json:"number"`
}

AlertChannelSMS is the config of an AlertChannelTypeSMS alert channel. The API rejects a Number in a country it does not support.

type AlertChannelSlack deprecated

type AlertChannelSlack struct {
	// WebhookURL is a Slack incoming webhook URL, starting with
	// "https://hooks.slack.com/services/", or a reference to an environment
	// variable such as "{{SLACK_WEBHOOK_URL}}".
	WebhookURL string `json:"url"`
	Channel    string `json:"channel"`
}

AlertChannelSlack is the config of an AlertChannelTypeSlack alert channel, which posts to a Slack incoming webhook.

Deprecated: Use AlertChannelSlackApp instead. The legacy Slack webhook integration is being phased out in favor of the Checkly Slack App.

type AlertChannelSlackApp

type AlertChannelSlackApp struct {
	// SlackChannels lists at least one target: a channel such as
	// "#operations", or a user such as "@tim" for a direct message.
	SlackChannels []string `json:"slackChannels"`
}

AlertChannelSlackApp is the config of an AlertChannelTypeSlackApp alert channel, which alerts through the Checkly Slack App.

type AlertChannelSubscription

type AlertChannelSubscription struct {
	ChannelID int64 `json:"alertChannelId"`
	Activated bool  `json:"activated"`
}

AlertChannelSubscription subscribes a check or group to the alert channel ChannelID, in the AlertChannelSubscriptions field of checks, monitors and groups.

type AlertChannelType

type AlertChannelType string

AlertChannelType is the type of an alert channel, in AlertChannel.Type.

const (
	AlertChannelTypeEmail AlertChannelType = "EMAIL"

	// AlertChannelTypeSlack identifies legacy Slack webhook alert channels.
	//
	// Deprecated: Use [AlertChannelTypeSlackApp] instead.
	AlertChannelTypeSlack AlertChannelType = "SLACK"

	AlertChannelTypeSlackApp  AlertChannelType = "SLACK_APP"
	AlertChannelTypeWebhook   AlertChannelType = "WEBHOOK"
	AlertChannelTypeSMS       AlertChannelType = "SMS"
	AlertChannelTypePagerduty AlertChannelType = "PAGERDUTY"
	AlertChannelTypeOpsgenie  AlertChannelType = "OPSGENIE"
	AlertChannelTypeCall      AlertChannelType = "CALL"
)

Alert channel types, the values of AlertChannel.Type. Each selects the config field of AlertChannel that writes use and reads set, such as Email for AlertChannelTypeEmail.

type AlertChannelWebhook

type AlertChannelWebhook struct {
	Name string `json:"name"`
	URL  string `json:"url"`

	// WebhookType is the kind of webhook, such as "WEBHOOK_TELEGRAM".
	WebhookType string `json:"webhookType,omitempty"`

	// Method is GET, POST, PUT, HEAD, DELETE or PATCH, as the net/http
	// constants such as http.MethodPost name them. Empty means POST.
	Method string `json:"method,omitempty"`

	// Template is the request body, with placeholders such as
	// "{{ALERT_TITLE}}" and "{{RESULT_LINK}}".
	Template        string     `json:"template,omitempty"`
	WebhookSecret   string     `json:"webhookSecret,omitempty"`
	Headers         []KeyValue `json:"headers,omitempty"`
	QueryParameters []KeyValue `json:"queryParameters,omitempty"`
}

AlertChannelWebhook is the config of an AlertChannelTypeWebhook alert channel, which sends an HTTP request for each alert. Name and URL are required.

type AlertSettings

type AlertSettings struct {
	EscalationType              EscalationType              `json:"escalationType,omitempty"`
	RunBasedEscalation          RunBasedEscalation          `json:"runBasedEscalation,omitempty"`
	TimeBasedEscalation         TimeBasedEscalation         `json:"timeBasedEscalation,omitempty"`
	Reminders                   Reminders                   `json:"reminders,omitempty"`
	ParallelRunFailureThreshold ParallelRunFailureThreshold `json:"parallelRunFailureThreshold,omitempty"`
}

AlertSettings sets when a check, monitor or group sends alerts and reminders. An empty EscalationType means EscalationTypeRunBased, an empty Reminders.Interval means 5 and an empty ParallelRunFailureThreshold.Percentage means 10, on create and on an update of a group, DNS monitor or Playwright check. Other updates store them as given.

type Assertion

type Assertion struct {
	// Source is the value the assertion checks, such as
	// [AssertionSourceStatusCode].
	Source AssertionSource `json:"source"`
	// Property selects a part of the source, such as the certificate field
	// for [AssertionSourceCertificate].
	Property string `json:"property"`
	// Comparison is how the source is compared with Target, such as
	// [AssertionComparisonEquals].
	Comparison AssertionComparison `json:"comparison"`
	Target     string              `json:"target"`
	// Regex, on an [AssertionSourceHeaders] assertion, extracts the first
	// capture group of the header value to compare instead of the whole
	// value; a value it does not match compares as empty.
	Regex string `json:"regex"`
}

Assertion is a condition on the result of a check run, such as the status code of an API check's response. It is used in Request and in the requests of the monitor types; which sources and comparisons are accepted depends on the check type.

type AssertionComparison

type AssertionComparison string

AssertionComparison is how an Assertion compares its source with its target, in Assertion.Comparison. Below, "numeric" means EQUALS, NOT_EQUALS, GREATER_THAN and LESS_THAN, and "text" means those plus IS_EMPTY, NOT_EMPTY, CONTAINS and NOT_CONTAINS. The comparisons a check type accepts:

  • API checks, the API check defaults of groups, and DNS monitors: all.
  • URL monitors: numeric.
  • TCP monitors: text for RESPONSE_DATA, numeric for RESPONSE_TIME.
  • ICMP monitors: numeric for LATENCY; text, IS_NULL and NOT_NULL for JSON_RESPONSE.
  • Traceroute monitors: numeric for RESPONSE_TIME; EQUALS, GREATER_THAN and LESS_THAN for HOP_COUNT and PACKET_LOSS.
  • gRPC monitors: numeric for RESPONSE_TIME and GRPC_STATUS_CODE; EQUALS and NOT_EQUALS for GRPC_HEALTHCHECK_STATUS; all for GRPC_RESPONSE, TEXT_BODY and GRPC_METADATA.
  • SSL monitors: numeric for RESPONSE_TIME; text for TEXT_RESPONSE; text, IS_NULL and NOT_NULL for JSON_RESPONSE; for CERTIFICATE and CONNECTION, a set that depends on the Property.
const (
	AssertionComparisonEquals      AssertionComparison = "EQUALS"
	AssertionComparisonNotEquals   AssertionComparison = "NOT_EQUALS"
	AssertionComparisonHasKey      AssertionComparison = "HAS_KEY"
	AssertionComparisonNotHasKey   AssertionComparison = "NOT_HAS_KEY"
	AssertionComparisonHasValue    AssertionComparison = "HAS_VALUE"
	AssertionComparisonNotHasValue AssertionComparison = "NOT_HAS_VALUE"
	AssertionComparisonIsEmpty     AssertionComparison = "IS_EMPTY"
	AssertionComparisonNotEmpty    AssertionComparison = "NOT_EMPTY"
	AssertionComparisonGreaterThan AssertionComparison = "GREATER_THAN"
	AssertionComparisonLessThan    AssertionComparison = "LESS_THAN"
	AssertionComparisonContains    AssertionComparison = "CONTAINS"
	AssertionComparisonNotContains AssertionComparison = "NOT_CONTAINS"
	AssertionComparisonIsNull      AssertionComparison = "IS_NULL"
	AssertionComparisonNotNull     AssertionComparison = "NOT_NULL"
)

Assertion comparisons, the values of Assertion.Comparison.

type AssertionSource

type AssertionSource string

AssertionSource is the value an Assertion checks, in Assertion.Source. The sources a check type accepts:

  • API checks and the API check defaults of groups: STATUS_CODE, JSON_BODY, HEADERS, TEXT_BODY, RESPONSE_TIME.
  • URL monitors: STATUS_CODE.
  • TCP monitors: RESPONSE_DATA, RESPONSE_TIME.
  • DNS monitors: RESPONSE_TIME, RESPONSE_CODE, TEXT_ANSWER, JSON_ANSWER.
  • ICMP monitors: LATENCY, JSON_RESPONSE.
  • Traceroute monitors: RESPONSE_TIME, HOP_COUNT, PACKET_LOSS.
  • gRPC monitors: RESPONSE_TIME, GRPC_STATUS_CODE, GRPC_HEALTHCHECK_STATUS, GRPC_RESPONSE, TEXT_BODY, GRPC_METADATA.
  • SSL monitors: CERTIFICATE, CONNECTION, RESPONSE_TIME, JSON_RESPONSE, TEXT_RESPONSE.

Browser and multistep checks, Playwright check suites and heartbeat monitors take no assertions.

const (
	AssertionSourceStatusCode   AssertionSource = "STATUS_CODE"
	AssertionSourceJSONBody     AssertionSource = "JSON_BODY"
	AssertionSourceTextBody     AssertionSource = "TEXT_BODY"
	AssertionSourceHeaders      AssertionSource = "HEADERS"
	AssertionSourceResponseTime AssertionSource = "RESPONSE_TIME"
	AssertionSourceResponseData AssertionSource = "RESPONSE_DATA"
	// AssertionSourceCertificate is a certificate field of an SSL monitor,
	// named by the assertion's Property.
	AssertionSourceCertificate AssertionSource = "CERTIFICATE"
	// AssertionSourceConnection is a connection field of an SSL monitor, such
	// as tlsVersion, named by the assertion's Property.
	AssertionSourceConnection   AssertionSource = "CONNECTION"
	AssertionSourceJSONResponse AssertionSource = "JSON_RESPONSE"
	AssertionSourceTextResponse AssertionSource = "TEXT_RESPONSE"
	AssertionSourceResponseCode AssertionSource = "RESPONSE_CODE"
	AssertionSourceTextAnswer   AssertionSource = "TEXT_ANSWER"
	AssertionSourceJSONAnswer   AssertionSource = "JSON_ANSWER"
	// AssertionSourceLatency is the ping latency of an ICMP monitor, with
	// the Property "avg", "min", "max" or "stdDev".
	AssertionSourceLatency               AssertionSource = "LATENCY"
	AssertionSourceHopCount              AssertionSource = "HOP_COUNT"
	AssertionSourcePacketLoss            AssertionSource = "PACKET_LOSS"
	AssertionSourceGRPCResponse          AssertionSource = "GRPC_RESPONSE"
	AssertionSourceGRPCMetadata          AssertionSource = "GRPC_METADATA"
	AssertionSourceGRPCHealthcheckStatus AssertionSource = "GRPC_HEALTHCHECK_STATUS"
	AssertionSourceGRPCStatusCode        AssertionSource = "GRPC_STATUS_CODE"
)

Assertion sources, the values of Assertion.Source.

type BasicAuth

type BasicAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

BasicAuth holds the HTTP basic authentication credentials of a Request or of APICheckDefaults.

type BodyType

type BodyType string

BodyType is the format of a request body, in Request.BodyType.

const (
	BodyTypeJSON    BodyType = "JSON"
	BodyTypeForm    BodyType = "FORM"
	BodyTypeRaw     BodyType = "RAW"
	BodyTypeGraphQL BodyType = "GRAPHQL"
	BodyTypeNone    BodyType = "NONE"
)

Body types, the values of Request.BodyType. The API default is BodyTypeNone.

type BrowserCheck

type BrowserCheck struct {
	// ID is the check's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 1, 2, 5, 10, 15, 30,
	// 60, 120, 180, 360, 720 or 1440.
	Frequency int  `json:"frequency"`
	Activated bool `json:"activated"`
	// Muted stops notifications when the check fails or recovers.
	Muted bool `json:"muted"`
	// ShouldFail inverts the result: a run that would fail passes, and the
	// other way around.
	ShouldFail bool `json:"shouldFail"`
	// RunParallel runs the check in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// Script is the check's code. Empty means no inline script, for a check
	// that runs ScriptPath.
	Script string `json:"script"`
	// ScriptPath is the path of the script in the runtime.
	ScriptPath *string `json:"scriptPath"`
	// Dependencies are files attached to the script.
	Dependencies         []ScriptDependency    `json:"dependencies"`
	EnvironmentVariables []EnvironmentVariable `json:"environmentVariables"`
	SSLCheckDomain       string                `json:"sslCheckDomain"`
	Tags                 []string              `json:"tags"`
	// AlertSettings nil means the API's default settings on create, and an
	// update with nil keeps the stored settings.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool `json:"useGlobalAlertSettings"`
	// GroupID is the ID of the check group the check belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the check's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// check's alerts. The SDK disables automatic assignment, so an empty
	// list leaves the check without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from.
	PrivateLocations *[]string `json:"privateLocations"`
	// RuntimeID is the runtime version the check runs with, such as
	// "2025.04".
	RuntimeID *string `json:"runtimeId"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the check open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
	// Intent describes what the check protects, for automatic AI repair; nil
	// removes it.
	Intent *CheckIntent `json:"intent"`
	// AIAutoRepairEnabled overrides the account's automatic AI repair
	// setting for this check; nil uses the account setting.
	AIAutoRepairEnabled *bool `json:"aiAutoRepairEnabled"`
}

BrowserCheck is a browser check, which runs a script in a browser. It is the input and result of Client.CreateBrowserCheck and Client.UpdateBrowserCheck, and the result of Client.GetBrowserCheck.

type BrowserCheckResult

type BrowserCheckResult map[string]interface{}

BrowserCheckResult is the detail of a browser check run, decoded as an untyped JSON object.

type Check

type Check interface {
	// contains filtered or unexported methods
}

Check is a check or monitor of any type, as returned by Client.GetCheck: a pointer to APICheck, BrowserCheck, MultiStepCheck, PlaywrightCheck, HeartbeatMonitor, URLMonitor, TCPMonitor, DNSMonitor, ICMPMonitor, GRPCMonitor, SSLMonitor or TracerouteMonitor. Use a type switch to read it; future SDK versions may add types, so give the switch a default case.

Only the pointer types implement Check, so a type switch case on a non-pointer type fails to compile instead of never matching.

type CheckIntent

type CheckIntent struct {
	// Goal is the user or system outcome the check protects.
	Goal string `json:"goal"`
	// RequiredOutcomes are observable outcomes the check must continue to
	// prove.
	RequiredOutcomes []string `json:"requiredOutcomes"`
	// MustPreserve are guardrails an AI repair must not weaken or bypass.
	MustPreserve []string `json:"mustPreserve"`
}

CheckIntent describes what a check protects, in the Intent field of API, browser, multi-step and Playwright checks: automatic AI repair uses it to decide which changes keep the check meaningful. Goal is required, of 1 to 2000 characters; RequiredOutcomes and MustPreserve each hold at most 20 statements of 1 to 1000 characters.

func (CheckIntent) MarshalJSON

func (i CheckIntent) MarshalJSON() ([]byte, error)

MarshalJSON sends nil statement lists as empty lists, because the API rejects null for them.

type CheckResult

type CheckResult struct {
	ID string `json:"id"`
	// Name is the name of the check.
	Name    string `json:"name"`
	CheckID string `json:"checkId"`
	// HasFailures reports whether the run failed, for example through a
	// failing assertion, a timeout or a failing script.
	HasFailures bool `json:"hasFailures"`
	// HasErrors reports an internal error in Checkly rather than in the
	// checked service.
	HasErrors bool `json:"hasErrors"`
	// IsDegraded and OverMaxResponseTime report whether the run exceeded the
	// degraded and failing limits of the check or monitor, such as its
	// DegradedResponseTime and MaxResponseTime.
	IsDegraded          bool `json:"isDegraded"`
	OverMaxResponseTime bool `json:"overMaxResponseTime"`
	// RunLocation is the location the check ran from.
	RunLocation string `json:"runLocation"`
	// ResponseTime is the time in milliseconds the check spent producing its
	// result: the measured operation, such as the request or the TLS
	// handshake, for API checks and protocol monitors, and the whole run for
	// browser, multi-step and Playwright checks. ICMP and traceroute monitors
	// report their average latency, which has a fractional part.
	ResponseTime       float64             `json:"responseTime"`
	APICheckResult     *APICheckResult     `json:"apiCheckResult"`
	BrowserCheckResult *BrowserCheckResult `json:"browserCheckResult"`
	// TracerouteCheckResult, GRPCCheckResult and SSLCheckResult hold the
	// diagnostics of a traceroute, gRPC or SSL monitor run, and are nil for
	// the other check types.
	TracerouteCheckResult *TracerouteCheckResult `json:"tracerouteCheckResult"`
	GRPCCheckResult       *GRPCCheckResult       `json:"grpcCheckResult"`
	SSLCheckResult        *SSLCheckResult        `json:"sslCheckResult"`
	// CheckRunID is the ID of the check run that produced this result.
	CheckRunID int64 `json:"checkRunId"`
	// Attempts is how often the run was retried.
	Attempts  int64     `json:"attempts"`
	StartedAt time.Time `json:"startedAt"`
	StoppedAt time.Time `json:"stoppedAt"`
	CreatedAt time.Time `json:"created_at"`
}

CheckResult is the result of one check run, as returned by Client.GetCheckResult and, in a CheckResultsPage, Client.GetCheckResults.

type CheckResultsFilter

type CheckResultsFilter struct {
	// Limit is the number of results per page, at most 100; the API
	// defaults to 10.
	Limit int64
	// NextID is the cursor of the page to read, from
	// [CheckResultsPage].NextID; empty reads the first page. The cursor does
	// not carry the other fields, so send the same ones on every page.
	NextID string
	// Location limits the results to one location, such as "eu-west-1".
	Location string
	// From and To limit the results to runs from From (inclusive) to To
	// (exclusive), as Unix timestamps in seconds. There is no default window:
	// an unset From or To leaves that end open, so a nil filter spans all the
	// raw results the account retains, which depends on its plan. The API
	// answers 408 when a wide query takes too long.
	To   int64
	From int64
	// CheckType is the type of the check, such as [CheckTypeMultiStep] or
	// [CheckTypeURL]. The API answers 404 when the check is of another type,
	// and 400 for a type it does not know.
	CheckType CheckType
	// HasFailures limits the results to failed runs.
	HasFailures bool
}

CheckResultsFilter narrows the results returned by Client.GetCheckResults. A zero-valued field does not narrow the results, and a zero Limit uses the API's default.

The API allows 60 requests per 60 seconds to this endpoint, and a request that sets HasFailures counts as five.

type CheckResultsPage

type CheckResultsPage struct {
	// Entries holds the results of this page.
	Entries []CheckResult `json:"entries"`
	// NextID is the cursor of the next page, to set as
	// [CheckResultsFilter].NextID. It is empty on the last page.
	NextID string `json:"nextId"`
}

CheckResultsPage is one page of the results of a check, as returned by Client.GetCheckResults.

type CheckType

type CheckType string

CheckType is the type of a check or monitor, in CheckResultsFilter.CheckType and UnsupportedCheckTypeError.Type.

const (
	// CheckTypeAgentic is the type of agentic checks, which the SDK has no
	// resource type for. It can be used as CheckResultsFilter.CheckType;
	// GetCheck returns an error matching [ErrUnsupportedCheckType] for such a
	// check.
	CheckTypeAgentic    CheckType = "AGENTIC"
	CheckTypeAPI        CheckType = "API"
	CheckTypeBrowser    CheckType = "BROWSER"
	CheckTypeHeartbeat  CheckType = "HEARTBEAT"
	CheckTypeICMP       CheckType = "ICMP"
	CheckTypeMultiStep  CheckType = "MULTI_STEP"
	CheckTypeTCP        CheckType = "TCP"
	CheckTypePlaywright CheckType = "PLAYWRIGHT"
	CheckTypeTraceroute CheckType = "TRACEROUTE"
	CheckTypeURL        CheckType = "URL"
	CheckTypeDNS        CheckType = "DNS"
	CheckTypeSSL        CheckType = "SSL"
	CheckTypeGRPC       CheckType = "GRPC"
)

Check types, the values of CheckResultsFilter.CheckType.

type Client

type Client interface {
	// GetCheck returns the check with the given ID, whatever its type, as a
	// [Check] holding a pointer to its check or monitor type, such as
	// [*APICheck]. It fails with an [*UnsupportedCheckTypeError], which matches
	// [ErrUnsupportedCheckType], for a type the SDK has no resource type for.
	GetCheck(
		ctx context.Context,
		id string,
	) (Check, error)

	// DeleteCheck deletes the check with the given ID, whatever its type.
	DeleteCheck(
		ctx context.Context,
		id string,
	) error

	// CreateAPICheck creates an API check and returns it with its ID.
	CreateAPICheck(
		ctx context.Context,
		check APICheck,
	) (*APICheck, error)

	// GetAPICheck returns the API check with the given ID. It fails with an error
	// matching [ErrCheckTypeMismatch] when the ID belongs to a check of another
	// type.
	GetAPICheck(
		ctx context.Context,
		id string,
	) (*APICheck, error)

	// UpdateAPICheck updates the API check with the given ID and returns it.
	UpdateAPICheck(
		ctx context.Context,
		id string,
		check APICheck,
	) (*APICheck, error)

	// DeleteAPICheck deletes the API check with the given ID. It does not
	// verify the check type, so it deletes a check of any type.
	DeleteAPICheck(
		ctx context.Context,
		id string,
	) error

	// CreateBrowserCheck creates a browser check and returns it with its ID.
	CreateBrowserCheck(
		ctx context.Context,
		check BrowserCheck,
	) (*BrowserCheck, error)

	// GetBrowserCheck returns the browser check with the given ID, including its
	// script dependencies. It fails with an error matching [ErrCheckTypeMismatch]
	// when the ID belongs to a check of another type.
	GetBrowserCheck(
		ctx context.Context,
		id string,
	) (*BrowserCheck, error)

	// UpdateBrowserCheck updates the browser check with the given ID and returns
	// it.
	UpdateBrowserCheck(
		ctx context.Context,
		id string,
		check BrowserCheck,
	) (*BrowserCheck, error)

	// DeleteBrowserCheck deletes the browser check with the given ID. It does
	// not verify the check type, so it deletes a check of any type.
	DeleteBrowserCheck(
		ctx context.Context,
		id string,
	) error

	// CreateMultiStepCheck creates a multi-step check and returns it with its ID.
	CreateMultiStepCheck(
		ctx context.Context,
		check MultiStepCheck,
	) (*MultiStepCheck, error)

	// GetMultiStepCheck returns the multi-step check with the given ID, including
	// its script dependencies. It fails with an error matching
	// [ErrCheckTypeMismatch] when the ID belongs to a check of another type.
	GetMultiStepCheck(
		ctx context.Context,
		id string,
	) (*MultiStepCheck, error)

	// UpdateMultiStepCheck updates the multi-step check with the given ID and
	// returns it.
	UpdateMultiStepCheck(
		ctx context.Context,
		id string,
		check MultiStepCheck,
	) (*MultiStepCheck, error)

	// DeleteMultiStepCheck deletes the multi-step check with the given ID. It
	// does not verify the check type, so it deletes a check of any type.
	DeleteMultiStepCheck(
		ctx context.Context,
		id string,
	) error

	// CreatePlaywrightCheck creates a Playwright check and returns it with its
	// ID.
	CreatePlaywrightCheck(
		ctx context.Context,
		check PlaywrightCheck,
	) (*PlaywrightCheck, error)

	// GetPlaywrightCheck returns the Playwright check with the given ID. It fails
	// with an error matching [ErrCheckTypeMismatch] when the ID belongs to a check
	// of another type.
	GetPlaywrightCheck(
		ctx context.Context,
		id string,
	) (*PlaywrightCheck, error)

	// UpdatePlaywrightCheck updates the Playwright check with the given ID and
	// returns it.
	UpdatePlaywrightCheck(
		ctx context.Context,
		id string,
		check PlaywrightCheck,
	) (*PlaywrightCheck, error)

	// DeletePlaywrightCheck deletes the Playwright check with the given ID. It
	// does not verify the check type, so it deletes a check of any type.
	DeletePlaywrightCheck(
		ctx context.Context,
		id string,
	) error

	// UploadCodeBundle uploads size bytes read from data as a code bundle for
	// Playwright checks and returns the stored bundle's metadata.
	UploadCodeBundle(
		ctx context.Context,
		data io.Reader,
		size int64,
		options UploadCodeBundleOptions,
	) (*CodeBundle, error)

	// PeekCodeBundle returns the metadata of the code bundle stored under key,
	// such as its size and checksum, without downloading it. When there is no
	// bundle for the key, including when the key belongs to another account,
	// the error matches [ErrCodeBundleNotFound].
	PeekCodeBundle(
		ctx context.Context,
		key string,
	) (*CodeBundle, error)

	// CreateHeartbeatMonitor creates a heartbeat monitor and returns it with its
	// ID.
	CreateHeartbeatMonitor(
		ctx context.Context,
		monitor HeartbeatMonitor,
	) (*HeartbeatMonitor, error)

	// GetHeartbeatMonitor returns the heartbeat monitor with the given ID. It
	// fails with an error matching [ErrCheckTypeMismatch] when the ID belongs to a
	// check of another type.
	GetHeartbeatMonitor(
		ctx context.Context,
		id string,
	) (*HeartbeatMonitor, error)

	// UpdateHeartbeatMonitor updates the heartbeat monitor with the given ID and
	// returns it.
	UpdateHeartbeatMonitor(
		ctx context.Context,
		id string,
		monitor HeartbeatMonitor,
	) (*HeartbeatMonitor, error)

	// DeleteHeartbeatMonitor deletes the heartbeat monitor with the given ID.
	// It does not verify the check type, so it deletes a check of any type.
	DeleteHeartbeatMonitor(
		ctx context.Context,
		id string,
	) error

	// CreateURLMonitor creates a URL monitor and returns it with its ID.
	CreateURLMonitor(
		ctx context.Context,
		monitor URLMonitor,
	) (*URLMonitor, error)

	// GetURLMonitor returns the URL monitor with the given ID. It fails with an
	// error matching [ErrCheckTypeMismatch] when the ID belongs to a check of
	// another type.
	GetURLMonitor(
		ctx context.Context,
		id string,
	) (*URLMonitor, error)

	// UpdateURLMonitor updates the URL monitor with the given ID and returns it.
	UpdateURLMonitor(
		ctx context.Context,
		id string,
		monitor URLMonitor,
	) (*URLMonitor, error)

	// DeleteURLMonitor deletes the URL monitor with the given ID. It does not
	// verify the check type, so it deletes a check of any type.
	DeleteURLMonitor(
		ctx context.Context,
		id string,
	) error

	// CreateTCPMonitor creates a TCP monitor and returns it with its ID.
	CreateTCPMonitor(
		ctx context.Context,
		monitor TCPMonitor,
	) (*TCPMonitor, error)

	// GetTCPMonitor returns the TCP monitor with the given ID. It fails with an
	// error matching [ErrCheckTypeMismatch] when the ID belongs to a check of
	// another type.
	GetTCPMonitor(
		ctx context.Context,
		id string,
	) (*TCPMonitor, error)

	// UpdateTCPMonitor updates the TCP monitor with the given ID and returns it.
	UpdateTCPMonitor(
		ctx context.Context,
		id string,
		monitor TCPMonitor,
	) (*TCPMonitor, error)

	// DeleteTCPMonitor deletes the TCP monitor with the given ID. It does not
	// verify the check type, so it deletes a check of any type.
	DeleteTCPMonitor(
		ctx context.Context,
		id string,
	) error

	// CreateDNSMonitor creates a DNS monitor and returns it with its ID.
	CreateDNSMonitor(
		ctx context.Context,
		monitor DNSMonitor,
	) (*DNSMonitor, error)

	// GetDNSMonitor returns the DNS monitor with the given ID. It fails with an
	// error matching [ErrCheckTypeMismatch] when the ID belongs to a check of
	// another type.
	GetDNSMonitor(
		ctx context.Context,
		id string,
	) (*DNSMonitor, error)

	// UpdateDNSMonitor updates the DNS monitor with the given ID and returns it.
	UpdateDNSMonitor(
		ctx context.Context,
		id string,
		monitor DNSMonitor,
	) (*DNSMonitor, error)

	// DeleteDNSMonitor deletes the DNS monitor with the given ID. It does not
	// verify the check type, so it deletes a check of any type.
	DeleteDNSMonitor(
		ctx context.Context,
		id string,
	) error

	// CreateICMPMonitor creates an ICMP monitor and returns it with its ID.
	CreateICMPMonitor(
		ctx context.Context,
		monitor ICMPMonitor,
	) (*ICMPMonitor, error)

	// GetICMPMonitor returns the ICMP monitor with the given ID. It fails with an
	// error matching [ErrCheckTypeMismatch] when the ID belongs to a check of
	// another type.
	GetICMPMonitor(
		ctx context.Context,
		id string,
	) (*ICMPMonitor, error)

	// UpdateICMPMonitor updates the ICMP monitor with the given ID and returns
	// it.
	UpdateICMPMonitor(
		ctx context.Context,
		id string,
		monitor ICMPMonitor,
	) (*ICMPMonitor, error)

	// DeleteICMPMonitor deletes the ICMP monitor with the given ID. It does not
	// verify the check type, so it deletes a check of any type.
	DeleteICMPMonitor(
		ctx context.Context,
		id string,
	) error

	// CreateGRPCMonitor creates a gRPC monitor and returns it with its ID.
	CreateGRPCMonitor(
		ctx context.Context,
		monitor GRPCMonitor,
	) (*GRPCMonitor, error)

	// GetGRPCMonitor returns the gRPC monitor with the given ID. It fails with an
	// error matching [ErrCheckTypeMismatch] when the ID belongs to a check of
	// another type.
	GetGRPCMonitor(
		ctx context.Context,
		id string,
	) (*GRPCMonitor, error)

	// UpdateGRPCMonitor updates the gRPC monitor with the given ID and returns
	// it.
	UpdateGRPCMonitor(
		ctx context.Context,
		id string,
		monitor GRPCMonitor,
	) (*GRPCMonitor, error)

	// DeleteGRPCMonitor deletes the gRPC monitor with the given ID. It does not
	// verify the check type, so it deletes a check of any type.
	DeleteGRPCMonitor(
		ctx context.Context,
		id string,
	) error

	// CreateTracerouteMonitor creates a traceroute monitor and returns it with
	// its ID.
	CreateTracerouteMonitor(
		ctx context.Context,
		monitor TracerouteMonitor,
	) (*TracerouteMonitor, error)

	// GetTracerouteMonitor returns the traceroute monitor with the given ID. It
	// fails with an error matching [ErrCheckTypeMismatch] when the ID belongs to a
	// check of another type.
	GetTracerouteMonitor(
		ctx context.Context,
		id string,
	) (*TracerouteMonitor, error)

	// UpdateTracerouteMonitor updates the traceroute monitor with the given ID
	// and returns it.
	UpdateTracerouteMonitor(
		ctx context.Context,
		id string,
		monitor TracerouteMonitor,
	) (*TracerouteMonitor, error)

	// DeleteTracerouteMonitor deletes the traceroute monitor with the given ID.
	// It does not verify the check type, so it deletes a check of any type.
	DeleteTracerouteMonitor(
		ctx context.Context,
		id string,
	) error

	// CreateSSLMonitor creates an SSL monitor and returns it with its ID.
	CreateSSLMonitor(
		ctx context.Context,
		monitor SSLMonitor,
	) (*SSLMonitor, error)

	// GetSSLMonitor returns the SSL monitor with the given ID. It fails with an
	// error matching [ErrCheckTypeMismatch] when the ID belongs to a check of
	// another type.
	GetSSLMonitor(
		ctx context.Context,
		id string,
	) (*SSLMonitor, error)

	// UpdateSSLMonitor updates the SSL monitor with the given ID and returns it.
	UpdateSSLMonitor(
		ctx context.Context,
		id string,
		monitor SSLMonitor,
	) (*SSLMonitor, error)

	// DeleteSSLMonitor deletes the SSL monitor with the given ID. It does not
	// verify the check type, so it deletes a check of any type.
	DeleteSSLMonitor(
		ctx context.Context,
		id string,
	) error

	// CreateGroupV2 creates a check group and returns it with its ID.
	CreateGroupV2(
		ctx context.Context,
		group GroupV2,
	) (*GroupV2, error)

	// GetGroupV2 returns the check group with the given ID.
	GetGroupV2(
		ctx context.Context,
		id int64,
	) (*GroupV2, error)

	// UpdateGroupV2 updates the check group with the given ID and returns it.
	UpdateGroupV2(
		ctx context.Context,
		id int64,
		group GroupV2,
	) (*GroupV2, error)

	// DeleteGroupV2 deletes the check group with the given ID.
	DeleteGroupV2(
		ctx context.Context,
		id int64,
	) error

	// GetCheckResult returns the result with ID checkResultID of the check with
	// ID checkID.
	GetCheckResult(
		ctx context.Context,
		checkID,
		checkResultID string,
	) (*CheckResult, error)

	// GetCheckResults returns one page of the final results of the check with ID
	// checkID, narrowed by filters, which may be nil; [CheckResultsFilter] gives
	// the defaults and limits. To read the next page, call it again with the same
	// filters and NextID set to the page's NextID, until that is empty.
	GetCheckResults(
		ctx context.Context,
		checkID string,
		filters *CheckResultsFilter,
	) (*CheckResultsPage, error)

	// CreateSnippet creates a snippet and returns it with its ID.
	CreateSnippet(
		ctx context.Context,
		snippet Snippet,
	) (*Snippet, error)

	// GetSnippet returns the snippet with the given ID.
	GetSnippet(
		ctx context.Context,
		id int64,
	) (*Snippet, error)

	// UpdateSnippet replaces the name and script of the snippet with the given ID
	// and returns it.
	UpdateSnippet(
		ctx context.Context,
		id int64,
		snippet Snippet,
	) (*Snippet, error)

	// DeleteSnippet deletes the snippet with the given ID.
	DeleteSnippet(
		ctx context.Context,
		id int64,
	) error

	// CreateEnvironmentVariable creates an environment variable and returns it.
	CreateEnvironmentVariable(
		ctx context.Context,
		envVar EnvironmentVariable,
	) (*EnvironmentVariable, error)

	// GetEnvironmentVariable returns the environment variable with the given
	// key.
	GetEnvironmentVariable(
		ctx context.Context,
		key string,
	) (*EnvironmentVariable, error)

	// UpdateEnvironmentVariable updates the environment variable with the given
	// key and returns it. Value must be set, because the API rejects an empty
	// value and a Get of a secret variable returns none. The API rejects a
	// change of the key and turning a secret variable into a non-secret one.
	UpdateEnvironmentVariable(
		ctx context.Context,
		key string,
		envVar EnvironmentVariable,
	) (*EnvironmentVariable, error)

	// DeleteEnvironmentVariable deletes the environment variable with the given
	// key.
	DeleteEnvironmentVariable(
		ctx context.Context,
		key string,
	) error

	// CreateAlertChannel creates an alert channel and returns it with its ID.
	CreateAlertChannel(
		ctx context.Context,
		ac AlertChannel,
	) (*AlertChannel, error)

	// GetAlertChannel returns the alert channel with the given ID.
	GetAlertChannel(
		ctx context.Context,
		id int64,
	) (*AlertChannel, error)

	// UpdateAlertChannel updates the alert channel with the given ID and returns
	// it.
	UpdateAlertChannel(
		ctx context.Context,
		id int64,
		ac AlertChannel,
	) (*AlertChannel, error)

	// DeleteAlertChannel deletes the alert channel with the given ID.
	DeleteAlertChannel(
		ctx context.Context,
		id int64,
	) error

	// CreateDashboard creates a dashboard and returns it with its IDs.
	CreateDashboard(
		ctx context.Context,
		dashboard Dashboard,
	) (*Dashboard, error)

	// GetDashboard returns the dashboard whose [Dashboard.DashboardID] is ID.
	GetDashboard(
		ctx context.Context,
		id string,
	) (*Dashboard, error)

	// UpdateDashboard updates the dashboard whose [Dashboard.DashboardID] is ID
	// and returns it.
	UpdateDashboard(
		ctx context.Context,
		id string,
		dashboard Dashboard,
	) (*Dashboard, error)

	// DeleteDashboard deletes the dashboard whose [Dashboard.DashboardID] is ID.
	DeleteDashboard(
		ctx context.Context,
		id string,
	) error

	// CreateMaintenanceWindow creates a maintenance window and returns it with
	// its ID.
	CreateMaintenanceWindow(
		ctx context.Context,
		mw MaintenanceWindow,
	) (*MaintenanceWindow, error)

	// GetMaintenanceWindow returns the maintenance window with the given ID.
	GetMaintenanceWindow(
		ctx context.Context,
		id int64,
	) (*MaintenanceWindow, error)

	// UpdateMaintenanceWindow updates the maintenance window with the given ID
	// and returns it.
	UpdateMaintenanceWindow(
		ctx context.Context,
		id int64,
		mw MaintenanceWindow,
	) (*MaintenanceWindow, error)

	// DeleteMaintenanceWindow deletes the maintenance window with the given ID.
	DeleteMaintenanceWindow(
		ctx context.Context,
		id int64,
	) error

	// CreatePrivateLocation creates a private location and returns it with its
	// ID.
	CreatePrivateLocation(
		ctx context.Context,
		pl PrivateLocation,
	) (*PrivateLocation, error)

	// GetPrivateLocation returns the private location with the given ID.
	GetPrivateLocation(
		ctx context.Context,
		id string,
	) (*PrivateLocation, error)

	// UpdatePrivateLocation updates the private location with the given ID and
	// returns it. The slug name cannot be changed.
	UpdatePrivateLocation(
		ctx context.Context,
		id string,
		pl PrivateLocation,
	) (*PrivateLocation, error)

	// DeletePrivateLocation deletes the private location with the given ID.
	DeletePrivateLocation(
		ctx context.Context,
		id string,
	) error

	// CreateClientCertificate creates a client certificate and returns it with
	// its ID.
	CreateClientCertificate(
		ctx context.Context,
		cs ClientCertificate,
	) (*ClientCertificate, error)

	// GetClientCertificate returns the client certificate with the given ID.
	GetClientCertificate(
		ctx context.Context,
		id string,
	) (*ClientCertificate, error)

	// DeleteClientCertificate deletes the client certificate with the given ID.
	DeleteClientCertificate(
		ctx context.Context,
		id string,
	) error

	// CreateStatusPage creates a status page and returns it with its ID.
	//
	// Deprecated: Use [Client.CreateStatusPageV3] instead. The public API
	// cannot migrate a v1 status page to v3, so this method remains for
	// existing v1 pages.
	CreateStatusPage(
		ctx context.Context,
		page StatusPage,
	) (*StatusPage, error)

	// GetStatusPage returns the status page with the given ID.
	//
	// Deprecated: Use [Client.GetStatusPageV3] instead. The public API cannot
	// migrate a v1 status page to v3, so this method remains for existing v1
	// pages.
	GetStatusPage(
		ctx context.Context,
		id string,
	) (*StatusPage, error)

	// UpdateStatusPage updates the status page with the given ID and returns
	// it.
	//
	// Deprecated: Use [Client.UpdateStatusPageV3] instead. The public API
	// cannot migrate a v1 status page to v3, so this method remains for
	// existing v1 pages.
	UpdateStatusPage(
		ctx context.Context,
		id string,
		page StatusPage,
	) (*StatusPage, error)

	// DeleteStatusPage deletes the status page with the given ID.
	//
	// Deprecated: Use [Client.DeleteStatusPageV3] instead. The public API
	// cannot migrate a v1 status page to v3, so this method remains for
	// existing v1 pages.
	DeleteStatusPage(
		ctx context.Context,
		id string,
	) error

	// CreateStatusPageService creates a status page service and returns it with
	// its ID.
	//
	// Deprecated: Use [Client.CreateStatusPageComponentV3] instead. The public
	// API cannot migrate a v1 status page to v3, so this method remains for
	// existing v1 pages.
	CreateStatusPageService(
		ctx context.Context,
		service StatusPageService,
	) (*StatusPageService, error)

	// GetStatusPageService returns the status page service with the given ID.
	//
	// Deprecated: Use [Client.GetStatusPageComponentV3] instead. The public API
	// cannot migrate a v1 status page to v3, so this method remains for
	// existing v1 pages.
	GetStatusPageService(
		ctx context.Context,
		id string,
	) (*StatusPageService, error)

	// UpdateStatusPageService renames the status page service with the given ID
	// and returns it.
	//
	// Deprecated: Use [Client.UpdateStatusPageComponentV3] instead. The public
	// API cannot migrate a v1 status page to v3, so this method remains for
	// existing v1 pages.
	UpdateStatusPageService(
		ctx context.Context,
		id string,
		service StatusPageService,
	) (*StatusPageService, error)

	// DeleteStatusPageService deletes the status page service with the given
	// ID.
	//
	// Deprecated: Use [Client.DeleteStatusPageComponentV3] instead. The public
	// API cannot migrate a v1 status page to v3, so this method remains for
	// existing v1 pages.
	DeleteStatusPageService(
		ctx context.Context,
		id string,
	) error

	// CreateStatusPageV3 creates a v3 status page and returns it with its ID.
	CreateStatusPageV3(
		ctx context.Context,
		page StatusPageV3,
	) (*StatusPageV3, error)

	// GetStatusPageV3 returns the v3 status page with the given ID.
	GetStatusPageV3(
		ctx context.Context,
		id string,
	) (*StatusPageV3, error)

	// UpdateStatusPageV3 updates the v3 status page with the given ID and
	// returns it.
	UpdateStatusPageV3(
		ctx context.Context,
		id string,
		page StatusPageV3,
	) (*StatusPageV3, error)

	// DeleteStatusPageV3 deletes the v3 status page with the given ID.
	DeleteStatusPageV3(
		ctx context.Context,
		id string,
	) error

	// CreateStatusPageComponentV3 adds a component to the v3 status page with ID
	// statusPageID and returns it with its ID.
	CreateStatusPageComponentV3(
		ctx context.Context,
		statusPageID string,
		component StatusPageComponentV3,
	) (*StatusPageComponentV3, error)

	// GetStatusPageComponentV3 returns the component with ID componentID of the
	// v3 status page with ID statusPageID.
	GetStatusPageComponentV3(
		ctx context.Context,
		statusPageID string,
		componentID string,
	) (*StatusPageComponentV3, error)

	// UpdateStatusPageComponentV3 updates the component with ID componentID of
	// the v3 status page with ID statusPageID and returns it.
	UpdateStatusPageComponentV3(
		ctx context.Context,
		statusPageID string,
		componentID string,
		component StatusPageComponentV3,
	) (*StatusPageComponentV3, error)

	// DeleteStatusPageComponentV3 deletes the component with ID componentID of
	// the v3 status page with ID statusPageID. Child components are detached
	// from a deleted [StatusPageComponentV3TypeGroup], not deleted.
	DeleteStatusPageComponentV3(
		ctx context.Context,
		statusPageID string,
		componentID string,
	) error

	// CreateStatusPageAutomationRuleV3 adds an automation rule to the v3 status
	// page with ID statusPageID and returns it with its ID.
	CreateStatusPageAutomationRuleV3(
		ctx context.Context,
		statusPageID string,
		rule StatusPageAutomationRuleV3,
	) (*StatusPageAutomationRuleV3, error)

	// GetStatusPageAutomationRuleV3 returns the automation rule with ID ruleID
	// of the v3 status page with ID statusPageID.
	GetStatusPageAutomationRuleV3(
		ctx context.Context,
		statusPageID string,
		ruleID string,
	) (*StatusPageAutomationRuleV3, error)

	// UpdateStatusPageAutomationRuleV3 updates the automation rule with ID
	// ruleID of the v3 status page with ID statusPageID and returns it.
	UpdateStatusPageAutomationRuleV3(
		ctx context.Context,
		statusPageID string,
		ruleID string,
		rule StatusPageAutomationRuleV3,
	) (*StatusPageAutomationRuleV3, error)

	// DeleteStatusPageAutomationRuleV3 deletes the automation rule with ID
	// ruleID of the v3 status page with ID statusPageID.
	DeleteStatusPageAutomationRuleV3(
		ctx context.Context,
		statusPageID string,
		ruleID string,
	) error

	// GetAccount returns the account the client acts on: the account of an
	// API key that belongs to a single account, else the account whose ID
	// the client was built with.
	GetAccount(ctx context.Context) (*Account, error)

	// GetRuntime returns the runtime with the given ID, such as "2025.04". The
	// endpoint is public, so the request is sent without credentials.
	GetRuntime(
		ctx context.Context,
		id string,
	) (*Runtime, error)

	// GetStaticIPs returns the IP ranges that checks run from, per region: IPv6
	// prefixes, and IPv4 addresses as /32 prefixes. The endpoints are public, so
	// the requests are sent without credentials.
	GetStaticIPs(ctx context.Context) ([]StaticIP, error)
}

Client is a client for the Checkly public API, with methods for the resources of a Checkly account. NewClient returns one; it is not modified afterwards, so it is safe for concurrent use. The package documentation describes the errors, cancellation, retries and update behaviour that all methods share.

func NewClient

func NewClient(opts ...ClientOption) (Client, error)

NewClient constructs a Checkly API client. Without options it talks to DefaultBaseURL through http.DefaultClient and has no auth: the public methods GetStaticIPs and GetRuntime work, and every other method fails with ErrMissingAPIKey without sending a request. Nil options are skipped.

NewClient returns a nil Client and the error of the first option with an invalid value, which starts with "checkly: " and names the option: a base URL WithBaseURL rejects, or auth WithAuth or WithAuthFromEnv rejects, an empty or unset API key (ErrMissingAPIKey) or account ID (ErrMissingAccountID), or an account ID that is not a UUID (ErrInvalidAccountID).

Example

NewClient with WithAuthFromEnv reads the API key and account ID from the CHECKLY_API_KEY and CHECKLY_ACCOUNT_ID environment variables, the same ones the Checkly CLI and the Terraform provider use.

package main

import (
	"context"
	"errors"
	"fmt"
	"log"
	"time"

	"github.com/checkly/checkly-go-sdk/v2"
)

func main() {
	client, err := checkly.NewClient(checkly.WithAuthFromEnv())
	if errors.Is(err, checkly.ErrMissingAPIKey) || errors.Is(err, checkly.ErrMissingAccountID) {
		log.Fatal("set CHECKLY_API_KEY and CHECKLY_ACCOUNT_ID: ", err)
	}
	if err != nil {
		log.Fatal(err)
	}

	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
	defer cancel()

	// The static IP ranges checks run from, counted per region.
	ips, err := client.GetStaticIPs(ctx)
	if err != nil {
		log.Fatal(err)
	}
	perRegion := make(map[string]int)
	for _, ip := range ips {
		perRegion[ip.Region]++
	}
	fmt.Printf("%d IP ranges in %d regions\n", len(ips), len(perRegion))
}
Example (WithAuth)

WithAuth takes the credentials as arguments, for example from a secret store, and WithHTTPClient sets the HTTP client, here to bound how long a single request may take.

package main

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"os"
	"time"

	"github.com/checkly/checkly-go-sdk/v2"
)

func main() {
	client, err := checkly.NewClient(
		checkly.WithAuth(os.Getenv("CHECKLY_API_KEY"), os.Getenv("CHECKLY_ACCOUNT_ID")),
		checkly.WithHTTPClient(&http.Client{Timeout: 10 * time.Second}),
	)
	if err != nil {
		log.Fatal(err)
	}

	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
	defer cancel()

	// The addresses checks run from, for allowlisting them in a firewall.
	ips, err := client.GetStaticIPs(ctx)
	if err != nil {
		log.Fatal(err)
	}
	for _, ip := range ips {
		if ip.Region == "eu-west-1" {
			fmt.Println(ip.Address)
		}
	}
}

type ClientCertificate

type ClientCertificate struct {
	ID string `json:"id,omitempty"`

	// Host is the host domain that the certificate should be used for,
	// without a scheme. Wildcards are supported, e.g. "*.acme.com".
	Host string `json:"host"`

	// Path is an optional URL path prefix that limits the certificate to
	// requests under that path, e.g. "/partner/api". Matching is on whole
	// path segments: "/partner" applies to "/partner" and "/partner/orders"
	// but not to "/partnership". API checks and Multistep checks match on
	// path; gRPC, SSL and TCP monitors only use certificates without one.
	// Leave it empty to use the certificate for every path on the host.
	Path string `json:"path,omitempty"`

	// Certificate is the client certificate in PEM format.
	Certificate string `json:"cert"`

	// PrivateKey is the private key for the certificate in PEM format. Reads
	// never return it.
	PrivateKey string `json:"key"`

	// Passphrase is an optional passphrase for the private key. Like
	// PrivateKey, reads never return it.
	Passphrase string `json:"passphrase,omitempty"`

	// TrustedCA is an optional PEM formatted bundle of CA certificates that
	// the client should trust. The bundle may contain many CA certificates.
	TrustedCA string `json:"ca,omitempty"`

	CreatedAt time.Time `json:"created_at"`
}

ClientCertificate is a TLS client certificate that checks present to the hosts it matches. It is the input and result of CreateClientCertificate and the result of GetClientCertificate; a certificate cannot be updated.

type ClientOption

type ClientOption func(*client) error

ClientOption configures a client built by NewClient. Each option validates its value when NewClient applies it, and the first invalid option stops NewClient with its error. Among valid options, which apply in order, a later one overrides an earlier one; for WithBaseURL, WithHTTPClient and WithSource an empty or nil value restores the default.

func WithAuth

func WithAuth(apiKey, accountID string) ClientOption

WithAuth sets the credentials that authenticate requests: the API key and the ID of the account it acts on (a UUID), sent as the x-checkly-account header. Both are required; for a client without auth, pass no auth option. A later WithAuth or WithAuthFromEnv replaces the credentials completely.

NewClient fails with "checkly: WithAuth: the API key is empty" (matching ErrMissingAPIKey), "checkly: WithAuth: the API key contains a character that HTTP headers do not allow, such as a newline" (matching ErrInvalidAPIKey), "checkly: WithAuth: the account ID is empty" (matching ErrMissingAccountID), or, for an account ID that is not a UUID, such as an API key passed in its place, "checkly: WithAuth: the account ID is not a UUID; check that the API key and account ID are not swapped" (matching ErrInvalidAccountID). The errors never include the values, because a misplaced value may be the API key.

func WithAuthFromEnv

func WithAuthFromEnv() ClientOption

WithAuthFromEnv sets the credentials from the CHECKLY_API_KEY and CHECKLY_ACCOUNT_ID environment variables, which the Checkly CLI and the Terraform provider use too, reading them when NewClient applies the option. Both are required: if one is unset or empty, NewClient fails with an error naming it, "checkly: WithAuthFromEnv: CHECKLY_API_KEY is not set" (matching ErrMissingAPIKey) or "checkly: WithAuthFromEnv: CHECKLY_ACCOUNT_ID is not set" (matching ErrMissingAccountID). The API key must not contain a control character other than tab, such as a trailing newline, or NewClient fails with "checkly: WithAuthFromEnv: CHECKLY_API_KEY contains a character that HTTP headers do not allow, such as a newline" (matching ErrInvalidAPIKey). The account ID must be a UUID, or NewClient fails with "checkly: WithAuthFromEnv: CHECKLY_ACCOUNT_ID is not a UUID" (matching ErrInvalidAccountID).

NewClient never reads the environment without this option.

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL sets the API root, such as "https://api.checklyhq.com". It must be an http or https URL with a host and without a query or fragment; a path is allowed. Trailing slashes are trimmed. An empty string restores DefaultBaseURL.

The error for an invalid value quotes the URL with any userinfo password redacted. When the value does not parse, the error says only that it is not a valid URL: it wraps the *url.Error, for errors.As, but leaves its text, which quotes the input, out of the message.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOption

WithHTTPClient sets the HTTP client that sends requests, for example to set a timeout or a proxy. Nil restores http.DefaultClient.

func WithSource

func WithSource(source string) ClientOption

WithSource sets the x-checkly-source header, which identifies the calling tool to the API. An empty string restores the default, "go-sdk". NewClient fails with "checkly: WithSource: the source contains a character that HTTP headers do not allow, such as a newline" for a source with a control character other than tab.

type CodeBundle

type CodeBundle struct {
	// Key identifies the bundle in Checkly storage.
	Key       string `json:"key"`
	VersionID string `json:"versionID,omitempty"`
	// LastModified and ContentLength are set by PeekCodeBundle only; an
	// upload leaves them zero.
	LastModified  time.Time `json:"lastModified,omitempty"`
	ContentLength int64     `json:"contentLength"`
	// ChecksumSha256 is the hex-encoded SHA-256 digest stored with the
	// bundle, or empty if it has none.
	ChecksumSha256 string `json:"checksumSha256"`
}

CodeBundle describes a code bundle in Checkly storage, as returned by Client.UploadCodeBundle and Client.PeekCodeBundle.

type DNSMonitor

type DNSMonitor struct {
	// ID is the monitor's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 0, 1, 2, 5, 10, 15,
	// 30, 60, 120, 180, 360, 720 or 1440.
	Frequency int `json:"frequency"`
	// FrequencyOffset is 10, 20 or 30 when Frequency is 0, for a run every
	// that many seconds. For any other Frequency the API picks the offset
	// itself and keeps it until Frequency changes: a value sent has no
	// effect, and the value read back is the API's. The API still rejects a
	// value above Frequency * 10 for a Frequency up to 60, or above
	// Frequency / 5 rounded up for a higher one. With Frequency 0, an update
	// with a zero FrequencyOffset keeps the stored offset.
	FrequencyOffset int  `json:"frequencyOffset,omitempty"`
	Activated       bool `json:"activated"`
	// Muted stops notifications when the monitor fails or recovers.
	Muted bool `json:"muted"`
	// RunParallel runs the monitor in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// DegradedResponseTime and MaxResponseTime are the degraded and failing
	// response time limits in milliseconds, each at most 5000.
	DegradedResponseTime int      `json:"degradedResponseTime,omitempty"`
	MaxResponseTime      int      `json:"maxResponseTime,omitempty"`
	Tags                 []string `json:"tags,omitempty"`
	// AlertSettings nil means the API's default settings, also on update.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool       `json:"useGlobalAlertSettings"`
	Request                DNSRequest `json:"request"`
	// GroupID is the ID of the check group the monitor belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the monitor's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// monitor's alerts. The SDK disables automatic assignment, so an
	// empty list leaves the monitor without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from. The Checkly agent
	// at those locations must be version 7.0.0 or later.
	PrivateLocations *[]string `json:"privateLocations"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the monitor open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
}

DNSMonitor sends a DNS query and checks the answer against its assertions. It is the input of Client.CreateDNSMonitor and Client.UpdateDNSMonitor, and is returned by Client.GetDNSMonitor.

type DNSProtocol

type DNSProtocol string

DNSProtocol is the transport protocol of a DNS monitor's query, in DNSRequest.Protocol.

const (
	DNSProtocolUDP DNSProtocol = "UDP"
	DNSProtocolTCP DNSProtocol = "TCP"
)

DNS protocols, the values of DNSRequest.Protocol. The API default is DNSProtocolUDP.

type DNSRecordType

type DNSRecordType string

DNSRecordType is the DNS record type a DNS monitor queries, in DNSRequest.RecordType.

const (
	DNSRecordTypeA     DNSRecordType = "A"
	DNSRecordTypeAAAA  DNSRecordType = "AAAA"
	DNSRecordTypeCNAME DNSRecordType = "CNAME"
	DNSRecordTypeMX    DNSRecordType = "MX"
	DNSRecordTypeTXT   DNSRecordType = "TXT"
	DNSRecordTypeSOA   DNSRecordType = "SOA"
	DNSRecordTypeNS    DNSRecordType = "NS"
	DNSRecordTypeHTTPS DNSRecordType = "HTTPS"
)

DNS record types, the values of DNSRequest.RecordType.

type DNSRequest

type DNSRequest struct {
	RecordType DNSRecordType `json:"recordType"`
	Query      string        `json:"query"`
	// NameServer and Port select the name server to query. Set both or
	// neither.
	NameServer string `json:"nameServer,omitempty"`
	Port       int    `json:"port,omitempty"`
	// Protocol empty means the API's default, [DNSProtocolUDP], also on
	// update.
	Protocol   DNSProtocol `json:"protocol,omitempty"`
	Assertions []Assertion `json:"assertions"`
}

DNSRequest is the query of a DNSMonitor.

type Dashboard

type Dashboard struct {
	ID int64 `json:"id,omitempty"`

	// DashboardID is the identifier that GetDashboard, UpdateDashboard and
	// DeleteDashboard take.
	DashboardID string `json:"dashboardId,omitempty"`

	// CustomURL is a subdomain of checklyhq.com, unique across all
	// accounts. CustomDomain is a domain of the account's own, such as
	// "status.example.com".
	CustomURL    string `json:"customUrl"`
	CustomDomain string `json:"customDomain,omitempty"`

	// IsPrivate makes the dashboard viewable only with one of its Keys.
	IsPrivate bool `json:"isPrivate,omitempty"`

	// Logo and Favicon are http or https URLs of image files. Link is
	// where clicking the logo leads.
	Link        string `json:"link,omitempty"`
	Description string `json:"description,omitempty"`
	Favicon     string `json:"favicon,omitempty"`

	// Header is the text at the top of the dashboard. It is required on
	// create.
	Header string `json:"header,omitempty"`
	// ShowHeader nil means the API's default, true, also on update.
	ShowHeader *bool `json:"showHeader,omitempty"`

	// Width empty means the API's default, [DashboardWidthFull], also on
	// update.
	Width DashboardWidth `json:"width,omitempty"`

	// RefreshRate is how often the dashboard refreshes, in seconds: 60, 300
	// or 600. Zero means the API's default, 60, also on update.
	RefreshRate int `json:"refreshRate,omitempty"`

	// ChecksPerPage is between 1 and 20. Zero means the API's default, 15,
	// also on update.
	ChecksPerPage int `json:"checksPerPage,omitempty"`

	// PaginationRate is how often the dashboard turns the page, in
	// seconds: 30, 60 or 300. Zero means the API's default, 60, also on
	// update.
	PaginationRate int `json:"paginationRate,omitempty"`

	// Paginate nil means the API's default, true, also on update.
	Paginate *bool `json:"paginate,omitempty"`

	// SortByStatus lists failing checks first.
	SortByStatus bool `json:"sortByStatus,omitempty"`
	// ShowGroupNames nil means the API's default, true, also on update.
	ShowGroupNames *bool `json:"showGroupNames,omitempty"`

	// Tags selects the checks to show. UseTagsAndOperator requires a check
	// to have all of them.
	Tags               []string `json:"tags,omitempty"`
	HideTags           bool     `json:"hideTags,omitempty"`
	UseTagsAndOperator bool     `json:"useTagsAndOperator,omitempty"`
	EnableIncidents    bool     `json:"enableIncidents"`
	ExpandChecks       bool     `json:"expandChecks"`
	ShowCheckRunLinks  bool     `json:"showCheckRunLinks"`
	CustomCSS          string   `json:"customCSS"`
	// ShowP95 and ShowP99 nil means the API's default, true, also on update.
	ShowP95   *bool  `json:"showP95,omitempty"`
	ShowP99   *bool  `json:"showP99,omitempty"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`

	// Keys are the access keys of the dashboard. The response of
	// CreateDashboard includes a new key with its RawKey; keys sent in a
	// request are ignored.
	Keys []DashboardKey `json:"keys,omitempty"`
}

Dashboard is a public or private web page that shows the status of the checks selected by Tags. It is the input and result of CreateDashboard and UpdateDashboard.

type DashboardKey

type DashboardKey struct {
	ID        string `json:"id"`
	MaskedKey string `json:"maskedKey"`
	RawKey    string `json:"rawKey"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

DashboardKey is an access key of a dashboard, in Dashboard.Keys.

type DashboardWidth

type DashboardWidth string

DashboardWidth is the page width of a dashboard, in Dashboard.Width.

const (
	DashboardWidthFull  DashboardWidth = "FULL"
	DashboardWidth960PX DashboardWidth = "960PX"
)

Dashboard widths, the values of Dashboard.Width. The API default is DashboardWidthFull.

type EnvironmentVariable

type EnvironmentVariable struct {
	// Key is the variable's name, such as "API_KEY". UpdateEnvironmentVariable
	// rejects a different key.
	Key string `json:"key,omitempty"`

	// Value must not be empty for an account-level variable. Reads return an
	// empty Value for a secret variable, and an update of a check or group
	// keeps the stored value of a secret variable whose Value is empty.
	Value string `json:"value"`

	// Locked hides the value in the Checkly UI, like a password.
	Locked bool `json:"locked"`

	// Secret stores the value as a secret, which reads never return. A
	// secret variable cannot be made non-secret again.
	Secret bool `json:"secret"`
}

EnvironmentVariable is an environment variable that checks can read when they run. It is the input and result of CreateEnvironmentVariable and UpdateEnvironmentVariable for account-level variables, and the element type of the EnvironmentVariables fields of checks and groups.

type EscalationType

type EscalationType string

EscalationType is when an alert escalates, in AlertSettings.EscalationType.

const (
	// EscalationTypeRunBased alerts after a number of consecutive failed
	// runs, set in RunBasedEscalation. It is the API default on create.
	EscalationTypeRunBased EscalationType = "RUN_BASED"
	// EscalationTypeTimeBased alerts once a check has been failing for a
	// number of minutes, set in TimeBasedEscalation.
	EscalationTypeTimeBased EscalationType = "TIME_BASED"
)

Escalation types, the values of AlertSettings.EscalationType.

type GRPCCheckResponse

type GRPCCheckResponse struct {
	GRPCMode          string                 `json:"grpcMode,omitempty"`
	Host              string                 `json:"host,omitempty"`
	ResolvedIP        string                 `json:"resolvedIp,omitempty"`
	Port              int                    `json:"port,omitempty"`
	GRPCMethod        string                 `json:"grpcMethod,omitempty"`
	ResponseMessage   string                 `json:"responseMessage,omitempty"`
	GRPCStatusCode    int                    `json:"grpcStatusCode,omitempty"`
	GRPCStatusMessage string                 `json:"grpcStatusMessage,omitempty"`
	HealthStatus      *int                   `json:"healthStatus,omitempty"`
	HealthStatusLabel string                 `json:"healthStatusLabel,omitempty"`
	Metadata          []GRPCMetadata         `json:"metadata,omitempty"`
	DiscoveredMethods []string               `json:"discoveredMethods,omitempty"`
	RequestError      string                 `json:"requestError,omitempty"`
	TimingPhases      map[string]interface{} `json:"timingPhases,omitempty"`
}

GRPCCheckResponse is the detailed response of a gRPC monitor run.

type GRPCCheckResult

type GRPCCheckResult struct {
	GRPCStatusCode *int                     `json:"grpcStatusCode,omitempty"`
	HealthStatus   *int                     `json:"healthStatus,omitempty"`
	TimingPhases   map[string]interface{}   `json:"timingPhases,omitempty"`
	RequestError   *string                  `json:"requestError,omitempty"`
	Request        map[string]interface{}   `json:"request,omitempty"`
	Assertions     []map[string]interface{} `json:"assertions,omitempty"`
	Response       *GRPCCheckResponse       `json:"response,omitempty"`
}

GRPCCheckResult holds the diagnostics of a gRPC monitor run.

type GRPCConfig

type GRPCConfig struct {
	// An empty Mode means [GRPCModeBehavior], also on update, so set
	// [GRPCModeHealth] on every write of a health monitor.
	Mode GRPCMode `json:"mode,omitempty"`
	TLS  bool     `json:"tls"`
	// Metadata holds at most 50 entries, with keys unique regardless of
	// case.
	Metadata []GRPCMetadata `json:"metadata,omitempty"`
	// The fields from Encoding to Message are for [GRPCModeBehavior] only.
	//
	// An update with an empty Encoding keeps the stored encoding, so set
	// [GRPCEncodingProtobuf] explicitly to switch a [GRPCEncodingFlatbuffers]
	// monitor back; that also clears the stored BfbsContent.
	Encoding GRPCEncoding `json:"encoding,omitempty"`
	// ServiceDefinition applies to [GRPCEncodingProtobuf] only, and
	// [GRPCServiceDefinitionProtoFile] requires ProtoContent.
	// An update with an empty ServiceDefinition keeps the stored definition,
	// so set [GRPCServiceDefinitionReflection] explicitly to switch a
	// [GRPCServiceDefinitionProtoFile] monitor back.
	ServiceDefinition GRPCServiceDefinition `json:"serviceDefinition,omitempty"`
	// The API rejects an empty Method with [GRPCModeBehavior], also on
	// update.
	Method string `json:"method,omitempty"`
	// ProtoContent is the proto file of [GRPCServiceDefinitionProtoFile].
	// With [GRPCModeBehavior], the API rejects an empty ProtoContent when
	// ServiceDefinition is [GRPCServiceDefinitionProtoFile]. An update with
	// an empty ProtoContent removes the stored file when ServiceDefinition is
	// [GRPCServiceDefinitionReflection], and keeps it when ServiceDefinition
	// is empty.
	ProtoContent string `json:"protoContent,omitempty"`
	// BfbsContent is the base64-encoded binary FlatBuffers schema, required
	// with [GRPCEncodingFlatbuffers]. An update with an empty Encoding ignores
	// BfbsContent and keeps the stored schema.
	BfbsContent string `json:"bfbsContent,omitempty"`
	Message     string `json:"message,omitempty"`
	// Service is for [GRPCModeHealth] only.
	Service string `json:"service,omitempty"`
}

GRPCConfig is the gRPC configuration in a GRPCRequest. Mode selects which of the other fields apply: the API drops the fields of the other mode.

type GRPCEncoding

type GRPCEncoding string

GRPCEncoding is the message encoding of a gRPC monitor, in GRPCConfig.Encoding.

const (
	GRPCEncodingProtobuf    GRPCEncoding = "PROTOBUF"
	GRPCEncodingFlatbuffers GRPCEncoding = "FLATBUFFERS"
)

gRPC encodings, the values of GRPCConfig.Encoding. The API default is GRPCEncodingProtobuf.

type GRPCMetadata

type GRPCMetadata struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

GRPCMetadata is a metadata entry in GRPCConfig.

type GRPCMode

type GRPCMode string

GRPCMode is what a gRPC monitor checks, in GRPCConfig.Mode.

const (
	// GRPCModeBehavior calls the method in GRPCConfig.Method.
	GRPCModeBehavior GRPCMode = "BEHAVIOR"
	// GRPCModeHealth calls the standard gRPC health check of
	// GRPCConfig.Service.
	GRPCModeHealth GRPCMode = "HEALTH"
)

gRPC modes, the values of GRPCConfig.Mode. An empty mode means GRPCModeBehavior, the API default.

type GRPCMonitor

type GRPCMonitor struct {
	// ID is the monitor's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 0, 1, 2, 5, 10, 15,
	// 30, 60, 120, 180, 360, 720 or 1440.
	Frequency int `json:"frequency"`
	// FrequencyOffset is 10, 20 or 30 when Frequency is 0, for a run every
	// that many seconds. For any other Frequency the API picks the offset
	// itself and keeps it until Frequency changes: a value sent has no
	// effect, and the value read back is the API's. The API still rejects a
	// value above Frequency * 10 for a Frequency up to 60, or above
	// Frequency / 5 rounded up for a higher one. With Frequency 0, an update
	// with a zero FrequencyOffset keeps the stored offset.
	FrequencyOffset int  `json:"frequencyOffset,omitempty"`
	Activated       bool `json:"activated"`
	// Muted stops notifications when the monitor fails or recovers.
	Muted bool `json:"muted"`
	// ShouldFail inverts the result: a run that would fail passes, and the
	// other way around.
	ShouldFail bool `json:"shouldFail"`
	// RunParallel runs the monitor in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// DegradedResponseTime and MaxResponseTime are the degraded and failing
	// response time limits in milliseconds, each at most 180000. Zero means
	// the API's default on create, and an update with zero keeps the stored
	// limit.
	DegradedResponseTime int      `json:"degradedResponseTime,omitempty"`
	MaxResponseTime      int      `json:"maxResponseTime,omitempty"`
	Tags                 []string `json:"tags,omitempty"`
	// AlertSettings nil means the API's default settings on create, and an
	// update with nil keeps the stored settings.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool        `json:"useGlobalAlertSettings"`
	Request                GRPCRequest `json:"request"`
	// GroupID is the ID of the check group the monitor belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the monitor's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// monitor's alerts. The SDK disables automatic assignment, so an
	// empty list leaves the monitor without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from.
	PrivateLocations *[]string `json:"privateLocations"`
	// RuntimeID is the runtime version, such as "2025.04".
	RuntimeID *string `json:"runtimeId"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the monitor open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
}

GRPCMonitor calls a gRPC method, or queries a server's health status, and checks the result against its assertions. It is the input of Client.CreateGRPCMonitor and Client.UpdateGRPCMonitor, and is returned by Client.GetGRPCMonitor.

type GRPCRequest

type GRPCRequest struct {
	URL string `json:"url"`
	// Port is 1 to 65535. Its type is open because the API may return it as
	// a string; send a number or a numeric string.
	Port interface{} `json:"port"`
	// An update with an empty IPFamily keeps the stored family, as the API
	// rejects an empty value.
	IPFamily IPFamily `json:"ipFamily,omitempty"`
	SkipSSL  bool     `json:"skipSSL"`
	// Timeout is 1 to 180; zero means 60.
	Timeout    int         `json:"timeout,omitempty"`
	GRPCConfig GRPCConfig  `json:"grpcConfig"`
	Assertions []Assertion `json:"assertions,omitempty"`
}

GRPCRequest is the connection of a GRPCMonitor. The API requires GRPCConfig, so it is a value rather than a pointer.

type GRPCServiceDefinition

type GRPCServiceDefinition string

GRPCServiceDefinition is where a gRPC monitor gets the service definition from, in GRPCConfig.ServiceDefinition.

const (
	// GRPCServiceDefinitionReflection uses server reflection.
	GRPCServiceDefinitionReflection GRPCServiceDefinition = "REFLECTION"
	// GRPCServiceDefinitionProtoFile uses GRPCConfig.ProtoContent.
	GRPCServiceDefinitionProtoFile GRPCServiceDefinition = "PROTO_FILE"
)

gRPC service definitions, the values of GRPCConfig.ServiceDefinition. The API default is GRPCServiceDefinitionReflection.

type GroupV2

type GroupV2 struct {
	// ID is the group's ID, assigned by the API.
	ID   int64  `json:"id,omitempty"`
	Name string `json:"name"`
	// Activated, when false, deactivates every check in the group.
	Activated bool `json:"activated"`
	// Muted mutes every check in the group.
	Muted bool `json:"muted"`
	// RunParallel runs the group's checks in all their locations in
	// parallel; nil leaves each check its own setting.
	RunParallel *bool `json:"runParallel"`
	// Tags are added to the tags of every check in the group.
	Tags []string `json:"tags"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1". When the group has any
	// public or private locations, they replace those of its checks.
	Locations []string `json:"locations"`
	// Concurrency is how many of the group's checks run at once when the
	// group is triggered from the API or CI/CD; at least 1.
	Concurrency      int              `json:"concurrency"`
	APICheckDefaults APICheckDefaults `json:"apiCheckDefaults"`
	// EnvironmentVariables are merged into those of every check in the
	// group.
	EnvironmentVariables []EnvironmentVariable `json:"environmentVariables"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings, for every check in the group; nil leaves each check
	// its own setting.
	UseGlobalAlertSettings *bool `json:"useGlobalAlertSettings"`
	// AlertSettings replaces the alert settings of the checks in the group;
	// nil leaves each check its own. A check that uses the account's alert
	// settings keeps them unless UseGlobalAlertSettings is false.
	AlertSettings *AlertSettings `json:"alertSettings"`
	// SetupSnippetID and TearDownSnippetID are the IDs of the [Snippet] run
	// in the setup and teardown phase of the group's API checks; nil means
	// none.
	SetupSnippetID    *int64 `json:"setupSnippetId"`
	TearDownSnippetID *int64 `json:"tearDownSnippetId"`
	// LocalSetupScript and LocalTearDownScript are Node.js code run in the
	// setup and teardown phase of the group's API checks; nil means none.
	LocalSetupScript    *string `json:"localSetupScript"`
	LocalTearDownScript *string `json:"localTearDownScript"`
	// AlertChannelSubscriptions are the alert channels that receive alerts
	// for the group's checks. They apply only when UseGlobalAlertSettings is
	// non-nil or AlertSettings is set; otherwise each check uses its own
	// subscriptions. The SDK disables automatic assignment, so an empty list
	// leaves the group without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	// RuntimeID is the runtime version, such as "2025.04", for the checks
	// in the group that have none of their own.
	RuntimeID *string `json:"runtimeId"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from.
	PrivateLocations *[]string `json:"privateLocations"`
	// RetryStrategy applies to every check in the group instead of the
	// check's own, unless its Type is [RetryStrategyTypeFallback], which lets
	// each check use its own. Nil disables retries.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
}

GroupV2 is a check group: settings shared by the checks in it, as used by Client.CreateGroupV2, Client.GetGroupV2 and Client.UpdateGroupV2.

type Heartbeat

type Heartbeat struct {
	// Period is the interval expected between pings, from 30 seconds to 365
	// days.
	Period     int           `json:"period"`
	PeriodUnit HeartbeatUnit `json:"periodUnit"`
	// Grace is added to the period, and must be less than 365 days.
	Grace     int           `json:"grace"`
	GraceUnit HeartbeatUnit `json:"graceUnit"`
	// PingToken is the UUID that the ping URL is built from. An update with
	// an empty PingToken keeps the stored token.
	PingToken string `json:"pingToken"`
}

Heartbeat is the ping schedule of a HeartbeatMonitor.

type HeartbeatMonitor

type HeartbeatMonitor struct {
	// ID is the monitor's UUID, assigned by the API.
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	Activated   bool    `json:"activated"`
	// Muted stops notifications when the monitor fails or recovers.
	Muted bool     `json:"muted"`
	Tags  []string `json:"tags,omitempty"`
	// AlertSettings with the [EscalationTypeRunBased] escalation type
	// requires RunBasedEscalation.FailedRunThreshold.
	AlertSettings AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool `json:"useGlobalAlertSettings"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// monitor's alerts. The SDK disables automatic assignment, so an
	// empty list leaves the monitor without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	Heartbeat                 Heartbeat                  `json:"heartbeat"`
	// TriggerIncident makes the monitor open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at"`
	UpdatedAt       time.Time        `json:"updated_at"`
}

HeartbeatMonitor expects pings at its ping URL instead of running checks itself: Heartbeat sets how often a ping is expected. It is the input of Client.CreateHeartbeatMonitor and Client.UpdateHeartbeatMonitor, and is returned by Client.GetHeartbeatMonitor.

type HeartbeatUnit

type HeartbeatUnit string

HeartbeatUnit is the time unit of a heartbeat monitor's period and grace, in Heartbeat.PeriodUnit and Heartbeat.GraceUnit.

const (
	HeartbeatUnitSeconds HeartbeatUnit = "seconds"
	HeartbeatUnitMinutes HeartbeatUnit = "minutes"
	HeartbeatUnitHours   HeartbeatUnit = "hours"
	HeartbeatUnitDays    HeartbeatUnit = "days"
)

Heartbeat units, the values of Heartbeat.PeriodUnit and Heartbeat.GraceUnit.

type ICMPMonitor

type ICMPMonitor struct {
	// ID is the monitor's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 0, 1, 2, 5, 10, 15,
	// 30, 60, 120, 180, 360, 720 or 1440.
	Frequency int `json:"frequency"`
	// FrequencyOffset is 10, 20 or 30 when Frequency is 0, for a run every
	// that many seconds. For any other Frequency the API picks the offset
	// itself and keeps it until Frequency changes: a value sent has no
	// effect, and the value read back is the API's. The API still rejects a
	// value above Frequency * 10 for a Frequency up to 60, or above
	// Frequency / 5 rounded up for a higher one. With Frequency 0, an update
	// with a zero FrequencyOffset keeps the stored offset.
	FrequencyOffset int  `json:"frequencyOffset,omitempty"`
	Activated       bool `json:"activated"`
	// Muted stops notifications when the monitor fails or recovers.
	Muted bool `json:"muted"`
	// RunParallel runs the monitor in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// DegradedPacketLossThreshold and MaxPacketLossThreshold are the
	// percentages of lost packets at which a run counts as degraded and as
	// failed: greater than 0 and at most 100, with MaxPacketLossThreshold at
	// least DegradedPacketLossThreshold. Both must be set, also on update,
	// as the API rejects zero.
	DegradedPacketLossThreshold int      `json:"degradedPacketLossThreshold,omitempty"`
	MaxPacketLossThreshold      int      `json:"maxPacketLossThreshold,omitempty"`
	Tags                        []string `json:"tags,omitempty"`
	// AlertSettings nil means the API's default settings on create, and an
	// update with nil keeps the stored settings.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool        `json:"useGlobalAlertSettings"`
	Request                ICMPRequest `json:"request"`
	// GroupID is the ID of the check group the monitor belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the monitor's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// monitor's alerts. The SDK disables automatic assignment, so an
	// empty list leaves the monitor without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from. The Checkly agent
	// at those locations must be version 7.0.0 or later and have the NET_RAW
	// capability.
	PrivateLocations *[]string `json:"privateLocations"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the monitor open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
}

ICMPMonitor pings a host and checks the packet loss and its assertions. It is the input of Client.CreateICMPMonitor and Client.UpdateICMPMonitor, and is returned by Client.GetICMPMonitor.

type ICMPRequest

type ICMPRequest struct {
	Hostname string `json:"hostname"`
	// An update with an empty IPFamily keeps the stored family, as the API
	// rejects an empty value.
	IPFamily IPFamily `json:"ipFamily,omitempty"`
	// PingCount is 1 to 50; the API defaults to 10. An update with a zero
	// PingCount keeps the stored count, as the API rejects a zero value.
	PingCount  int         `json:"pingCount,omitempty"`
	Assertions []Assertion `json:"assertions"`
}

ICMPRequest is the ping of an ICMPMonitor.

type IPFamily

type IPFamily string

IPFamily is the IP version a check or monitor connects with, in the IPFamily field of Request, URLRequest, TCPRequest, ICMPRequest, TracerouteRequest, GRPCRequest and SSLConfig.

const (
	IPFamilyIPv4 IPFamily = "IPv4"
	IPFamilyIPv6 IPFamily = "IPv6"
)

IP families, the values of the IPFamily fields. The API default is IPFamilyIPv4.

type IncidentSeverity

type IncidentSeverity string

IncidentSeverity is the severity of an incident, in IncidentTrigger.Severity and MaintenanceWindowStatusPageVisibility.Severity.

const (
	IncidentSeverityMinor    IncidentSeverity = "MINOR"
	IncidentSeverityMedium   IncidentSeverity = "MEDIUM"
	IncidentSeverityMajor    IncidentSeverity = "MAJOR"
	IncidentSeverityCritical IncidentSeverity = "CRITICAL"
)

Incident severities, the values of IncidentTrigger.Severity and MaintenanceWindowStatusPageVisibility.Severity.

type IncidentTrigger

type IncidentTrigger struct {
	// ServiceID is the UUID of the v1 status page service the incident is
	// opened on.
	ServiceID   string           `json:"serviceId"`
	Severity    IncidentSeverity `json:"severity"`
	Name        string           `json:"name"`
	Description string           `json:"description"`
	// NotifySubscribers notifies subscribers when the incident is opened.
	NotifySubscribers bool `json:"notifySubscribers"`
}

IncidentTrigger makes a check or monitor open and resolve an incident on a v1 status page service, based on its alert configuration. The API requires every field. It applies only to v1 services: v3 pages automate incidents with StatusPageAutomationRuleV3.

type KeyValue

type KeyValue struct {
	Key    string `json:"key"`
	Value  string `json:"value"`
	Locked bool   `json:"locked"`
}

KeyValue is a key-value pair, such as a request header or query parameter.

type Location

type Location struct {
	Name   string `json:"name"`
	Region string `json:"region"`
}

Location is a public location that checks can run from: Region is its code, such as "us-east-1", and Name a display name, such as "N. Virginia". No Client method returns it.

type MaintenanceWindow

type MaintenanceWindow struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	StartsAt string `json:"startsAt"`
	EndsAt   string `json:"endsAt"`

	// RepeatInterval, between 1 and 365, and RepeatUnit repeat the window
	// from its first occurrence. A zero RepeatInterval and an empty
	// RepeatCron mean no repeat.
	RepeatInterval int                         `json:"repeatInterval"`
	RepeatUnit     MaintenanceWindowRepeatUnit `json:"repeatUnit"`

	// RepeatCron repeats the window on a five-field cron expression (minute,
	// hour, day of month, month, day of week) read in Timezone, such as
	// "0 22 * * 6" for every Saturday at 22:00. The minute and the hour are
	// single numbers, as a schedule starts at most once a day. StartsAt must
	// be an occurrence of the expression, and each occurrence must end
	// before the next one starts. It cannot be combined with RepeatInterval
	// and RepeatUnit. The API returns the expression with single spaces
	// between its fields.
	RepeatCron string `json:"repeatCron"`

	// RepeatEndsAt is the last calendar date, in Timezone, on which an
	// occurrence may start, preferably as YYYY-MM-DD.
	RepeatEndsAt string `json:"repeatEndsAt"`

	// Tags selects, by tag, the checks and groups the window applies to.
	Tags []string `json:"tags"`

	// Timezone is the named IANA time zone used for recurring maintenance
	// scheduling, e.g. "America/New_York". UTC offset identifiers such as
	// "+05:00" are not accepted. Empty means UTC.
	Timezone string `json:"timezone"`

	// PauseAllChecks pauses every check in the account regardless of Tags.
	PauseAllChecks bool `json:"pauseAllChecks"`

	// SilenceAlertsTags selects which checks have their alerts silenced.
	// Ignored when SilenceAllAlerts is true.
	SilenceAlertsTags []string `json:"silenceAlertsTags"`

	// SilenceAllAlerts silences alerts for every check in the account,
	// overriding SilenceAlertsTags.
	SilenceAllAlerts bool `json:"silenceAllAlerts"`

	// Description is shown on linked status pages when the window is visible
	// there.
	Description string `json:"description"`

	// StatusPageVisibility controls whether and how the window appears on
	// status pages.
	StatusPageVisibility MaintenanceWindowStatusPageVisibility `json:"statusPageVisibility"`

	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

MaintenanceWindow is a scheduled, optionally recurring period during which checks are paused or their alerts silenced. It is the input and result of CreateMaintenanceWindow and UpdateMaintenanceWindow. A zero value means the API's default: no repeat, UTC, no description, empty tag lists, nothing paused or silenced, and a StatusPageVisibility that is hidden and unlinked.

func (MaintenanceWindow) MarshalJSON

func (mw MaintenanceWindow) MarshalJSON() ([]byte, error)

MarshalJSON sends every field. Zero values the API does not accept are sent as its equivalent default: null for an unset repeat, time zone or description, and an empty list for nil tag lists. Fields declared here shadow the embedded ones of the same JSON name.

type MaintenanceWindowComponentConfig

type MaintenanceWindowComponentConfig struct {
	// StatusPageID is the ID of a status page listed in StatusPageIDs.
	StatusPageID string `json:"statusPageId"`
	// AffectAllComponents affects every component of the page, including
	// components added later, and requires Components to be empty.
	AffectAllComponents bool                               `json:"affectAllComponents"`
	Components          []MaintenanceWindowComponentImpact `json:"components,omitempty"`
}

MaintenanceWindowComponentConfig lists the components of one status page that a maintenance window affects, in MaintenanceWindowStatusPageVisibility.ComponentConfigs.

type MaintenanceWindowComponentImpact

type MaintenanceWindowComponentImpact struct {
	ComponentID string `json:"componentId"`
	// An empty Status means [StatusPageComponentStatusV3UnderMaintenance],
	// also on update.
	Status StatusPageComponentStatusV3 `json:"status,omitempty"`
}

MaintenanceWindowComponentImpact is a status page component affected by a maintenance window, in MaintenanceWindowComponentConfig.Components, with the status it shows while the window is in progress.

type MaintenanceWindowRepeatUnit

type MaintenanceWindowRepeatUnit string

MaintenanceWindowRepeatUnit is the unit of a maintenance window's repeat interval, in MaintenanceWindow.RepeatUnit.

const (
	MaintenanceWindowRepeatUnitDay   MaintenanceWindowRepeatUnit = "DAY"
	MaintenanceWindowRepeatUnitWeek  MaintenanceWindowRepeatUnit = "WEEK"
	MaintenanceWindowRepeatUnitMonth MaintenanceWindowRepeatUnit = "MONTH"
)

Maintenance window repeat units, the values of MaintenanceWindow.RepeatUnit.

type MaintenanceWindowStatusPageVisibility

type MaintenanceWindowStatusPageVisibility struct {
	Enabled bool `json:"enabled"`

	// Severity is the severity shown on status pages. Empty means none.
	Severity              IncidentSeverity `json:"severity"`
	AffectAllServices     bool             `json:"affectAllServices"`
	NotifyOnStart         bool             `json:"notifyOnStart"`
	NotifyOnEnd           bool             `json:"notifyOnEnd"`
	SuppressAutoIncidents bool             `json:"suppressAutoIncidents"`
	ReminderMinutesBefore []int            `json:"reminderMinutesBefore"`

	// AutoStart, AutoEnd and ShowAffectedServices default to true when nil.
	AutoStart            *bool `json:"autoStart"`
	AutoEnd              *bool `json:"autoEnd"`
	ShowAffectedServices *bool `json:"showAffectedServices"`

	// StatusPageIDs requires ServiceIDs or AffectAllServices for a status
	// page with services, and an entry in ComponentConfigs for one with
	// components.
	StatusPageIDs []string `json:"statusPageIds"`
	ServiceIDs    []string `json:"serviceIds"`

	// ComponentConfigs lists the affected components of each linked status
	// page with components, at most one entry per page. The API rejects an
	// update with nil ComponentConfigs and a non-empty StatusPageIDs unless
	// ServiceIDs or AffectAllServices is set; when one of them is, nil keeps
	// the stored entries of the status pages that stay linked. Send back the
	// entries a read returned to keep them.
	ComponentConfigs []MaintenanceWindowComponentConfig `json:"componentConfigs"`
}

MaintenanceWindowStatusPageVisibility controls how a maintenance window appears on status pages. Every setting other than Enabled only takes effect when Enabled is true. The zero value is the API's default: hidden, with no linked status pages or services.

An account without the status page maintenance windows entitlement can only change Enabled from true to false; any other change is rejected, so such an account must send the stored settings back unchanged apart from Enabled.

Status pages with services (v1) are linked with ServiceIDs or AffectAllServices, and status pages with components (v3) with ComponentConfigs.

func (MaintenanceWindowStatusPageVisibility) MarshalJSON

func (v MaintenanceWindowStatusPageVisibility) MarshalJSON() ([]byte, error)

MarshalJSON sends every setting other than a nil ComponentConfigs, using the API's defaults for unset ones. Fields declared here shadow the embedded ones of the same JSON name.

type MultiStepCheck

type MultiStepCheck struct {
	// ID is the check's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 1, 2, 5, 10, 15, 30,
	// 60, 120, 180, 360, 720 or 1440.
	Frequency int  `json:"frequency"`
	Activated bool `json:"activated"`
	// Muted stops notifications when the check fails or recovers.
	Muted bool `json:"muted"`
	// ShouldFail inverts the result: a run that would fail passes, and the
	// other way around.
	ShouldFail bool `json:"shouldFail"`
	// RunParallel runs the check in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// Script is the check's code. Empty means no inline script, for a check
	// that runs ScriptPath.
	Script string `json:"script"`
	// ScriptPath is the path of the script in the runtime.
	ScriptPath *string `json:"scriptPath"`
	// Dependencies are files attached to the script.
	Dependencies         []ScriptDependency    `json:"dependencies"`
	EnvironmentVariables []EnvironmentVariable `json:"environmentVariables"`
	Tags                 []string              `json:"tags"`
	// AlertSettings nil means the API's default settings on create, and an
	// update with nil keeps the stored settings.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool `json:"useGlobalAlertSettings"`
	// GroupID is the ID of the check group the check belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the check's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// check's alerts. The SDK disables automatic assignment, so an empty
	// list leaves the check without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from.
	PrivateLocations *[]string `json:"privateLocations"`
	// RuntimeID is the runtime version the check runs with, such as
	// "2025.04".
	RuntimeID *string `json:"runtimeId"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the check open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
	// Intent describes what the check protects, for automatic AI repair; nil
	// removes it.
	Intent *CheckIntent `json:"intent"`
	// AIAutoRepairEnabled overrides the account's automatic AI repair
	// setting for this check; nil uses the account setting.
	AIAutoRepairEnabled *bool `json:"aiAutoRepairEnabled"`
}

MultiStepCheck is a multi-step check, which runs a script. It is the input and result of Client.CreateMultiStepCheck and Client.UpdateMultiStepCheck, and the result of Client.GetMultiStepCheck.

type OpsgeniePriority

type OpsgeniePriority string

OpsgeniePriority is the priority of the alerts an Opsgenie alert channel creates, in AlertChannelOpsgenie.Priority.

const (
	OpsgeniePriorityP1 OpsgeniePriority = "P1"
	OpsgeniePriorityP2 OpsgeniePriority = "P2"
	OpsgeniePriorityP3 OpsgeniePriority = "P3"
	OpsgeniePriorityP4 OpsgeniePriority = "P4"
	OpsgeniePriorityP5 OpsgeniePriority = "P5"
)

Opsgenie priorities, the values of AlertChannelOpsgenie.Priority.

type OpsgenieRegion

type OpsgenieRegion string

OpsgenieRegion is the Opsgenie region of an Opsgenie alert channel, in AlertChannelOpsgenie.Region.

const (
	OpsgenieRegionEU OpsgenieRegion = "EU"
	OpsgenieRegionUS OpsgenieRegion = "US"
)

Opsgenie regions, the values of AlertChannelOpsgenie.Region.

type ParallelRunFailureThreshold

type ParallelRunFailureThreshold struct {
	Enabled bool `json:"enabled"`
	// Percentage is 10, 20, 30, 40, 50, 60, 70, 80, 90 or 100.
	Percentage int `json:"percentage,omitempty"`
}

ParallelRunFailureThreshold, when enabled, makes a check that runs in parallel alert only when a percentage of its parallel runs fail.

type PlaywrightCheck

type PlaywrightCheck struct {
	// ID is the check's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 1, 2, 5, 10, 15, 30,
	// 60, 120, 180, 360, 720 or 1440.
	Frequency int  `json:"frequency"`
	Activated bool `json:"activated"`
	// Muted stops notifications when the check fails or recovers.
	Muted bool `json:"muted"`
	// RunParallel runs the check in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from.
	PrivateLocations     *[]string             `json:"privateLocations"`
	EnvironmentVariables []EnvironmentVariable `json:"environmentVariables"`
	Tags                 []string              `json:"tags,omitempty"`
	// AlertSettings nil means the API's default settings, also on update.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool `json:"useGlobalAlertSettings"`
	// GroupID is the ID of the check group the check belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the check's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// check's alerts. The SDK disables automatic assignment, so an empty
	// list leaves the check without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	// TriggerIncident makes the check open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	// Intent describes what the check protects, for automatic AI repair; nil
	// removes it.
	Intent *CheckIntent `json:"intent"`
	// AIAutoRepairEnabled overrides the account's automatic AI repair
	// setting for this check; nil uses the account setting.
	AIAutoRepairEnabled *bool `json:"aiAutoRepairEnabled"`

	// CacheHash is a hash of the lock file and browsers, which the API
	// requires.
	CacheHash         string  `json:"cacheHash"`
	PlaywrightVersion *string `json:"playwrightVersion"`
	// TestCommand is the command that runs the tests. Nil applies the API
	// default, "npx playwright test".
	TestCommand *string `json:"testCommand"`
	// InstallCommand defaults to an empty command when nil.
	InstallCommand *string `json:"installCommand"`
	// Browsers are the browsers to run the tests in, such as "chromium",
	// without duplicates. Empty means ["chromium"], also on update.
	Browsers []string `json:"browsers,omitempty"`
	// CodeBundlePath is the path of the check's code bundle, which the API
	// requires.
	CodeBundlePath string  `json:"codeBundlePath"`
	WorkingDir     *string `json:"workingDir"`
	// Engine is the JavaScript runtime that runs the tests, or nil.
	Engine *PlaywrightEngine `json:"engine"`
	// EngineVersion is the version of Engine. With [PlaywrightEngineNode] it
	// is any Node.js version or semver range, such as "24", "24.11.0" or
	// ">=22". It must be nil when Engine is nil.
	EngineVersion *string `json:"engineVersion"`
	// ResolvedEngineVersion is the Node.js release a run of the check uses,
	// such as "24.11.1". Only the API sets it, on every create and update. It
	// is nil for [PlaywrightEngineBun], and nil when no available release
	// satisfied EngineVersion at the last create or update.
	ResolvedEngineVersion *string `json:"resolvedEngineVersion"`

	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

PlaywrightCheck is a Playwright check, which runs a Playwright test suite from a code bundle. It is the input and result of Client.CreatePlaywrightCheck and Client.UpdatePlaywrightCheck, and the result of Client.GetPlaywrightCheck. Unlike the other check types it has no ShouldFail, RuntimeID or RetryStrategy, which the API does not accept for Playwright checks.

type PlaywrightEngine

type PlaywrightEngine string

PlaywrightEngine is the JavaScript runtime a Playwright check suite runs in, in PlaywrightCheck.Engine.

const (
	PlaywrightEngineNode PlaywrightEngine = "node"
	PlaywrightEngineBun  PlaywrightEngine = "bun"
)

Playwright engines, the values of PlaywrightCheck.Engine.

type PrivateLocation

type PrivateLocation struct {
	ID   string `json:"id"`
	Name string `json:"name"`

	// SlugName identifies the location in the PrivateLocations fields of
	// checks and groups. It is required on create and cannot be changed:
	// the API ignores it on update.
	SlugName string `json:"slugName"`

	// Icon defaults to "location" on create. An update with an empty Icon
	// keeps the stored icon, as the API rejects an empty value.
	Icon       string               `json:"icon,omitempty"`
	Keys       []PrivateLocationKey `json:"keys,omitempty"`
	LastSeen   string               `json:"lastSeen,omitempty"`
	AgentCount int                  `json:"agentCount,omitempty"`
	CreatedAt  string               `json:"created_at"`
	UpdatedAt  string               `json:"updated_at"`

	// ProxyURL is the proxy that API checks running in the location send
	// their HTTP requests through, such as https://user:password@host:3128,
	// so it can hold credentials. Nil and an empty string remove the proxy.
	ProxyURL *string `json:"proxyUrl"`
}

PrivateLocation is a location that runs checks on the account's own infrastructure, through Checkly agents. It is the input and result of CreatePrivateLocation and UpdatePrivateLocation.

type PrivateLocationKey

type PrivateLocationKey struct {
	ID        string `json:"id"`
	MaskedKey string `json:"maskedKey"`

	// RawKey is the full key. Only the response of CreatePrivateLocation
	// includes it, for the key that the new location gets.
	RawKey    string `json:"rawKey"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

PrivateLocationKey is an API key of a private location, in PrivateLocation.Keys.

type Reminders

type Reminders struct {
	// Amount is the number of reminders: 0 to 5, or 100000.
	Amount int `json:"amount"`
	// Interval is the interval between reminders: 1, 2, 3, 4, 5, 10, 15 or
	// 30.
	Interval int `json:"interval,omitempty"`
}

Reminders sets the reminders sent after the first alert notification.

type Request

type Request struct {
	// Method is GET, POST, PUT, HEAD, DELETE or PATCH, as the net/http
	// constants such as http.MethodGet name them.
	Method          string `json:"method"`
	URL             string `json:"url"`
	FollowRedirects bool   `json:"followRedirects"`
	SkipSSL         bool   `json:"skipSSL"`
	Body            string `json:"body"`
	// An update with an empty BodyType keeps the stored body type, as the
	// API rejects an empty value.
	BodyType        BodyType    `json:"bodyType,omitempty"`
	Headers         []KeyValue  `json:"headers"`
	QueryParameters []KeyValue  `json:"queryParameters"`
	Assertions      []Assertion `json:"assertions"`
	BasicAuth       *BasicAuth  `json:"basicAuth"`
	// An update with an empty IPFamily keeps the stored family, as the API
	// rejects an empty value.
	IPFamily IPFamily `json:"ipFamily,omitempty"`
}

Request is the HTTP request of an API check, with the assertions run on its response.

func (Request) MarshalJSON

func (r Request) MarshalJSON() ([]byte, error)

MarshalJSON sends unset headers, query parameters and assertions as [], as the API rejects null for these lists.

type RetryOnlyOn

type RetryOnlyOn string

RetryOnlyOn is a failure cause that retries can be limited to, in RetryStrategy.OnlyOn.

const (
	// RetryOnlyOnNetworkError is a run that got no response.
	RetryOnlyOnNetworkError RetryOnlyOn = "NETWORK_ERROR"
)

Retry failure causes, the values of RetryStrategy.OnlyOn.

type RetryStrategy

type RetryStrategy struct {
	// Type is how failed runs are retried.
	Type RetryStrategyType `json:"type"`
	// BaseBackoffSeconds is the number of seconds to wait before the first
	// retry.
	BaseBackoffSeconds int `json:"baseBackoffSeconds"`
	// MaxRetries is the maximum number of retries, 1 to 10.
	MaxRetries int `json:"maxRetries"`
	// MaxDurationSeconds is how long retrying may continue, 0 to 600
	// seconds.
	MaxDurationSeconds int `json:"maxDurationSeconds"`
	// SameRegion runs retries in the same region as the failed run.
	SameRegion bool `json:"sameRegion"`
	// OnlyOn limits retries to the listed failure causes.
	OnlyOn []RetryOnlyOn `json:"onlyOn,omitempty"`
}

RetryStrategy sets how the failed runs of a check, monitor or group are retried.

func (RetryStrategy) MarshalJSON

func (s RetryStrategy) MarshalJSON() ([]byte, error)

MarshalJSON encodes Type RetryStrategyTypeNoRetries as null and RetryStrategyTypeFallback as the string "FALLBACK". For RetryStrategyTypeSingleRetry it leaves out MaxRetries and MaxDurationSeconds, which do not apply to that type.

func (*RetryStrategy) UnmarshalJSON

func (s *RetryStrategy) UnmarshalJSON(data []byte) error

UnmarshalJSON is the reverse of MarshalJSON: it decodes null as Type RetryStrategyTypeNoRetries and the string "FALLBACK" as Type RetryStrategyTypeFallback.

type RetryStrategyType

type RetryStrategyType string

RetryStrategyType is how failed runs are retried, in RetryStrategy.Type.

const (
	RetryStrategyTypeFixed       RetryStrategyType = "FIXED"
	RetryStrategyTypeLinear      RetryStrategyType = "LINEAR"
	RetryStrategyTypeExponential RetryStrategyType = "EXPONENTIAL"
	// RetryStrategyTypeSingleRetry retries once; MaxRetries and
	// MaxDurationSeconds do not apply to it.
	RetryStrategyTypeSingleRetry RetryStrategyType = "SINGLE_RETRY"
	// RetryStrategyTypeNoRetries disables retries, like a nil retry
	// strategy. Reads return a nil retry strategy instead.
	RetryStrategyTypeNoRetries RetryStrategyType = "NO_RETRIES"
	// RetryStrategyTypeFallback lets each check in a group use its own retry
	// strategy, and only groups accept it. A read of such a group returns
	// it.
	RetryStrategyTypeFallback RetryStrategyType = "FALLBACK"
)

Retry strategy types, the values of RetryStrategy.Type.

type RunBasedEscalation

type RunBasedEscalation struct {
	// FailedRunThreshold is the number of consecutive failed runs after
	// which an alert is sent, 1 to 5.
	FailedRunThreshold int `json:"failedRunThreshold,omitempty"`
}

RunBasedEscalation holds the threshold of the EscalationTypeRunBased escalation type.

type Runtime

type Runtime struct {
	// Name is the runtime's ID, such as "2025.04", as the RuntimeID fields
	// of checks and groups take it.
	Name             string `json:"name"`
	MultiStepSupport bool   `json:"multiStepSupport"`

	// Stage is the runtime's life stage.
	Stage RuntimeStage `json:"stage"`

	// RuntimeEndOfLife is the date on which the runtime will be removed,
	// if one is set.
	RuntimeEndOfLife string `json:"runtimeEndOfLife"`
	Description      string `json:"description"`
}

Runtime describes a Checkly runtime, the versioned set of Node.js and libraries that checks run on. It is returned by GetRuntime.

type RuntimeStage

type RuntimeStage string

RuntimeStage is the release stage of a runtime, in Runtime.Stage.

const (
	RuntimeStageAlpha      RuntimeStage = "ALPHA"
	RuntimeStageBeta       RuntimeStage = "BETA"
	RuntimeStageCurrent    RuntimeStage = "CURRENT"
	RuntimeStageStable     RuntimeStage = "STABLE"
	RuntimeStageDeprecated RuntimeStage = "DEPRECATED"
	RuntimeStageRemoved    RuntimeStage = "REMOVED"
)

Runtime stages, the values of Runtime.Stage.

type SSLBaselineKeySizeRule

type SSLBaselineKeySizeRule struct {
	Value    int                 `json:"value,omitempty"`
	Severity SSLBaselineSeverity `json:"severity,omitempty"`
}

SSLBaselineKeySizeRule is a SecurityBaseline rule whose value is a key size in bits, 1024 to 16384.

type SSLBaselineSeverity

type SSLBaselineSeverity string

SSLBaselineSeverity is what an SSL monitor does when a security baseline rule is violated, in the Severity of SSLBaselineTLSRule, SSLBaselineKeySizeRule and SSLBaselineSeverityRule.

const (
	SSLBaselineSeverityFail    SSLBaselineSeverity = "fail"
	SSLBaselineSeverityDegrade SSLBaselineSeverity = "degrade"
	SSLBaselineSeverityIgnore  SSLBaselineSeverity = "ignore"
)

SSL baseline severities, the values of the Severity fields of the security baseline rules.

type SSLBaselineSeverityRule

type SSLBaselineSeverityRule struct {
	Severity SSLBaselineSeverity `json:"severity,omitempty"`
}

SSLBaselineSeverityRule is a SecurityBaseline rule without a value.

type SSLBaselineTLSRule

type SSLBaselineTLSRule struct {
	Value    TLSVersion          `json:"value,omitempty"`
	Severity SSLBaselineSeverity `json:"severity,omitempty"`
}

SSLBaselineTLSRule is a SecurityBaseline rule whose value is a TLS version.

type SSLCheckResponse

type SSLCheckResponse struct {
	ResolvedIP       string                   `json:"resolvedIp,omitempty"`
	Protocol         string                   `json:"protocol,omitempty"`
	CipherSuite      string                   `json:"cipherSuite,omitempty"`
	HandshakeTimeMs  float64                  `json:"handshakeTimeMs,omitempty"`
	HostnameVerified bool                     `json:"hostnameVerified,omitempty"`
	ChainTrusted     bool                     `json:"chainTrusted,omitempty"`
	DaysUntilExpiry  int                      `json:"daysUntilExpiry,omitempty"`
	OCSPStapled      bool                     `json:"ocspStapled,omitempty"`
	SecurityBaseline map[string]interface{}   `json:"securityBaseline,omitempty"`
	Certificate      map[string]interface{}   `json:"certificate,omitempty"`
	Chain            []map[string]interface{} `json:"chain,omitempty"`
}

SSLCheckResponse is the detailed response of an SSL monitor run.

type SSLCheckResult

type SSLCheckResult struct {
	TLSVersion       string                   `json:"tlsVersion,omitempty"`
	CipherSuite      string                   `json:"cipherSuite,omitempty"`
	DaysUntilExpiry  *int                     `json:"daysUntilExpiry,omitempty"`
	HandshakeTimeMs  *float64                 `json:"handshakeTimeMs,omitempty"`
	ChainTrusted     *bool                    `json:"chainTrusted,omitempty"`
	HostnameVerified *bool                    `json:"hostnameVerified,omitempty"`
	BaselineVerdict  string                   `json:"baselineVerdict,omitempty"`
	BaselineGrade    string                   `json:"baselineGrade,omitempty"`
	FailureCategory  string                   `json:"failureCategory,omitempty"`
	RequestError     *string                  `json:"requestError,omitempty"`
	Request          map[string]interface{}   `json:"request,omitempty"`
	Assertions       []map[string]interface{} `json:"assertions,omitempty"`
	Response         *SSLCheckResponse        `json:"response,omitempty"`
}

SSLCheckResult holds the diagnostics of an SSL monitor run.

type SSLClientCertificateMode

type SSLClientCertificateMode string

SSLClientCertificateMode is how an SSL monitor picks the client certificate it presents, in SSLConfig.ClientCertificateMode.

const (
	SSLClientCertificateModeAuto SSLClientCertificateMode = "auto"
	// SSLClientCertificateModeExplicit presents the certificate in
	// SSLRequest.SSLClientCertificateID.
	SSLClientCertificateModeExplicit SSLClientCertificateMode = "explicit"
)

SSL client certificate modes, the values of SSLConfig.ClientCertificateMode.

type SSLConfig

type SSLConfig struct {
	Hostname string `json:"hostname"`
	// Port is 1 to 65535; the API defaults to 443. An update with a zero
	// Port keeps the stored port, as the API rejects a zero value.
	Port int `json:"port,omitempty"`
	// ServerName is an optional SNI override.
	ServerName *string `json:"serverName"`
	// An update with an empty IPFamily keeps the stored family, as the API
	// rejects an empty value.
	IPFamily            IPFamily `json:"ipFamily,omitempty"`
	SkipChainValidation bool     `json:"skipChainValidation"`
	// HandshakeTimeoutMs is 1000 to 30000; the API defaults to 10000. An
	// update with a zero HandshakeTimeoutMs keeps the stored timeout, as the
	// API rejects a zero value.
	HandshakeTimeoutMs int `json:"handshakeTimeoutMs,omitempty"`
	// AlertDaysBeforeExpiry is 1 to 365; the API defaults to 20. An update
	// with a zero AlertDaysBeforeExpiry keeps the stored value, as the API
	// rejects a zero value.
	AlertDaysBeforeExpiry int `json:"alertDaysBeforeExpiry,omitempty"`
	// SecurityBaseline nil means the API's default baseline, also on update.
	SecurityBaseline *SecurityBaseline `json:"securityBaseline,omitempty"`
	// With [SSLClientCertificateModeExplicit],
	// SSLRequest.SSLClientCertificateID is required.
	ClientCertificateMode SSLClientCertificateMode `json:"clientCertificateMode,omitempty"`
}

SSLConfig is the TLS configuration in an SSLRequest.

type SSLMonitor

type SSLMonitor struct {
	// ID is the monitor's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 0, 1, 2, 5, 10, 15,
	// 30, 60, 120, 180, 360, 720 or 1440.
	Frequency int `json:"frequency"`
	// FrequencyOffset is 10, 20 or 30 when Frequency is 0, for a run every
	// that many seconds. For any other Frequency the API picks the offset
	// itself and keeps it until Frequency changes: a value sent has no
	// effect, and the value read back is the API's. The API still rejects a
	// value above Frequency * 10 for a Frequency up to 60, or above
	// Frequency / 5 rounded up for a higher one. With Frequency 0, an update
	// with a zero FrequencyOffset keeps the stored offset.
	FrequencyOffset int  `json:"frequencyOffset,omitempty"`
	Activated       bool `json:"activated"`
	// Muted stops notifications when the monitor fails or recovers.
	Muted bool `json:"muted"`
	// ShouldFail inverts the result: a run that would fail passes, and the
	// other way around.
	ShouldFail bool `json:"shouldFail"`
	// RunParallel runs the monitor in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// DegradedResponseTime and MaxResponseTime are the degraded and failing
	// response time limits in milliseconds, each at most 30000, with
	// MaxResponseTime at least DegradedResponseTime. Zero means the API's
	// default on create, and an update with zero keeps the stored limit.
	DegradedResponseTime int      `json:"degradedResponseTime,omitempty"`
	MaxResponseTime      int      `json:"maxResponseTime,omitempty"`
	Tags                 []string `json:"tags,omitempty"`
	// AlertSettings nil means the API's default settings on create, and an
	// update with nil keeps the stored settings.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool       `json:"useGlobalAlertSettings"`
	Request                SSLRequest `json:"request"`
	// GroupID is the ID of the check group the monitor belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the monitor's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// monitor's alerts. The SDK disables automatic assignment, so an
	// empty list leaves the monitor without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from.
	PrivateLocations *[]string `json:"privateLocations"`
	// RuntimeID is the runtime version, such as "2025.04".
	RuntimeID *string `json:"runtimeId"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the monitor open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
}

SSLMonitor connects to a host over TLS and checks its certificate and connection against its assertions and security baseline. It is the input of Client.CreateSSLMonitor and Client.UpdateSSLMonitor, and is returned by Client.GetSSLMonitor.

type SSLRequest

type SSLRequest struct {
	SSLConfig SSLConfig `json:"sslConfig"`
	// SSLClientCertificateID is the ID of a [ClientCertificate]. It is
	// required when SSLConfig.ClientCertificateMode is
	// [SSLClientCertificateModeExplicit].
	SSLClientCertificateID *string     `json:"sslClientCertificateId"`
	Assertions             []Assertion `json:"assertions,omitempty"`
}

SSLRequest is the connection of an SSLMonitor. The API requires SSLConfig, so it is a value rather than a pointer.

type ScriptDependency

type ScriptDependency struct {
	Path    string `json:"path"`
	Content string `json:"content"`
}

ScriptDependency is a file attached to the script of a BrowserCheck or MultiStepCheck. The API silently drops a dependency whose Path is empty or longer than 1000 characters, or whose Content is empty.

type SecurityBaseline

type SecurityBaseline struct {
	// Enabled defaults to true, but an update that sets a MinTLSVersion or
	// MinKeySizeBits value with a nil Enabled stores none, and the baseline
	// then runs disabled; set Enabled explicitly.
	Enabled *bool `json:"enabled,omitempty"`
	// Enforceable rules, with the default severity
	// [SSLBaselineSeverityFail]. The defaults for MinTLSVersion and
	// MinKeySizeBits are [TLSVersion12] and 2048.
	MinTLSVersion          *SSLBaselineTLSRule      `json:"minTLSVersion,omitempty"`
	MinKeySizeBits         *SSLBaselineKeySizeRule  `json:"minKeySizeBits,omitempty"`
	WeakSignatureAlgorithm *SSLBaselineSeverityRule `json:"weakSignatureAlgorithm,omitempty"`
	WeakCipherSuite        *SSLBaselineSeverityRule `json:"weakCipherSuite,omitempty"`
	KnownBadCA             *SSLBaselineSeverityRule `json:"knownBadCA,omitempty"`
	// Advisory rules, with the default severity
	// [SSLBaselineSeverityIgnore]. The defaults for RecommendedTLSVersion
	// and RecommendedKeySizeBits are [TLSVersion13] and 3072.
	RecommendedTLSVersion   *SSLBaselineTLSRule      `json:"recommendedTLSVersion,omitempty"`
	RecommendedKeySizeBits  *SSLBaselineKeySizeRule  `json:"recommendedKeySizeBits,omitempty"`
	OCSPMustStapleRespected *SSLBaselineSeverityRule `json:"ocspMustStapleRespected,omitempty"`
	SCTPresent              *SSLBaselineSeverityRule `json:"sctPresent,omitempty"`
}

SecurityBaseline is the set of TLS rules in SSLConfig that an SSL monitor enforces or reports on, each with a severity. Set it only to override the API defaults, which apply on create to the rules and values left unset. An update replaces the stored baseline as a whole.

type SlackIntegrationNotConnectedError added in v2.4.0

type SlackIntegrationNotConnectedError struct {
	*APIError
}

SlackIntegrationNotConnectedError is returned for a Slack App alert channel write on an account without a connected Slack workspace. It matches ErrSlackIntegrationNotConnected and ErrBadRequest, and errors.As finds the embedded *APIError too. Unlike the *APIError, its text leaves out the request and the response, as the failure is a setting of the account and the text says how to fix it.

func (*SlackIntegrationNotConnectedError) Error added in v2.4.0

func (*SlackIntegrationNotConnectedError) Unwrap added in v2.4.0

Unwrap returns the embedded *APIError.

type Snippet

type Snippet struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Script    string    `json:"script"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Snippet is a reusable piece of Node.js code: a setup or teardown script that checks and groups refer to by ID (SetupSnippetID, TearDownSnippetID), or a partial for browser checks. It is the input and result of CreateSnippet and UpdateSnippet, which both require Name and Script.

type StaticIP

type StaticIP struct {
	Region  string
	Address netip.Prefix
}

StaticIP is one of the public IP addresses or ranges that Checkly runs checks from, as returned by GetStaticIPs. Region is a location code such as "us-east-1". Address is an IPv6 range, or an IPv4 address as a /32 prefix. See https://www.checklyhq.com/docs/monitoring/allowlisting/#ip-range-allowlisting.

type StatusPage deprecated

type StatusPage struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`

	// URL is the unique subdomain of the status page. The API stores it in
	// lowercase.
	URL string `json:"url"`

	// CustomDomain is an optional user-managed domain that hosts the status
	// page; empty removes it.
	CustomDomain string `json:"customDomain,omitempty"`

	Logo string `json:"logo"`

	// RedirectTo is the URL the user should be redirected to when clicking
	// the logo.
	RedirectTo string `json:"redirectTo"`

	// Favicon is a URL to an image file to use as the favicon of the status
	// page.
	Favicon string `json:"favicon"`

	// An empty DefaultTheme means [StatusPageThemeAuto], also on update.
	DefaultTheme StatusPageTheme `json:"defaultTheme,omitempty"`

	Cards []StatusPageCard `json:"cards"`
}

StatusPage is a v1 status page, which shows StatusPageService entries grouped into cards. It is the input and result of CreateStatusPage and UpdateStatusPage, which both require Name, URL and Cards.

Deprecated: Use StatusPageV3 instead. The public API cannot migrate a v1 status page to v3, so this type remains for existing v1 pages.

type StatusPageAutomationRuleComponentV3

type StatusPageAutomationRuleComponentV3 struct {
	ComponentID string `json:"componentId"`

	// TargetImpact is the impact set on the component while the automated
	// incident is open.
	TargetImpact StatusPageTargetImpactV3 `json:"targetImpact"`
}

StatusPageAutomationRuleComponentV3 links an automation rule to a component of the same status page, with the impact an automated incident sets on it.

type StatusPageAutomationRuleV3

type StatusPageAutomationRuleV3 struct {
	ID string `json:"id,omitempty"`

	// StatusPageID is the identifier of the v3 status page the rule belongs
	// to. It is read-only: on writes the page is addressed through the URL
	// path instead.
	StatusPageID string `json:"statusPageId,omitempty"`

	Name string `json:"name"`

	// Enabled determines whether the rule may open incidents. A disabled
	// rule never opens incidents.
	Enabled bool `json:"enabled"`

	// FirstUpdate is the body of the status update that opens the incident.
	FirstUpdate string `json:"firstUpdate"`

	// LastUpdate is the body of the status update that resolves the
	// incident.
	LastUpdate string `json:"lastUpdate"`

	// NotifySubscribers determines whether subscribers are notified of the
	// automated updates.
	NotifySubscribers bool `json:"notifySubscribers"`

	// CoolDownWindowMinutes is the minimum number of minutes after an
	// automated incident before this rule may open the next one. 0 disables
	// the cool down.
	CoolDownWindowMinutes int `json:"coolDownWindowMinutes"`

	// Tags is the list of tags the rule matches on. A failing check matches
	// when it, or its group, carries ANY of these tags.
	Tags []string `json:"tags"`

	// Components is the list of components an automated incident impacts,
	// with the impact each gets.
	Components []StatusPageAutomationRuleComponentV3 `json:"components,omitempty"`
}

StatusPageAutomationRuleV3 represents an automation rule of a v3 status page. When a check whose tags overlap with the rule's tags fails, Checkly opens one incident on the page impacting the listed components, and resolves it when the check recovers.

type StatusPageCard deprecated

type StatusPageCard struct {
	Name string `json:"name"`

	// Services lists the services shown in the card. Create and update
	// requests refer to existing services by ID; see
	// CreateStatusPageService.
	Services []StatusPageService `json:"services"`
}

StatusPageCard is a card of a v1 status page, in StatusPage.Cards: a named group of services.

Deprecated: Use a StatusPageComponentV3 of type StatusPageComponentV3TypeGroup instead. The public API cannot migrate a v1 status page to v3, so this type remains for existing v1 pages.

type StatusPageComponentStatusV3

type StatusPageComponentStatusV3 string

StatusPageComponentStatusV3 is the status a v3 status page component shows, in MaintenanceWindowComponentImpact.Status.

const (
	StatusPageComponentStatusV3Operational         StatusPageComponentStatusV3 = "OPERATIONAL"
	StatusPageComponentStatusV3UnderMaintenance    StatusPageComponentStatusV3 = "UNDER_MAINTENANCE"
	StatusPageComponentStatusV3DegradedPerformance StatusPageComponentStatusV3 = "DEGRADED_PERFORMANCE"
	StatusPageComponentStatusV3PartialOutage       StatusPageComponentStatusV3 = "PARTIAL_OUTAGE"
	StatusPageComponentStatusV3MajorOutage         StatusPageComponentStatusV3 = "MAJOR_OUTAGE"
)

Component statuses, the values of MaintenanceWindowComponentImpact.Status.

type StatusPageComponentV3

type StatusPageComponentV3 struct {
	ID string `json:"id,omitempty"`

	// StatusPageID is the identifier of the v3 status page the component
	// belongs to. It is read-only: on writes the page is addressed through
	// the URL path instead.
	StatusPageID string `json:"statusPageId,omitempty"`

	// An empty Type means [StatusPageComponentV3TypeService], also on update.
	Type StatusPageComponentV3Type `json:"type,omitempty"`

	// Name is the name shown on the status page.
	Name string `json:"name"`

	// Description is an optional description shown next to the name.
	Description string `json:"description,omitempty"`

	// DisplayOrder is the position among siblings; lower comes first.
	DisplayOrder int `json:"displayOrder"`

	// Hidden hides the component from the public page while keeping it
	// available for incidents and automation.
	Hidden bool `json:"hidden"`

	// Configuration holds the component's type-specific settings. Nil means
	// the defaults of the component's type, also on update.
	Configuration *StatusPageComponentV3Configuration `json:"configuration,omitempty"`

	// ParentID is the identifier of the GROUP component this component sits
	// under. It must belong to the same status page.
	ParentID string `json:"parentId,omitempty"`
}

StatusPageComponentV3 represents a component of a v3 status page: either a SERVICE (a monitored thing with its own status) or a GROUP (a container for other components).

type StatusPageComponentV3Configuration

type StatusPageComponentV3Configuration struct {
	// ShowHistoricalData shows the historical status (the uptime bar) of
	// the component on the status page. Defaults to true.
	ShowHistoricalData *bool `json:"showHistoricalData,omitempty"`

	// ExpandedByDefault renders the group expanded when the status page
	// loads. GROUP components only. Defaults to false.
	ExpandedByDefault *bool `json:"expandedByDefault,omitempty"`
}

StatusPageComponentV3Configuration holds a component's type-specific settings. A SERVICE component only supports ShowHistoricalData; a GROUP component supports both. Unset (nil) properties take the type's default on writes; the API rejects a property the component's type does not support. Reads always return every property the type supports.

type StatusPageComponentV3Type

type StatusPageComponentV3Type string

StatusPageComponentV3Type is the type of a v3 status page component, in StatusPageComponentV3.Type.

const (
	StatusPageComponentV3TypeService StatusPageComponentV3Type = "SERVICE"
	StatusPageComponentV3TypeGroup   StatusPageComponentV3Type = "GROUP"
)

Component types, the values of StatusPageComponentV3.Type: a SERVICE has a status of its own, a GROUP contains other components.

type StatusPageService deprecated

type StatusPageService struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`
}

StatusPageService is a service of the v1 status pages: something whose status a card shows and that incidents affect, as IncidentTrigger.ServiceID refers to it. It is the input and result of CreateStatusPageService and UpdateStatusPageService, which both require only Name.

Deprecated: Use StatusPageComponentV3 instead. The public API cannot migrate a v1 status page to v3, so this type remains for existing v1 pages. IncidentTrigger.ServiceID takes only v1 services, not component IDs: v3 pages automate incidents with StatusPageAutomationRuleV3.

type StatusPageTargetImpactV3

type StatusPageTargetImpactV3 string

StatusPageTargetImpactV3 is the impact an automated incident sets on a component: every component status except OPERATIONAL.

const (
	StatusPageTargetImpactV3UnderMaintenance    StatusPageTargetImpactV3 = "UNDER_MAINTENANCE"
	StatusPageTargetImpactV3DegradedPerformance StatusPageTargetImpactV3 = "DEGRADED_PERFORMANCE"
	StatusPageTargetImpactV3PartialOutage       StatusPageTargetImpactV3 = "PARTIAL_OUTAGE"
	StatusPageTargetImpactV3MajorOutage         StatusPageTargetImpactV3 = "MAJOR_OUTAGE"
)

Target impacts, the values of StatusPageAutomationRuleComponentV3.TargetImpact.

type StatusPageTheme

type StatusPageTheme string

StatusPageTheme is the default color theme of a status page, in StatusPage.DefaultTheme and StatusPageV3.DefaultTheme.

const (
	StatusPageThemeAuto  StatusPageTheme = "AUTO"
	StatusPageThemeDark  StatusPageTheme = "DARK"
	StatusPageThemeLight StatusPageTheme = "LIGHT"
)

Status page themes, the values of StatusPage.DefaultTheme and StatusPageV3.DefaultTheme.

type StatusPageV3

type StatusPageV3 struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`

	// URL is the unique subdomain of the status page.
	URL string `json:"url"`

	// CustomDomain is an optional user-managed domain that hosts the status
	// page.
	CustomDomain string `json:"customDomain"`

	// Description is a short description shown on the status page.
	Description string `json:"description"`

	Logo string `json:"logo"`

	// LogoDark is a URL to an image file to use as the logo in dark mode.
	LogoDark string `json:"logoDark"`

	// RedirectTo is the URL the user should be redirected to when clicking
	// the logo.
	RedirectTo string `json:"redirectTo"`

	// Favicon is a URL to an image file to use as the favicon of the status
	// page.
	Favicon string `json:"favicon"`

	// An empty DefaultTheme means [StatusPageThemeAuto], also on update.
	DefaultTheme StatusPageTheme `json:"defaultTheme,omitempty"`

	// PrivacyPolicyLink is a link to a privacy policy, shown in the page
	// footer.
	PrivacyPolicyLink string `json:"privacyPolicyLink"`

	// TermsOfServiceLink is a link to terms of service, shown in the page
	// footer.
	TermsOfServiceLink string `json:"termsOfServiceLink"`

	// SupportLink is a support contact link, shown in the page footer. It
	// accepts http, https and mailto URLs.
	SupportLink string `json:"supportLink"`

	// FooterText is free-form footer text.
	FooterText string `json:"footerText"`

	// GoogleAnalyticsTag is a Google Analytics tag ID (e.g. "G-XXXXXXXXXX")
	// to embed on the public page.
	GoogleAnalyticsTag string `json:"googleAnalyticsTag"`

	// AllowIndexing determines whether search engines may index the public
	// page.
	AllowIndexing bool `json:"allowIndexing"`

	// ThemeColors are custom colors for the light and dark theme of the
	// page. Setting them requires custom theme colors to be part of the
	// account's plan; the API rejects them otherwise. A nil value clears
	// the custom colors on writes. Reads always return a complete palette:
	// the stored colors, or the defaults when none are stored or the plan
	// does not include them. A page that was read therefore cannot be sent
	// back unchanged: set ThemeColors to nil, or to the colors that should
	// be stored, before updating it, or the defaults are stored as custom
	// colors (and rejected on plans without them).
	ThemeColors *StatusPageV3ThemeColors `json:"themeColors"`
}

StatusPageV3 is a v3 (components-based) status page. Unlike StatusPage, a v3 page has no cards or services: its structure is managed through StatusPageComponentV3 resources, and incidents can be automated with StatusPageAutomationRuleV3 resources.

type StatusPageV3ThemeColorGroup

type StatusPageV3ThemeColorGroup struct {
	// BodyBackgroundColor is the background of the page.
	BodyBackgroundColor string `json:"bodyBackgroundColor"`

	// HeaderBackgroundColor is the background of the page header.
	HeaderBackgroundColor string `json:"headerBackgroundColor"`

	// HeaderFontColor is the color of text in the page header.
	HeaderFontColor string `json:"headerFontColor"`

	// TitleFontColor is the color of titles and headings.
	TitleFontColor string `json:"titleFontColor"`

	// BodyFontColor is the color of regular body text.
	BodyFontColor string `json:"bodyFontColor"`

	// BodyFontColorMuted is the color of de-emphasized body text, such as
	// timestamps.
	BodyFontColorMuted string `json:"bodyFontColorMuted"`

	// NavigationFontColor is the color of navigation links.
	NavigationFontColor string `json:"navigationFontColor"`

	// LinkFontColor is the color of links in the page content.
	LinkFontColor string `json:"linkFontColor"`

	// CardBackgroundColor is the background of component and incident
	// cards.
	CardBackgroundColor string `json:"cardBackgroundColor"`

	// BorderColor is the color of borders and dividers.
	BorderColor string `json:"borderColor"`

	// PrimaryButtonBackgroundColor is the background of primary buttons,
	// such as "Subscribe".
	PrimaryButtonBackgroundColor string `json:"primaryButtonBackgroundColor"`

	// PrimaryButtonFontColor is the color of text on primary buttons.
	PrimaryButtonFontColor string `json:"primaryButtonFontColor"`
}

StatusPageV3ThemeColorGroup holds the colors of one theme of a v3 status page. Each color is a hex string such as "#FF0000" or "#F00".

type StatusPageV3ThemeColors

type StatusPageV3ThemeColors struct {
	// Light are the colors used when the page renders in light mode.
	Light StatusPageV3ThemeColorGroup `json:"light"`

	// Dark are the colors used when the page renders in dark mode.
	Dark StatusPageV3ThemeColorGroup `json:"dark"`
}

StatusPageV3ThemeColors holds the custom colors of a v3 status page, one group per theme. The API requires both groups, with every color set, when custom colors are given.

type TCPMonitor

type TCPMonitor struct {
	// ID is the monitor's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 0, 1, 2, 5, 10, 15,
	// 30, 60, 120, 180, 360, 720 or 1440.
	Frequency int `json:"frequency"`
	// FrequencyOffset is 10, 20 or 30 when Frequency is 0, for a run every
	// that many seconds. For any other Frequency the API picks the offset
	// itself and keeps it until Frequency changes: a value sent has no
	// effect, and the value read back is the API's. The API still rejects a
	// value above Frequency * 10 for a Frequency up to 60, or above
	// Frequency / 5 rounded up for a higher one. With Frequency 0, an update
	// with a zero FrequencyOffset keeps the stored offset.
	FrequencyOffset int  `json:"frequencyOffset,omitempty"`
	Activated       bool `json:"activated"`
	// Muted stops notifications when the monitor fails or recovers.
	Muted bool `json:"muted"`
	// ShouldFail inverts the result: a run that would fail passes, and the
	// other way around.
	ShouldFail bool `json:"shouldFail"`
	// RunParallel runs the monitor in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// DegradedResponseTime and MaxResponseTime are the degraded and failing
	// response time limits in milliseconds, each at most 45000.
	DegradedResponseTime int      `json:"degradedResponseTime,omitempty"`
	MaxResponseTime      int      `json:"maxResponseTime,omitempty"`
	Tags                 []string `json:"tags,omitempty"`
	// AlertSettings nil means the API's default settings on create, and an
	// update with nil keeps the stored settings.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool       `json:"useGlobalAlertSettings"`
	Request                TCPRequest `json:"request"`
	// GroupID is the ID of the check group the monitor belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the monitor's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// monitor's alerts. The SDK disables automatic assignment, so an
	// empty list leaves the monitor without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from.
	PrivateLocations *[]string `json:"privateLocations"`
	// RuntimeID is the runtime version, such as "2025.04".
	RuntimeID *string `json:"runtimeId"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the monitor open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
}

TCPMonitor connects to a host and port over TCP, optionally sends data, and checks the response against its assertions. It is the input of Client.CreateTCPMonitor and Client.UpdateTCPMonitor, and is returned by Client.GetTCPMonitor.

type TCPRequest

type TCPRequest struct {
	Hostname string `json:"hostname"`
	Port     uint16 `json:"port"`
	// Data is sent to the server after the connection is established.
	Data       string      `json:"data,omitempty"`
	Assertions []Assertion `json:"assertions,omitempty"`
	// An update with an empty IPFamily keeps the stored family, as the API
	// rejects an empty value.
	IPFamily IPFamily `json:"ipFamily,omitempty"`
}

TCPRequest is the connection of a TCPMonitor.

type TLSVersion

type TLSVersion string

TLSVersion is a TLS protocol version, in the Value of SSLBaselineTLSRule.

const (
	TLSVersion12 TLSVersion = "TLS1.2"
	TLSVersion13 TLSVersion = "TLS1.3"
)

TLS versions, the values of SSLBaselineTLSRule.Value.

type TimeBasedEscalation

type TimeBasedEscalation struct {
	// MinutesFailingThreshold is the number of minutes after a check starts
	// failing that an alert is sent: 5, 10, 15 or 30.
	MinutesFailingThreshold int `json:"minutesFailingThreshold,omitempty"`
}

TimeBasedEscalation holds the threshold of the EscalationTypeTimeBased escalation type.

type TracerouteCheckResponse

type TracerouteCheckResponse struct {
	Hostname           string                   `json:"hostname,omitempty"`
	ResolvedIP         string                   `json:"resolvedIp,omitempty"`
	TotalHops          int                      `json:"totalHops,omitempty"`
	DestinationReached bool                     `json:"destinationReached,omitempty"`
	TruncationReason   string                   `json:"truncationReason,omitempty"`
	FinalHopLatency    map[string]interface{}   `json:"finalHopLatency,omitempty"`
	Hops               []map[string]interface{} `json:"hops,omitempty"`
	Protocol           string                   `json:"protocol,omitempty"`
	ProbeProtocol      string                   `json:"probeProtocol,omitempty"`
}

TracerouteCheckResponse is the detailed response of a traceroute monitor run.

type TracerouteCheckResult

type TracerouteCheckResult struct {
	TotalHops          *int                     `json:"totalHops,omitempty"`
	DestinationReached *bool                    `json:"destinationReached,omitempty"`
	FinalHopLatency    map[string]interface{}   `json:"finalHopLatency,omitempty"`
	TimingPhases       map[string]interface{}   `json:"timingPhases,omitempty"`
	RequestError       *string                  `json:"requestError,omitempty"`
	Request            map[string]interface{}   `json:"request,omitempty"`
	Assertions         []map[string]interface{} `json:"assertions,omitempty"`
	Response           *TracerouteCheckResponse `json:"response,omitempty"`
}

TracerouteCheckResult holds the diagnostics of a traceroute monitor run.

type TracerouteMonitor

type TracerouteMonitor struct {
	// ID is the monitor's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 0, 1, 2, 5, 10, 15,
	// 30, 60, 120, 180, 360, 720 or 1440.
	Frequency int `json:"frequency"`
	// FrequencyOffset is 10, 20 or 30 when Frequency is 0, for a run every
	// that many seconds. For any other Frequency the API picks the offset
	// itself and keeps it until Frequency changes: a value sent has no
	// effect, and the value read back is the API's. The API still rejects a
	// value above Frequency * 10 for a Frequency up to 60, or above
	// Frequency / 5 rounded up for a higher one. With Frequency 0, an update
	// with a zero FrequencyOffset keeps the stored offset.
	FrequencyOffset int  `json:"frequencyOffset,omitempty"`
	Activated       bool `json:"activated"`
	// Muted stops notifications when the monitor fails or recovers.
	Muted bool `json:"muted"`
	// ShouldFail inverts the result: a run that would fail passes, and the
	// other way around.
	ShouldFail bool `json:"shouldFail"`
	// RunParallel runs the monitor in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// DegradedResponseTime and MaxResponseTime are the degraded and failing
	// response time limits in milliseconds, each at most 30000; the API
	// defaults them to 10000 and 20000. Zero means the API default on
	// create, and an update with zero keeps the stored value. To store no
	// failing limit, set NoMaxResponseTime instead.
	DegradedResponseTime int `json:"degradedResponseTime,omitempty"`
	MaxResponseTime      int `json:"maxResponseTime,omitempty"`
	// NoMaxResponseTime stores no failing response time limit: the monitor
	// never fails on latency, and DegradedResponseTime may be any value up
	// to 30000.
	// Creating or updating a monitor with NoMaxResponseTime and a non-zero
	// MaxResponseTime fails without sending the request. A monitor read
	// from the API has NoMaxResponseTime set when it has no limit, so a
	// read, modify and update keeps it.
	//
	// It is a separate flag rather than a pointer MaxResponseTime so that
	// code setting MaxResponseTime as an int keeps compiling, and a zero
	// MaxResponseTime keeps meaning the API's default on create and the
	// stored limit on update.
	//
	// The flag is carried by the SDK's own create and update requests and
	// by decoding API responses, but not by a plain json.Marshal of a
	// TracerouteMonitor, which leaves it out. TracerouteMonitor has no
	// MarshalJSON on purpose: the request payloads embed it, so such a
	// method would be promoted to them and replace their encoding.
	NoMaxResponseTime bool     `json:"-"`
	Tags              []string `json:"tags,omitempty"`
	// AlertSettings nil means the API's default settings on create, and an
	// update with nil keeps the stored settings.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool              `json:"useGlobalAlertSettings"`
	Request                TracerouteRequest `json:"request"`
	// GroupID is the ID of the check group the monitor belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the monitor's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// monitor's alerts. The SDK disables automatic assignment, so an
	// empty list leaves the monitor without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from. The Checkly agent
	// at those locations must be version 8.4.0 or later and have the NET_RAW
	// capability.
	PrivateLocations *[]string `json:"privateLocations"`
	// RuntimeID is the runtime version, such as "2025.04".
	RuntimeID *string `json:"runtimeId"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the monitor open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
}

TracerouteMonitor traces the network path to a host and checks the response time, hop count and packet loss against its assertions. It is the input of Client.CreateTracerouteMonitor and Client.UpdateTracerouteMonitor, and is returned by Client.GetTracerouteMonitor.

func (*TracerouteMonitor) UnmarshalJSON added in v2.4.0

func (m *TracerouteMonitor) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a monitor and sets NoMaxResponseTime when maxResponseTime is 0, the API's value for no failing response time limit.

type TracerouteProtocol

type TracerouteProtocol string

TracerouteProtocol is the protocol of a traceroute monitor's probes, in TracerouteRequest.Protocol.

const (
	TracerouteProtocolTCP  TracerouteProtocol = "TCP"
	TracerouteProtocolICMP TracerouteProtocol = "ICMP"
	TracerouteProtocolUDP  TracerouteProtocol = "UDP"
	TracerouteProtocolSCTP TracerouteProtocol = "SCTP"
)

Traceroute protocols, the values of TracerouteRequest.Protocol. The API default is TracerouteProtocolTCP.

type TracerouteRequest

type TracerouteRequest struct {
	URL string `json:"url"`
	// An empty Protocol means [TracerouteProtocolTCP].
	Protocol TracerouteProtocol `json:"protocol,omitempty"`
	// Port is 1 to 65535; zero means 443 for TCP and 33434 for UDP and SCTP.
	// It is ignored when Protocol is [TracerouteProtocolICMP].
	Port int `json:"port,omitempty"`
	// An update with an empty IPFamily keeps the stored family, as the API
	// rejects an empty value.
	IPFamily IPFamily `json:"ipFamily,omitempty"`
	// MaxHops is 1 to 64; zero means 30.
	MaxHops int `json:"maxHops,omitempty"`
	// MaxUnknownHops is 1 to 30 and at most MaxHops; zero means 15, or
	// MaxHops if that is lower.
	MaxUnknownHops int `json:"maxUnknownHops,omitempty"`
	// PtrLookup nil means the API's default, true, on create, and an update
	// with nil keeps the stored setting.
	PtrLookup *bool `json:"ptrLookup,omitempty"`
	// Timeout is 1 to 30; zero means 10.
	Timeout    int         `json:"timeout,omitempty"`
	Assertions []Assertion `json:"assertions,omitempty"`
}

TracerouteRequest is the probe of a TracerouteMonitor.

func (TracerouteRequest) MarshalJSON

func (r TracerouteRequest) MarshalJSON() ([]byte, error)

MarshalJSON leaves out Port when Protocol is TracerouteProtocolICMP, as the API ignores the port of an ICMP traceroute.

type URLMonitor

type URLMonitor struct {
	// ID is the monitor's UUID, assigned by the API.
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	// Frequency is the number of minutes between runs: 0, 1, 2, 5, 10, 15,
	// 30, 60, 120, 180, 360, 720 or 1440.
	Frequency int `json:"frequency"`
	// FrequencyOffset is 10, 20 or 30 when Frequency is 0, for a run every
	// that many seconds. For any other Frequency the API picks the offset
	// itself and keeps it until Frequency changes: a value sent has no
	// effect, and the value read back is the API's. The API still rejects a
	// value above Frequency * 10 for a Frequency up to 60, or above
	// Frequency / 5 rounded up for a higher one. With Frequency 0, an update
	// with a zero FrequencyOffset keeps the stored offset.
	FrequencyOffset int  `json:"frequencyOffset,omitempty"`
	Activated       bool `json:"activated"`
	// Muted stops notifications when the monitor fails or recovers.
	Muted bool `json:"muted"`
	// ShouldFail inverts the result: a run that would fail passes, and the
	// other way around.
	ShouldFail bool `json:"shouldFail"`
	// RunParallel runs the monitor in all its locations in parallel.
	RunParallel bool `json:"runParallel"`
	// Locations are the public locations to run from, as region codes such
	// as "us-east-1".
	Locations []string `json:"locations"`
	// DegradedResponseTime and MaxResponseTime are the degraded and failing
	// response time limits in milliseconds, each at most 45000.
	DegradedResponseTime int      `json:"degradedResponseTime,omitempty"`
	MaxResponseTime      int      `json:"maxResponseTime,omitempty"`
	Tags                 []string `json:"tags,omitempty"`
	// AlertSettings nil means the API's default settings on create, and an
	// update with nil keeps the stored settings.
	AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
	// UseGlobalAlertSettings applies the account's alert settings instead
	// of AlertSettings.
	UseGlobalAlertSettings bool       `json:"useGlobalAlertSettings"`
	Request                URLRequest `json:"request"`
	// GroupID is the ID of the check group the monitor belongs to; 0 means
	// none.
	GroupID int64 `json:"groupId,omitempty"`
	// GroupOrder is the monitor's position in its group, which sets the run
	// order when the group is triggered from the API or CI/CD. 0 is the
	// first position. Nil means no position.
	GroupOrder *int `json:"groupOrder"`
	// AlertChannelSubscriptions are the alert channels that receive the
	// monitor's alerts. The SDK disables automatic assignment, so an
	// empty list leaves the monitor without any.
	AlertChannelSubscriptions []AlertChannelSubscription `json:"alertChannelSubscriptions,omitempty"`
	// PrivateLocations are the slug names of the account's private
	// locations to run from.
	PrivateLocations *[]string `json:"privateLocations"`
	// RetryStrategy sets how failed runs are retried; nil disables retries.
	// In a group whose RetryStrategy is not [RetryStrategyTypeFallback], the
	// group's strategy applies instead.
	RetryStrategy *RetryStrategy `json:"retryStrategy"`
	// TriggerIncident makes the monitor open and resolve an incident on a
	// status page service, based on its alert configuration. Nil turns it
	// off.
	TriggerIncident *IncidentTrigger `json:"triggerIncident"`
	CreatedAt       time.Time        `json:"created_at,omitempty"`
	UpdatedAt       time.Time        `json:"updated_at,omitempty"`
}

URLMonitor requests a URL with GET and checks the response status code against its assertions. It is the input of Client.CreateURLMonitor and Client.UpdateURLMonitor, and is returned by Client.GetURLMonitor.

type URLRequest

type URLRequest struct {
	URL             string      `json:"url"`
	FollowRedirects bool        `json:"followRedirects"`
	SkipSSL         bool        `json:"skipSSL"`
	Assertions      []Assertion `json:"assertions"`
	// An update with an empty IPFamily keeps the stored family, as the API
	// rejects an empty value.
	IPFamily IPFamily `json:"ipFamily,omitempty"`
}

URLRequest is the request of a URLMonitor, which always uses the method GET. It has no headers, and an update keeps headers set on the monitor in the web app or through the API.

type UnresolvableSlackDestinationsError added in v2.7.0

type UnresolvableSlackDestinationsError struct {
	*APIError
	// Destinations are the unresolved channels and handles, from the details
	// field of the response. It is nil when the details have another shape.
	Destinations []UnresolvedSlackDestination
}

UnresolvableSlackDestinationsError is returned for a Slack App alert channel write that names #channels or @handles the connected Slack workspace could not resolve. It matches ErrUnresolvableSlackDestinations and ErrBadRequest, and errors.As finds the embedded *APIError too. Its text names the channels and handles and why each failed, and leaves out the request and the response.

func (*UnresolvableSlackDestinationsError) Error added in v2.7.0

func (*UnresolvableSlackDestinationsError) Unwrap added in v2.7.0

Unwrap returns the embedded *APIError.

type UnresolvableSlackHandlesError added in v2.4.0

type UnresolvableSlackHandlesError struct {
	*APIError
	// Handles are the unresolved handles, from the details field of the
	// response. It is nil when the details have another shape.
	Handles []UnresolvedSlackHandle
}

UnresolvableSlackHandlesError is returned for a Slack App alert channel write that names @handles the connected Slack workspace could not resolve. It matches ErrUnresolvableSlackHandles and ErrBadRequest, and errors.As finds the embedded *APIError too, so code that only handles *APIError keeps working. Its text names the handles and why each failed, and leaves out the request and the response.

func (*UnresolvableSlackHandlesError) Error added in v2.4.0

func (*UnresolvableSlackHandlesError) Unwrap added in v2.4.0

Unwrap returns the embedded *APIError.

type UnresolvedSlackDestination added in v2.7.0

type UnresolvedSlackDestination struct {
	// Entry is the channel or handle as the alert channel names it, such as
	// "#alerts" or "@alice".
	Entry string `json:"entry"`
	// Reason is the API's reason: "channel_not_found" for a channel the
	// workspace does not list, which may be archived, or private without the
	// Checkly app invited; "handle_not_found" when no member has the handle,
	// "handle_ambiguous" when several do, and "handle_reserved" for
	// @everyone, @here and @channel.
	Reason string `json:"reason"`
}

UnresolvedSlackDestination is a #channel or @handle of a Slack App alert channel that the connected Slack workspace could not resolve, in UnresolvableSlackDestinationsError.Destinations.

type UnresolvedSlackHandle added in v2.4.0

type UnresolvedSlackHandle struct {
	// Handle is the handle as the alert channel names it, such as "@alice".
	Handle string `json:"handle"`
	// Reason is the API's reason: "handle_not_found" when no member has the
	// handle, "handle_ambiguous" when several do, and "handle_reserved" for
	// @everyone, @here and @channel.
	Reason string `json:"reason"`
}

UnresolvedSlackHandle is a Slack @handle of a Slack App alert channel that the connected Slack workspace could not resolve to a single member, in UnresolvableSlackHandlesError.Handles.

type UnsupportedCheckTypeError

type UnsupportedCheckTypeError struct {
	// ID is the check's UUID.
	ID string
	// Type is the check type the API returned.
	Type CheckType
}

UnsupportedCheckTypeError is returned by GetCheck for a check of a type the SDK has no resource type for, such as CheckTypeAgentic. It matches ErrUnsupportedCheckType. It is not an *APIError: the API answered successfully.

func (*UnsupportedCheckTypeError) Error

func (e *UnsupportedCheckTypeError) Error() string

func (*UnsupportedCheckTypeError) Unwrap

func (e *UnsupportedCheckTypeError) Unwrap() error

Unwrap returns ErrUnsupportedCheckType.

type UploadCodeBundleOptions

type UploadCodeBundleOptions struct {
	// ChecksumSha256, when set, is the hex-encoded SHA-256 digest of the
	// bundle, sent with the upload and stored with it.
	ChecksumSha256 string
}

UploadCodeBundleOptions are the options of Client.UploadCodeBundle.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL