Skip to content

Authentication and API tokens

Reference
For:
Developers, Team owners and admins
In the app:
Settings, then API tokens

This page is the reference for API token authentication in the HostRepute API: the team API tokens you create in Settings, then API tokens, how to send them, what each one may do, and the answers you get when a token is refused.

Send the token in the Authorization header of every request, after the word Bearer:

Request
curl "https://app.hostrepute.com/api/v1/hosts" \
-H "Authorization: Bearer $HOSTREPUTE_TOKEN" \
-H "Accept: application/json"
  • The Authorization header is the only place the API reads a token from. Query parameters and cookies don’t work.
  • Send the whole token exactly as it was shown, including the number and the | at its start.
  • A token works only on https://app.hostrepute.com/api/v1, and only for the team it was created in.
The API tokens page in team settings: the Your tokens list, each token with the abilities it holds, its status and a Revoke button, and the Create a token button.
  • They belong to the team, not to a person. A token keeps working when the member who created it leaves the team or deletes their account, and the list doesn’t record who created it. Every request it makes counts against the team’s rate limit and uses the team’s credits.
  • Who can manage them. Every member of the team can see the list. Creating and revoking tokens needs the Developer role or higher: Owner, Admin, Manager or Developer. See members and roles.
  • Shown once. After Create token, the page shows the new token under Copy your new token now. HostRepute stores only a hash of it, so nobody can show it to you again. If you lose it, revoke it and create another.
  • Abilities are fixed. A token can do only what you ticked under What it can do when you created it. You can’t change them later: create a new token and revoke the old one.
  • Optional expiry. Leave Expires (optional) empty for a token that works until you revoke it, or pick a date and time in the future. HostRepute has no other expiry for API tokens.
  • Last used. Each token’s Last used time updates with every request it authenticates.
  • Revoking is immediate. Revoke, then Revoke token, stops the token at once. This can’t be undone.
SettingDefaultHow to change
Token name80 charactersFixed
AbilitiesAt least oneSet per token
Expiry dateOptional; must be in the futureSet per token

The Status column shows one of these:

StatusMeaning
ActiveThe token works. It has no expiry date, or its expiry date hasn't passed yet.
ExpiredThe token's expiry date has passed, and the API answers 401 to it. It stays in the list until you revoke it.

Each operation in the API needs one ability. The form in What it can do groups them by area and starts with every read and check ability ticked. Read only, Everything except delete, Full access and Clear change the whole selection, and the search box finds an ability by name, such as blacklist:check.

AbilityName in the portalAPI operations it allowsCan be chosen in the portal
host:readRead HostsYes
host:createCreate HostsYes
host:updateUpdate HostsYes
host:deleteDelete HostsYes
data-source:readRead Data SourcesYes
data-source-group:readRead Monitoring ProfilesYes
data-source-group:createCreate Monitoring ProfilesYes
data-source-group:updateUpdate Monitoring ProfilesYes
data-source-group:deleteDelete Monitoring ProfilesYes
alert:readRead Alert DestinationsYes
alert:createCreate Alert DestinationsYes
alert:updateUpdate Alert DestinationsYes
alert:deleteDelete Alert DestinationsYes
alert-group:readRead Contact GroupsYes
alert-group:createCreate Contact GroupsYes
alert-group:updateUpdate Contact GroupsYes
alert-group:deleteDelete Contact GroupsYes
blacklist:checkCheck BlacklistYes
blacklist:readRead Blacklist StatusYes
certificate:checkCheck CertificatesYes
certificate:readRead Certificate StatusYes
certificate:agentPrivate Certificate AgentNo API operation needs it.Yes
deliverability:checkCheck Email DeliverabilityYes
deliverability:readRead Email DeliverabilityYes
metrics:readRead Prometheus MetricsYes
email-verification:checkCheck Email VerificationNo API operation needs it.No
  • metrics:read also needs the Business or Enterprise plan; see scrape Prometheus metrics.
  • certificate:agent can be ticked, but no team API operation uses it. A private agent signs in with its own hrca_ token: see check internal certificates with a private agent.
  • Ability names use the API’s internal words: host is a domain or IP, data-source a blocklist, data-source-group a check profile, alert an alert channel, alert-group delivery hours and deliverability email authentication.

The token is missing, mistyped, revoked or expired. HostRepute answers before it counts the request against any rate limit.

Response (401)
{ "message": "Unauthenticated." }

The token is valid but lacks the ability the operation needs. GET /api/v1/metrics also answers this way when the team’s plan doesn’t include Prometheus metrics.

Response (403)
{
"message": "This action is unauthorized."
}

The answer doesn’t name the missing ability. Look up the operation in the abilities table or the API reference, whose pages say “Needs the … ability”. Every error the API returns is listed in errors.

Team API tokens work only on the REST API. Two other kinds of credentials exist, each for its own endpoints:

Credential Created in Works on Read
MCP token or OAuth Settings, then AI clients (MCP), per person The MCP server, /mcp/hostrepute Connect AI clients with MCP
Agent token hrca_ Monitor, then Certificates, per agent /api/v1/certificate-agent/* only Private agents