Skip to content

TrustMonitoring API

A heartbeat monitor is passive: instead of TrustMonitoring reaching out to your system, your system pings it on a schedule. If no ping arrives within the monitor’s interval plus its grace period, the monitor goes into outage and your alert rules fire. This suits cron jobs, background workers and backup scripts. Create a heartbeat monitor first, see Services & Monitors; its page shows the monitor id and its heartbeat token.

POST https://api.trustcomponent.com/monitoring/v2/monitors/{monitorId}/heartbeat

Registers a heartbeat ping of a heartbeat monitor

Call it from the monitored system on its own schedule. When no ping arrives within the interval plus grace period of the monitor, the monitor goes into outage.

Authenticate with an API key of the project or of an agency that manages it (role MEMBER), or with the heartbeat token of this monitor (Authorization: Bearer hbt_…, shown in the dashboard), so a cron job needs no API key. A tool that cannot set a header sends the token in the query instead (?token=hbt_…), by POST or by GET. A paused monitor accepts the ping and answers 204 without changing its state.

Authentication: API key as bearer token. Operation pingHeartbeatV2.

Example request
Terminal window
curl -X POST "https://api.trustcomponent.com/monitoring/v2/monitors/<monitor_id>/heartbeat" \
-H "Authorization: Bearer <your_api_key>"
Example request
import { TrustComponent } from '@trustcomponent/sdk';
const tc = new TrustComponent('<your_api_key>');
await tc.monitoring.monitors.pingHeartbeat({ monitorId: '<monitor_id>' });
Example request
use TrustComponent\TrustComponent;
$tc = new TrustComponent('<your_api_key>');
$tc->monitoring()->monitors()->pingHeartbeat('<monitor_id>');
Example request
from uuid import UUID
from trustcomponent import TrustComponent
tc = TrustComponent("<your_api_key>")
tc.monitoring.monitors.ping_heartbeat(UUID("<monitor_id>"))
Example request
import com.trustcomponent.sdk.TrustComponent;
import java.util.UUID;
TrustComponent tc = new TrustComponent("<your_api_key>");
tc.monitoring().monitors().pingHeartbeat(UUID.fromString("<monitor_id>"));
Example request
using TrustComponent;
using var tc = new TrustComponentClient("<your_api_key>");
await tc.Monitoring.Monitors.PingHeartbeatAsync(Guid.Parse("<monitor_id>"));
Example request
import (
"context"
trustcomponent "github.com/trustcomponent/trustcomponent-go"
)
tc := trustcomponent.New("<your_api_key>")
ctx := context.Background()
if _, err := tc.Monitoring.Monitors.PingHeartbeat(ctx, "<monitor_id>").Execute(); err != nil {
panic(err)
}
Example request
require 'trustcomponent'
tc = TrustComponent::Client.new('<your_api_key>')
tc.monitoring.monitors.ping_heartbeat('<monitor_id>')
Example request
use trustcomponent::apis::monitoring_monitors_api::PingHeartbeatParams;
let tc = trustcomponent::TrustComponent::new("<your_api_key>");
tc.monitoring.monitors.ping_heartbeat(PingHeartbeatParams {
monitor_id: "<monitor_id>".into(),
}).await?;

Path parameters

NameTypeDescription
monitorIdrequiredstring (uuid)Id of the heartbeat monitor

Response 204

Ping registered (no body).

Status codes

StatusMeaning
204Ping registered
401No API key or heartbeat token (code: credentials_missing), or the API key is unknown or revoked (code: credentials_invalid)
402Trial of the module ended (code: trial_expired); choose a plan to continue
403The API key has no access to the project of this monitor or lacks the MEMBER role, or the heartbeat token does not belong to this monitor (code: access_denied)
404Monitor not found, or the monitor is not a heartbeat monitor (code: monitor_not_heartbeat)
423Project locked by TrustComponent (code: project_locked); only support can unlock it
429Too many requests (code: rate_limit_exceeded); retry after the seconds in Retry-After

A ping after an outage brings the monitor back right away; it does not wait for the next evaluation. A paused monitor accepts the ping and answers 204, without changing its state.

Rate limit: heartbeats have a budget of their own, 2,000 per minute per API key, enough for every monitor of the largest plan at its shortest interval; they do not count against the limit of your other calls.

Where a key cannot be stored, such as a cron line, send the heartbeat token of the monitor instead of the key. It is shown on the monitor page, starts with hbt_ and only works for this one monitor; rotate it there if it leaks, the old token stops working at once:

Terminal window
curl -X POST "https://api.trustcomponent.com/monitoring/v2/monitors/{monitorId}/heartbeat" \
-H "Authorization: Bearer hbt_…"

It answers like the call with a key, and 403 with code: access_denied for a token of another monitor. Append the ping to the job itself, so it only fires when the job succeeded:

crontab
30 2 * * * /usr/local/bin/backup.sh && curl -fsS -X POST "https://api.trustcomponent.com/monitoring/v2/monitors/{monitorId}/heartbeat" -H "Authorization: Bearer hbt_…" > /dev/null

Some tools, such as the notification of a backup program or a NAS task, can only call a URL and set no header. Put the heartbeat token into the URL instead; the URL then answers GET as well as POST:

https://api.trustcomponent.com/monitoring/v2/monitors/{monitorId}/heartbeat?token=hbt_…

Treat this URL like a password: anyone who has it can send heartbeats for this monitor. A header keeps the token out of logs along the way, so prefer it wherever the tool allows one.

The earlier heartbeat URLs with the service id and the token in the path keep working, see the legacy page.

Alert e-mails include a one-click link that acknowledges the alert: further escalation steps and repeats of the current firing cycle stop, without signing in. The token in the link is signed and bound to its firing cycle, so an old link never silences a later outage. See Alerts & Escalation.