---
title: "Health Probe"
method: POST
path: "/auth/health-probe"
tags: ["auth"]
---

# Health Probe

`POST /auth/health-probe`

Validate App Attest assertion + alice lookup → maybe mint a custom token.

Validation order matches the cross-repo spec:
1. App Attest (consume nonce, verify assertion, monotonic counter).
2. ``fresh_sample.end_date`` within adaptive freshness window.
3. ``len(record_ids) >= 10`` else ``insufficient_signal``.
4. Rate-limit per key (5/hour).
5. Alice ``/apple/identity-lookup`` and score.

On ``confident`` we set the ``imperfect_user_id`` custom claim before
minting the token so alice (and other services reading the JWT) see
the resolved id immediately — mirrors ``/health-providers`` flow.

The raw body is read first so the canonical-JSON hash is computed
from the parsed-but-not-Pydantic-reserialized ``payload`` sub-tree.
Pydantic v2 normalizes datetimes (``"...Z"`` → ``"...+00:00"``),
which would mismatch the assertion's expected hash from the
mobile client.

## Response `200`

Successful Response

- HealthProbeResponse — Response for ``POST /auth/health-probe``.
  - `decision` 'confident' | 'ambiguous' | 'none' | 'insufficient_signal', required — The closed set of Apple Health probe outcomes. Produced by the pure scorer in :mod:`cheshire.resources.auth` and returned verbatim by the endpoint, so the endpoint, its tests, and any future re-scoring tool share one vocabulary.
  - `custom_token` string, nullable
  - `recovered` boolean, nullable

---

[API](https://skmtc.dev/imperfect/apis/imperfect-api.md) · [All operations](https://skmtc.dev/imperfect/apis/imperfect-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/imperfect/imperfect-api/revisions/cc2293a44257/schema)
