{"id":15372729,"url":"https://github.com/bitfield/checkly","last_synced_at":"2025-10-25T06:40:44.101Z","repository":{"id":50653902,"uuid":"185375716","full_name":"bitfield/checkly","owner":"bitfield","description":"A Go library for use with the Checkly API","archived":false,"fork":false,"pushed_at":"2020-08-10T12:16:31.000Z","size":41,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T14:12:50.583Z","etag":null,"topics":["checkly"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitfield.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"bitfield"}},"created_at":"2019-05-07T10:04:01.000Z","updated_at":"2022-07-31T10:50:41.000Z","dependencies_parsed_at":"2022-08-28T15:13:03.692Z","dependency_job_id":null,"html_url":"https://github.com/bitfield/checkly","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfield%2Fcheckly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfield%2Fcheckly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfield%2Fcheckly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfield%2Fcheckly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfield","download_url":"https://codeload.github.com/bitfield/checkly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249085428,"owners_count":21210267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["checkly"],"created_at":"2024-10-01T13:52:57.798Z","updated_at":"2025-10-25T06:40:39.054Z","avatar_url":"https://github.com/bitfield.png","language":"Go","funding_links":["https://github.com/sponsors/bitfield"],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/bitfield/checkly?status.png)](http://godoc.org/github.com/bitfield/checkly)[![Go Report Card](https://goreportcard.com/badge/github.com/bitfield/checkly)](https://goreportcard.com/report/github.com/bitfield/checkly)[![CircleCI](https://circleci.com/gh/bitfield/checkly.svg?style=svg)](https://circleci.com/gh/bitfield/checkly)\n\n# checkly\n\n`checkly` is a Go library for the [Checkly](https://checklyhq.com/?utm_source=github\u0026lmref=1374) website monitoring service. It allows you to create new checks, get data on existing checks, and delete checks.\n\nWhile you can manage your Checkly checks entirely in Go code, using this library, you may prefer to use Terraform. In that case, you can use the Checkly Terraform provider (which in turn uses this library):\n\nhttps://github.com/bitfield/terraform-provider-checkly\n\n## Setting your API key\n\nTo use the client library with your Checkly account, you will need an API Key for the account. Go to the [Account Settings: API Keys page](https://app.checklyhq.com/account/api-keys) and click 'Create API Key'.\n\n## Using the Go library\n\nImport the library using:\n\n```go\nimport \"github.com/bitfield/checkly\"\n```\n\n## Creating a client\n\nCreate a new `Client` object by calling `checkly.NewClient()` with your API key:\n\n```go\napiKey := \"3a4405dfb5894f4580785b40e48e6e10\"\nclient := checkly.NewClient(apiKey)\n```\n\nOr read the key from an environment variable:\n\n```go\nclient := checkly.NewClient(os.Getenv(\"CHECKLY_API_KEY\"))\n```\n\n## Creating a new check\n\nOnce you have a client, you can create a check. First, populate a Check struct with the required parameters:\n\n```go\ncheck := checkly.Check{\n\t\tName:      \"My Awesome Check\",\n\t\tType:      checkly.TypeAPI,\n\t\tFrequency: 5,\n\t\tActivated: true,\n\t\tLocations: []string{\"eu-west-1\"},\n\t\tRequest: checkly.Request{\n\t\t\t    Method: http.MethodGet,\n\t\t\t    URL:    \"http://example.com\",\n\t\t},\n}\n```\n\nNow you can pass it to `client.Create()` to create a check. This returns the ID string of the newly-created check:\n\n```go\nID, err := client.Create(check)\n```\n\n## Retrieving a check\n\n`client.Get(ID)` finds an existing check by ID and returns a Check struct containing its details:\n\n```go\ncheck, err := client.Get(\"87dd7a8d-f6fd-46c0-b73c-b35712f56d72\")\nfmt.Println(check.Name)\n// Output: My Awesome Check\n\n```\n\n## Updating a check\n\n`client.Update(ID, check)` updates an existing check with the specified details. For example, to change the name of a check:\n\n```go\nID := \"87dd7a8d-f6fd-46c0-b73c-b35712f56d72\"\ncheck, err := client.Get(ID)\ncheck.Name = \"My updated check name\"\nclient.Update(ID, check)\n```\n\n## Deleting a check\n\nUse `client.Delete(ID)` to delete a check by ID.\n\n```go\nerr := client.Delete(\"73d29ea2-6540-4bb5-967e-e07fa2c9465e\")\n```\n\n## A complete example program\n\nYou can see an example program which creates a Checkly check in the [examples/demo](examples/demo/main.go) folder.\n\n## Debugging\n\nIf things aren't working as you expect, you can assign an `io.Writer` to `client.Debug` to receive debug output. If `client.Debug` is non-nil, then all API requests and responses will be dumped to the specified writer (for example, `os.Stderr`).\n\nRegardless of the debug setting, if a request fails with HTTP status 400 Bad Request), the full response will be dumped (to standard error if no debug writer is set):\n\n```go\nclient.Debug = os.Stderr\n```\n\nExample request and response dump:\n\n```\nPOST /v1/checks HTTP/1.1\nHost: api.checklyhq.com\nUser-Agent: Go-http-client/1.1\nContent-Length: 852\nAuthorization: Bearer XXX\nContent-Type: application/json\nAccept-Encoding: gzip\n\n{\"id\":\"\",\"name\":\"integrationTestCreate\",\"checkType\":\"API\",\"frequency\":5,\"activated\":true,\"muted\":false,\"shouldFail\":false,\"locations\":[\"eu-west-1\"],\"created_at\":\"0001-01-01T00:00:00Z\",\"updated_at\":\"0001-01-01T00:00:00Z\",\"environment_variables\":null,\"doubleCheck\":false,\"sslCheck\":false,\"sslCheckDomain\":\"example.com\",\"alertSettings\":{\"runBasedEscalation\":{\"failedRunThreshold\":1},\"timeBasedEscalation\":{\"minutesFailingThreshold\":5},\"reminders\":{\"interval\":5},\"sslCertificates\":{\"enabled\":false,\"alertThreshold\":3}},\"useGlobalAlertSettings\":false,\"request\":{\"method\":\"GET\",\"url\":\"http://example.com\",\"followRedirects\":false,\"body\":\"\",\"bodyType\":\"NONE\",\"headers\":[],\"queryParameters\":[],\"assertions\":[{\"edit\":false,\"order\":0,\"arrayIndex\":0,\"arraySelector\":0,\"source\":\"STATUS_CODE\",\"property\":\"\",\"comparison\":\"EQUALS\",\"target\":\"200\"}]}}\n\nHTTP/1.1 201 Created\nTransfer-Encoding: chunked\nCache-Control: no-cache\nConnection: keep-alive\nContent-Type: application/json; charset=utf-8\nDate: Thu, 18 Jul 2019 15:48:21 GMT\nServer: Cowboy\nVary: origin,accept-encoding\nVia: 1.1 vegur\n\n3c8\n{\"name\":\"integrationTestCreate\",\"checkType\":\"API\",\"frequency\":5,\"activated\":true,\"muted\":false,\"shouldFail\":false,\"locations\":[\"eu-west-1\"],\"doubleCheck\":false,\"sslCheck\":false,\"sslCheckDomain\":\"example.com\",\"alertSettings\":{\"runBasedEscalation\":{\"failedRunThreshold\":1},\"timeBasedEscalation\":{\"minutesFailingThreshold\":5},\"reminders\":{\"interval\":5,\"amount\":0},\"sslCertificates\":{\"enabled\":false,\"alertThreshold\":3}},\"useGlobalAlertSettings\":false,\"request\":{\"method\":\"GET\",\"url\":\"http://example.com\",\"followRedirects\":false,\"body\":\"\",\"bodyType\":\"NONE\",\"headers\":[],\"queryParameters\":[],\"assertions\":[{\"source\":\"STATUS_CODE\",\"property\":\"\",\"comparison\":\"EQUALS\",\"target\":\"200\"}],\"basicAuth\":{\"username\":\"\",\"password\":\"f15c6e9c867c529b74b9dd2f9585ba76:1c97b45322f1cd139122666eb13c7562\"}},\"setupSnippetId\":null,\"tearDownSnippetId\":null,\"localSetupScript\":null,\"localTearDownScript\":null,\"created_at\":\"2019-07-18T15:48:21.844Z\",\"id\":\"763fa73d-1d14-4046-88e6-14f883ceddc9\"}\n0\n```\n\n## Bugs and feature requests\n\nIf you find a bug in the `checkly` client or library, please [open an issue](https://github.com/bitfield/checkly/issues). Similarly, if you'd like a feature added or improved, let me know via an issue.\n\nNot all the functionality of the Checkly API is implemented yet.\n\nPull requests welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfield%2Fcheckly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfield%2Fcheckly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfield%2Fcheckly/lists"}