UPTIME

Monitoramento de uptime

Cadastre uma URL, a gente checa ela periodicamente e guarda o histórico. Como o Cron, criar um monitor não checa nada na hora. A checagem acontece depois, num worker separado.

Uptime monitoring

Register a URL, we check it on a schedule and keep the history. Like Cron, creating a monitor doesn't check anything right away. The check happens later, in a separate worker.

ASYNC a resposta confirma, não checa the response confirms, it doesn't run the check

Endpoints

Endpoints

POST/api/v1/uptime/monitors cria um monitorcreates a monitor
GET/api/v1/uptime/monitors lista seus monitoreslists your monitors
GET/api/v1/uptime/monitors/{id} detalhe de um monitora single monitor's detail
PUT/api/v1/uptime/monitors/{id} atualiza um monitorupdates a monitor
DELETE/api/v1/uptime/monitors/{id} remove um monitordeletes a monitor
GET/api/v1/uptime/monitors/{id}/checks histórico de checagenscheck history
GET/api/v1/uptime/worker/status status do worker de checagemcheck worker's status
POST/api/v1/uptime/worker/stop pausa o worker, adminpauses the worker, admin only
POST/api/v1/uptime/worker/start retoma o worker, adminresumes the worker, admin only

Diferente do Cron (onde o histórico de execução é uso administrativo), aqui o histórico de checagens É o produto. Você contratou a API pra ver o uptime do que está monitorando, então /checks é liberado pra qualquer cliente autenticado ver os próprios monitores.

Unlike Cron (where execution history is an administrative concern), here the check history IS the product. You're using the API to see the uptime of what you're monitoring, so /checks is open to any authenticated client for their own monitors.

Campos do monitor

Monitor fields

CampoFieldDescriçãoDescription
namenome do monitorthe monitor's name
urlURL a checar, com http:// ou https://the URL to check, with http:// or https://
methodopcional, padrão "GET": "GET", "HEAD" ou "POST"optional, defaults to "GET": "GET", "HEAD" or "POST"
expected_statusopcional, padrão 200: o código HTTP que conta como "no ar"; qualquer outro (ou erro de conexão) conta como "fora do ar"optional, defaults to 200: the HTTP status that counts as "up"; anything else (or a connection error) counts as "down"
interval_secopcional, padrão 300 (5min): intervalo entre checagens, com piso configurável pra evitar martelar um alvooptional, defaults to 300 (5min): interval between checks, with a configurable floor to avoid hammering a target
timeout_secopcional, padrão 10: tempo máximo esperando resposta antes de contar como falhaoptional, defaults to 10: max time waiting for a response before counting it as a failure

Exemplo

Example

# criar: devolve o monitor com id, não o resultado de checar nada# create: returns the monitor with an id, not the result of checking anything
        curl -X POST https://api.alicercelabs.com.br/api/v1/uptime/monitors \
          -H "Authorization: Bearer <token>" \
          -d '{
            "name": "meu site",
            "url": "https://exemplo.com.br",
            "interval_sec": 300,
            "timeout_sec": 10
          }'
{
          "success": true,
          "data": {
            "id": "cde438c0-...",
            "name": "meu site",
            "url": "https://exemplo.com.br",
            "method": "GET",
            "expected_status": 200,
            "interval_sec": 300,
            "timeout_sec": 10,
            "active": true,
            "last_check_at": null,
            "last_status": "unknown",
            "created_at": "2026-08-22T11:38:41Z"
          },
          "meta": { "elapsed_ms": 4, "request_id": "..." }
        }

Repare em last_status: "unknown": o monitor existe, mas ainda não foi checado. Espere um pouco (o worker tickeia a cada 10s) e consulte GET /monitors/{id}/checks pra ver a primeira checagem.

Note last_status: "unknown": the monitor exists, but hasn't been checked yet. Wait a bit (the worker ticks every 10s) and query GET /monitors/{id}/checks to see the first check.

Por que é assíncrona

Why it's async

Mesmo raciocínio do Cron: o worker de checagem não mantém uma agenda em memória. A cada 10 segundos, ele reconsulta o banco por monitores com interval_sec vencido e checa cada um. Um monitor criado ou editado é simplesmente pego na próxima checagem devida, sem sinal de "recarregar" entre a API e o worker. Sem o worker rodando (GET /worker/status), monitores ficam cadastrados mas nenhum é checado.

Same reasoning as Cron: the check worker doesn't keep a schedule in memory. Every 10 seconds, it re-queries the database for monitors whose interval_sec has elapsed and checks each one. A monitor created or edited is simply picked up on its next due check, with no "reload" signal between the API and the worker. Without the worker running (GET /worker/status), monitors stay registered but none of them get checked.

Erros possíveis

Possible errors

StatusMotivoReason
400campos obrigatórios ausentes, url sem http(s)://, method não suportado, expected_status fora de 100-599, ou interval_sec/timeout_sec fora dos limites configuradosmissing required fields, url without http(s)://, unsupported method, expected_status outside 100-599, or interval_sec/timeout_sec outside the configured bounds
401token ausente ou inválidomissing or invalid token
403worker/stop ou worker/start chamado por conta que não é adminworker/stop or worker/start called by a non-admin account
404monitor não encontrado, ou não pertence a vocêmonitor not found, or it isn't yours
429limite de taxa excedido: cada operação tem cota própriarate limit exceeded: each operation has its own quota

Usando o SDK

Using the SDK

Mesmo padrão do Cron: CRUD do monitor mais controle do daemon que executa as checagens. Campos aceitos em create/update na seção Campos do monitor acima.

Same pattern as Cron: monitor CRUD plus control of the daemon that runs the checks. Fields accepted by create/update are in the Monitor fields section above.

SDKs oficiais: Go · Python · JavaScript.

Official SDKs: Go · Python · JavaScript.

Criar um monitor

Create a monitor

UpTimeMonitor também é um mapa genérico, mesmos campos da tabela acima.

UpTimeMonitor is a generic map too, same fields as the table above.

import (
	"context"
	"fmt"

	alicercelabs "github.com/alicercelabs/alicercesdk-go"
)

client := alicercelabs.New("alk_...")
ctx := context.Background()

mon, err := client.UpTime.Create(ctx, "https://minhaempresa.com.br", alicercelabs.UpTimeMonitor{
	"interval_sec": 60,
})
if err != nil {
	panic(err)
}
fmt.Println(mon["id"])
from alicercelabs import AlicerceLabs

client = AlicerceLabs(api_key="alk_...")

mon = client.uptime.create("https://minhaempresa.com.br", interval_sec=60)
print(mon["id"])
import { AlicerceLabs } from "alicercesdk-javascript";

const client = new AlicerceLabs("alk_...");

const mon = await client.uptime.create("https://minhaempresa.com.br", { interval_sec: 60 });
console.log(mon.id);

Listar / buscar / ver checagens

List / get / view checks

id := mon["id"].(string)
monitors, err := client.UpTime.List(ctx)
one, err := client.UpTime.Get(ctx, id)
checks, err := client.UpTime.Checks(ctx, id)
monitors = client.uptime.list()
one = client.uptime.get(mon["id"])
checks = client.uptime.checks(mon["id"])
const id = mon.id as string;
const monitors = await client.uptime.list();
const one = await client.uptime.get(id);
const checks = await client.uptime.checks(id);

Atualizar / remover

Update / delete

_, err = client.UpTime.Update(ctx, id, alicercelabs.UpTimeMonitor{"interval_sec": 30})
err = client.UpTime.Delete(ctx, id)
client.uptime.update(mon["id"], interval_sec=30)
client.uptime.delete(mon["id"])
await client.uptime.update(id, { interval_sec: 30 });
await client.uptime.delete(id);

Controlar o daemon

Control the daemon

status, err := client.UpTime.WorkerStatus(ctx)
err = client.UpTime.WorkerStart(ctx)
err = client.UpTime.WorkerStop(ctx)
status = client.uptime.worker_status()
client.uptime.worker_start()
client.uptime.worker_stop()
const status = await client.uptime.workerStatus();
await client.uptime.workerStart();
await client.uptime.workerStop();

Limites

Limits

1.000/dia · 41/hora por operação. Sem alertas por email/webhook nesta versão: o histórico de checagens fica registrado e disponível via /checks, mas não há notificação ativa quando um monitor cai.

1,000/day · 41/hour per operation. No email/webhook alerts in this version: check history is recorded and available via /checks, but there's no active notification when a monitor goes down.