Документация

REST API

API позволяет добавлять и управлять мониторами, получать статусы, инциденты и uptime. Ключ создаётся в кабинете: Настройки → API-ключи. Ограничение — 60 запросов в минуту на ключ.

Авторизация

curl -H "Authorization: Bearer nfk_ваш_ключ" https://notifar.io/api/v1/me

Мониторы

МетодПутьОписание
GET/api/v1/monitorsСписок (фильтры: status, type, q, tag)
POST/api/v1/monitorsСоздать (поля как в форме, см. ниже)
GET/api/v1/monitors/:idМонитор с настройками и статусом по точкам
PATCH/api/v1/monitors/:idЧастичное обновление
DELETE/api/v1/monitors/:idУдалить
POST/api/v1/monitors/:id/pause · /resume · /checkПауза, возобновление, проверить сейчас
GET/api/v1/monitors/:id/status · /results · /uptime?days=30 · /incidentsТекущее состояние, сырые результаты, uptime по дням, инциденты
GET/api/v1/incidents?open=1Инциденты аккаунта
GET/api/v1/locations · /contacts · /balance · /typesСправочники и баланс

Пример: создать HTTP-монитор

curl -X POST https://notifar.io/api/v1/monitors \
  -H "Authorization: Bearer nfk_ваш_ключ" -H "Content-Type: application/json" \
  -d '{
    "type": "http", "name": "Магазин", "url": "https://example.ru/",
    "interval_sec": 300, "expected_status": "200-299", "keyword_present": "Корзина",
    "location_ids": [1, 2], "confirm_locations": 2, "contact_ids": [5]
  }'

Ответ: { "ok": true, "monitor": { "id": 42, "state": "pending", ... } }. Ошибки возвращаются как { "ok": false, "error": "validation", "fields": {...} } с кодом 422.

Поля по типам

Полный список полей каждого типа отдаёт GET /api/v1/types. Общие поля: name, interval_sec, timeout_ms, location_ids[], confirm_locations, fail_threshold, recover_threshold, notify_repeat_min, notify_repeat_max, notify_recovery, tags, contact_ids[], contact_delay{id: минуты}.

Сайт (HTTP/HTTPS) (http)
url*, method, expected_status, max_response_ms, keyword_present, keyword_absent, size_min, size_max, number_regex, number_min, number_max, follow_redirects, expected_final_url, user_agent, referer, headers, body, content_type, auth.user, auth.pass, ignore_tls_errors, ip_family
Содержимое страницы (content)
url*, ignore_regex, user_agent, auth.user, auth.pass
PING (ICMP) (ping)
host*, count, max_loss_pct, max_avg_ms, ip_family
TCP-порт (tcp)
host*, port*, tls, ip_family, send, banner_regex
DNS-записи (dns)
dns_name*, rrtype, nameserver, expected, match
SSL-сертификат (ssl)
host*, port, days_warn, check_chain, check_hostname, alert_on_change
Срок регистрации домена (domain)
domain*, days_warn
SMTP-сервер (smtp)
host*, port, tls, user, pass, banner_regex
POP3-сервер (pop3)
host*, port, tls, user, pass
IMAP-сервер (imap)
host*, port, tls, user, pass
FTP-сервер (ftp)
host*, port, tls, user, pass
MySQL / MariaDB (mysql)
host*, port, tls, user*, pass, database, query, expect_rows_min
PostgreSQL (postgres)
host*, port, tls, user*, pass, database, query, expect_rows_min
Ресурсы сервера (CPU/RAM/HDD) (resources)
url*, secret, cpu_max, ram_max, disk_max, load_max, ignore_tls_errors
Heartbeat (cron-задачи, бэкапы) (heartbeat)
grace_sec
Чёрные списки и Роскомнадзор (blacklist)
target*, rkn, gsb, lists

Webhook-уведомления

Контакт типа Webhook получает POST с JSON { event, monitor, incident, ... } и заголовками X-Notifar-Event, X-Notifar-Signature: sha256=HMAC(secret, body). События: down, up, repeat, ssl_expiring, ssl_changed, domain_expiring, domain_expired, content_changed, blacklisted, test.

Heartbeat

# в конце cron-задачи
curl -fsS -m 10 https://notifar.io/hb/ВАШ_ТОКЕН > /dev/null