tickstem/uptime

May 5, 2026 · View on GitHub

Go Reference Go Report Card codecov

Go SDK for Tickstem — HTTP uptime monitoring with SSL expiry alerts and response assertions.

Install

go get github.com/tickstem/uptime

Quick start

package main

import (
    "context"
    "fmt"
    "log"
    "os"

    "github.com/tickstem/uptime"
)

func main() {
    client := uptime.New(os.Getenv("TICKSTEM_API_KEY"))

    monitor, err := client.Create(context.Background(), uptime.CreateParams{
        Name: "Production API",
        URL:  "https://api.yourapp.com/health",
    })
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(monitor.ID)     // use to retrieve checks later
    fmt.Println(monitor.Status) // "active"
}

Get your API key at app.tickstem.dev.

Usage

Create a client

// Minimal — uses https://api.tickstem.dev/v1
client := uptime.New(os.Getenv("TICKSTEM_API_KEY"))

// With options
client := uptime.New(apiKey,
    uptime.WithBaseURL("http://localhost:8080/v1"),
)

Create a monitor

monitor, err := client.Create(ctx, uptime.CreateParams{
    Name:         "Production API",
    URL:          "https://api.yourapp.com/health",
    IntervalSecs: 60,   // default: 60, min: 60, max: 86400
    TimeoutSecs:  10,   // default: 10, min: 5, max: 30
})

Add response assertions

Assertions replace the default 2xx/3xx success logic. All must pass for a check to be considered up.

monitor, err := client.Create(ctx, uptime.CreateParams{
    Name: "API health check",
    URL:  "https://api.yourapp.com/health",
    Assertions: []uptime.Assertion{
        {Source: uptime.AssertionSourceStatusCode,   Comparison: uptime.AssertionComparisonEq,  Target: "200"},
        {Source: uptime.AssertionSourceResponseTime, Comparison: uptime.AssertionComparisonLt,  Target: "2000"},
        {Source: uptime.AssertionSourceBody,         Comparison: uptime.AssertionComparisonContains, Target: `"status":"ok"`},
    },
})
SourceValid comparisonsTarget type
status_codeeq ne lt lte gt gteinteger
response_timeeq ne lt lte gt gteinteger (ms)
bodyeq ne contains not_containsstring

Manage monitors

// List all monitors
monitors, err := client.List(ctx)

// Get a single monitor
monitor, err := client.Get(ctx, monitorID)

// Update — only supplied fields are changed
err = client.Update(ctx, monitorID, uptime.UpdateParams{
    IntervalSecs: ptr(300),
})

// Pause / resume
_, err = client.Pause(ctx, monitorID)
_, err = client.Resume(ctx, monitorID)

// Delete
err = client.Delete(ctx, monitorID)

Retrieve check history

checks, err := client.Checks(ctx, monitorID, uptime.ChecksParams{
    Limit:  50,
    Offset: 0,
})
for _, c := range checks {
    fmt.Printf("%s  status=%s  duration=%dms\n", c.CheckedAt, c.Status, c.DurationMs)
    if c.SSLExpiresAt != nil {
        fmt.Printf("  SSL expires: %s\n", *c.SSLExpiresAt)
    }
}

SSL certificate expiry

Tickstem automatically captures SSL certificate expiry on every HTTPS check. When a certificate is within 30 days of expiry you receive an email alert. The Monitor.SSLExpiresAt and MonitorCheck.SSLExpiresAt fields expose the raw expiry timestamp.

Error handling

monitor, err := client.Create(ctx, params)
if err != nil {
    if uptime.IsUnauthorized(err) {
        // invalid or revoked API key
    }
    if uptime.IsQuotaExceeded(err) {
        // monitor quota reached — upgrade at app.tickstem.dev/dashboard/billing
    }
    if uptime.IsNotFound(err) {
        // monitor does not exist or belongs to another account
    }
    var apiErr *uptime.APIError
    if errors.As(err, &apiErr) {
        fmt.Println(apiErr.StatusCode, apiErr.Message)
    }
}

Pricing

PlanMonitorsMin intervalPrice
Free560 s$0
Starter2060 s$12/mo
Pro10060 s$29/mo
Businessunlimited60 s$79/mo

View full pricing →

License

MIT