Start watching a new server
After you create a server at your cloud provider, InfraNest finds it at its next sync. This recipe turns on monitoring for it and adds a check on its website, so a new machine is watched from its first hour.
Runnable code: the code on this page, ready to clone and run, is in infranest-examples/examples/watch-new-server. CI runs it against the sandbox.
The token
Make a token with Servers → Write and Monitoring → Write.
Find the server
curl "https://api.infranest.io/api/organizations/42/cloud-servers?search=web-03" \
-H "Authorization: Bearer $INFRANEST_TOKEN" -H "Accept: application/json"The answer is a page of servers; take the id and ipv4 of the one in data. InfraNest syncs with your provider on a schedule, so a server created a moment ago may not be listed yet. To fetch it at once, select Sync now on the provider under Integrations in the app.
Turn on monitoring
curl -fsS -X POST https://api.infranest.io/api/organizations/42/cloud-servers/77/monitoring \
-H "Authorization: Bearer $INFRANEST_TOKEN" -H "Accept: application/json"The answer says how many monitored servers your plan allows and how many you use:
{ "monitoring_enabled": true, "monitoring_enabled_at": "2026-01-15T12:00:00+00:00", "usage": 4, "limit": 10 }At the limit, the API answers 402 with the code plan_limit. Turning it on again when it is already on changes nothing.
For CPU, memory and disk metrics, install the server agent as well. See Install the agent on many servers.
Watch its website
curl -fsS -X POST https://api.infranest.io/api/organizations/42/monitoring-checks \
-H "Authorization: Bearer $INFRANEST_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: server-77-http" \
-d '{"name": "web-03 website", "type": "http", "target": "https://web-03.example.com", "interval_seconds": 60}'