---
title: "HutPass authentication"
description: "Public reads need no credential. To act for one person, an agent uses a personal access token that the person creates."
canonical: "https://hutpass.com/auth.md"
---

# HutPass authentication

## Discover

- Public reads, `https://api.hutpass.com/api/v1` and MCP at `https://hutpass.com/mcp`: no credential. Send none. The OpenAPI description declares `security: []` for them.
- Acting for one person, `https://hutpass.com/api/agent/v1`: a personal access token. A 401 from it carries `WWW-Authenticate: Bearer realm="hutpass", resource_metadata="https://hutpass.com/.well-known/oauth-protected-resource"`, the RFC 9728 metadata for this resource.
- Operations, scopes and errors: https://hutpass.com/openapi.json (the `bearerAuth` scheme).

## Pick a method

There is one: a personal access token, `hp_pat_` followed by 43 letters and digits. There is no OAuth flow, no client registration and no token exchange. Do not look for an authorization server; the metadata names none.

## Register and claim

An agent cannot register itself or obtain a token on its own. The person does it:

1. They sign in at https://hutpass.com/account and open Agent access (https://hutpass.com/account/agents).
2. They name the token, choose its scopes and its lifetime (up to 365 days, 90 by default), and create it.
3. HutPass shows the token once. They give it to you, for example by pasting it into your configuration.

Never ask the person for their Google password, a one-time code or a session cookie. Ask only for a token, and only when you need to act for them.

## Scopes

- `alerts:read`: list the person’s availability alerts.
- `alerts:write`: create, change and cancel their alerts.
- `hikes:read`: read their saved hikes.

Hikes are read-only to a token, whatever its scopes. A token can never create, list or revoke tokens, and never reaches admin endpoints.

## Use the token

Send it in the `Authorization` header to `https://hutpass.com/api/agent/v1`:

```
curl -sS -H "Authorization: Bearer $HUTPASS_TOKEN" "https://hutpass.com/api/agent/v1/availability-alerts"
```

```
curl -sS -X POST -H "Authorization: Bearer $HUTPASS_TOKEN" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"locationSlug":"biella","startDate":"2027-07-10","endDate":"2027-07-12","adults":2,"locale":"en"}' \
  "https://hutpass.com/api/agent/v1/availability-alerts"
```

An alert emails the person once, when a watched night can be booked on the hut's own system. HutPass never books.

Creating an alert takes an optional `Idempotency-Key` header (1 to 128 printable characters, such as a UUID). Use a new key for each alert you mean to create and reuse it only to retry that same request: the retry returns the alert the first call made, with status 200 and `Idempotent-Replayed: true`, and nothing new is created. A create that was refused (a 4xx) does not use up its key.

## Errors

Every error is JSON, `{"error": {"code": "..."}}`. Act on `code`.

- 401 `unauthenticated`: no token, or an unknown, revoked or expired one. Ask the person for a new token; do not retry.
- 403 `insufficient_scope`: the token lacks the scope. Ask the person for a token with it.
- 402 `limit_reached`: the person has as many active alerts as their plan allows. 402 `window_too_long`: the date range is longer than their plan allows. Tell the person; do not work around it.
- 422 `monitoring_unavailable`: HutPass does not monitor that hut, so it cannot alert on it.
- 409 `duplicate`: an identical alert is already active. 409 `idempotency_key_used`: the key made an alert that has since been deleted; use a new key.
- 422 `idempotency_key_reused`: the `Idempotency-Key` was already used with a different body. Use a new key.
- 400 `invalid_idempotency_key`: the key is empty, longer than 128 characters or contains spaces.
- 429 `rate_limited`: wait `Retry-After` seconds.

## Revocation

The person revokes a token on https://hutpass.com/account/agents. It stops working at once. A token also stops at its expiry date. Neither can be undone: the person creates a new token.

## Never

- Never put a token in a URL, a log, a shared document or a page.
- Never send a token anywhere but `https://hutpass.com/api/agent/v1`.
