API — Monitores
Os endpoints de monitores permitem criar, listar, atualizar e deletar monitores programaticamente. Útil para automação via Terraform, CI/CD pipelines e scripts de gerenciamento de infraestrutura.
Todos os endpoints requerem autenticação. Consulte Autenticação → para obter sua chave de API.
Base URL
https://api.thealert.io/api/v1GET /monitors
Lista todos os monitores do workspace.
curl https://api.thealert.io/api/v1/monitors \
-H "Authorization: Bearer ta_sua_chave"Resposta:
{
"data": [
{
"id": "mon_abc123",
"name": "API Principal",
"url": "https://api.suaempresa.com.br/health",
"checkType": "HTTP",
"status": "UP",
"interval": 60,
"isActive": true,
"createdAt": "2026-01-15T10:00:00.000Z",
"lastCheckedAt": "2026-03-23T14:55:00.000Z"
},
{
"id": "mon_def456",
"name": "Banco de Dados",
"url": "db.suaempresa.com.br",
"checkType": "TCP",
"status": "UP",
"interval": 60,
"isActive": true,
"createdAt": "2026-01-20T09:00:00.000Z",
"lastCheckedAt": "2026-03-23T14:55:30.000Z"
}
],
"meta": {
"total": 2
}
}GET /monitors/:id
Retorna os detalhes de um monitor específico.
curl https://api.thealert.io/api/v1/monitors/mon_abc123 \
-H "Authorization: Bearer ta_sua_chave"Resposta:
{
"data": {
"id": "mon_abc123",
"name": "API Principal",
"url": "https://api.suaempresa.com.br/health",
"checkType": "HTTP",
"method": "GET",
"expectedStatus": 200,
"timeout": 10,
"keyword": null,
"interval": 60,
"failureThreshold": 2,
"recoveryThreshold": 2,
"status": "UP",
"isActive": true,
"createdAt": "2026-01-15T10:00:00.000Z",
"lastCheckedAt": "2026-03-23T14:55:00.000Z"
}
}POST /monitors
Cria um novo monitor.
Os limites de monitores por plano são aplicados no servidor. Se você atingiu o limite do seu plano, a criação retornará 403 Forbidden.
curl -X POST https://api.thealert.io/api/v1/monitors \
-H "Authorization: Bearer ta_sua_chave" \
-H "Content-Type: application/json" \
-d '{
"name": "API de Checkout",
"url": "https://api.suaempresa.com.br/checkout/health",
"checkType": "HTTP",
"method": "GET",
"expectedStatus": 200,
"interval": 60,
"timeout": 10
}'Campos disponíveis:
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
name | string | Sim | Nome do monitor |
url | string | Sim | URL ou host monitorado |
checkType | string | Sim | Tipo: HTTP, TCP, DNS, SSL, PING, WEBSOCKET, PUSH, API_HEALTH |
interval | number | Sim | Intervalo em segundos (mínimo varia por plano) |
method | string | Não | Método HTTP: GET, POST, PUT, DELETE etc. (padrão: GET) |
expectedStatus | number | Não | Status code esperado (padrão: qualquer 2xx) |
timeout | number | Não | Timeout em segundos (padrão: 10) |
keyword | string | Não | Keyword que deve estar no body da resposta |
port | number | Não | Porta (obrigatório para TCP) |
jsonPath | string | Não | JSON Path para assertion (apenas API_HEALTH) |
expectedValue | string | Não | Valor esperado no JSON Path |
failureThreshold | number | Não | Falhas consecutivas antes de alertar (padrão: 2) |
recoveryThreshold | number | Não | Recuperações consecutivas antes de marcar como UP (padrão: 2) |
Resposta (201 Created):
{
"data": {
"id": "mon_xyz789",
"name": "API de Checkout",
"checkType": "HTTP",
"status": "PENDING",
"createdAt": "2026-03-23T15:00:00.000Z"
}
}Exemplo: criar monitor TCP
curl -X POST https://api.thealert.io/api/v1/monitors \
-H "Authorization: Bearer ta_sua_chave" \
-H "Content-Type: application/json" \
-d '{
"name": "PostgreSQL — Produção",
"url": "db.suaempresa.com.br",
"checkType": "TCP",
"port": 5432,
"interval": 60
}'Exemplo: criar monitor API Health
curl -X POST https://api.thealert.io/api/v1/monitors \
-H "Authorization: Bearer ta_sua_chave" \
-H "Content-Type: application/json" \
-d '{
"name": "Health Check — Status",
"url": "https://api.suaempresa.com.br/health",
"checkType": "API_HEALTH",
"interval": 60,
"jsonPath": "data.status",
"expectedValue": "healthy"
}'PUT /monitors/:id
Atualiza um monitor existente. Envie apenas os campos que deseja alterar.
curl -X PUT https://api.thealert.io/api/v1/monitors/mon_abc123 \
-H "Authorization: Bearer ta_sua_chave" \
-H "Content-Type: application/json" \
-d '{
"interval": 30,
"failureThreshold": 1
}'Resposta (200 OK):
{
"data": {
"id": "mon_abc123",
"name": "API Principal",
"interval": 30,
"failureThreshold": 1,
"updatedAt": "2026-03-23T15:05:00.000Z"
}
}Pausar/ativar um monitor
# Pausar
curl -X PUT https://api.thealert.io/api/v1/monitors/mon_abc123 \
-H "Authorization: Bearer ta_sua_chave" \
-H "Content-Type: application/json" \
-d '{"isActive": false}'
# Ativar
curl -X PUT https://api.thealert.io/api/v1/monitors/mon_abc123 \
-H "Authorization: Bearer ta_sua_chave" \
-H "Content-Type: application/json" \
-d '{"isActive": true}'DELETE /monitors/:id
Remove um monitor permanentemente. Esta ação não pode ser desfeita.
curl -X DELETE https://api.thealert.io/api/v1/monitors/mon_abc123 \
-H "Authorization: Bearer ta_sua_chave"Resposta (200 OK):
{
"message": "Monitor deletado com sucesso"
}Deletar um monitor remove todos os checks históricos associados a ele. Para manter o histórico, pause o monitor (isActive: false) em vez de deletar.