---
title: Add hosts, rotate their tokens and remove them from the API
description: If your servers come from Ansible or a script, adding each one under Hosts → New host and copying its token by hand broke the automation. POST /api/v1/hosts…
canonical: https://watchfor.io/changelog/2026-11-25-hosts-api-add-rotate-remove
---

[All updates](/changelog#2026-11-25-hosts-api-add-rotate-remove) ✨ New Hosts API Nov 25, 2026 · v 15.1.1

# Add hosts, rotate their tokens and remove them from the API

If your servers come from Ansible or a script, adding each one under Hosts → New host and copying its token by hand broke the automation. POST /api/v1/hosts now adds a host with the same plan limit, alert rules and Activity Log entry as the dashboard, and returns its agent token once: hand it to the installer in WATCHFOR_TOKEN and the server reports within a minute. Rotating a token and removing a host are API calls too. The hosts API docs have an Ansible playbook and a shell example.

## Three calls

- POST /api/v1/hosts with name (and optional description ) adds the host and returns it with token , the agent's token. It is in that response only: WatchFor keeps a hash.

- POST /api/v1/hosts/{id}/rotate-token issues a new token, shown once; the old one stops working within a minute.

- DELETE /api/v1/hosts/{id} removes the host like Remove on its page: the token, its alert rules, open incidents and metric history go with it.

All three need a write key, or an owner or admin signed in over OAuth. With an Idempotency-Key , a retried add or rotate never creates a second host or token, and its replay carries token: null .

## Install with the token

Put the token in WATCHFOR_TOKEN and run the installer with --yes , or use --token - on a terminal to paste it. The [hosts API docs](/docs/api/hosts#add-a-host) have a complete Ansible playbook and a shell example.

Share this update

---

Canonical page: https://watchfor.io/changelog/2026-11-25-hosts-api-add-rotate-remove · Site guide: https://watchfor.io/llms.txt
