DESIGN_API: API Contract & Security β
This document defines the interface between the camply-backend (FastAPI) and camply-frontend (React). It also outlines the security flow for Auth0 and optional invite-only access.
Python package boundaries β
The existing ASGI application is camply.server.app:app, enabled by the server extra. This installation supports API browsing and scan management with SQLite. Operations overview/task-list responses use existing unavailable/error fields when distributed is absent unless CAMPLY_RUNTIME_MODE=standalone is active.
Runtime and hosting contract β
CAMPLY_RUNTIME_MODE=standalone serves built root-based frontend assets and the API from Python. Known API routes keep their normal errors, /api/* misses never become HTML, and /metrics is unavailable. HTML navigation falls back to the entry page for root/deep links; missing asset paths return 404. GET/HEAD are supported, other static methods return 405, hashed /assets/ files are immutable, and entry HTML is not cached. Auth mode, CSRF, invitation checks, and administrator authorization remain independent of runtime.
GET /api/health checks database readiness in both runtimes with a two-second query budget, additionally checks supervised local loops in standalone, and returns HTTP 503 when unhealthy. Its existing response shape is unchanged. /api/ping remains dependency-independent liveness. Admin operations adds runtime_mode, capabilities, and local scheduler_status. Standalone returns broker_connected: null, unsupported reserved/scheduled counts as null, measured queue/running counts, and bounded local attempt history (1,000 entries/24 hours, cleared on restart). Historical trends use the existing unavailable response shape and are intentionally hidden by capability in the frontend. Failed loops display a real unhealthy state rather than a broker outage.
Administrator provider sync dispatches to the selected runtime. Repeated local sync requests share the active job identity and return promptly. Existing distributed broker/inspection/Prometheus behavior remains the default. See admin response details.
π― API Philosophy β
- OpenAPI-First: Every endpoint must be documented so that the frontend TypeScript client can be automatically generated.
- Standardized Responses: All successful responses use
ORJSONResponsefor performance. - Strict Validation: Every request payload must be a Pydantic v2 model.
- Auth-Gated: All user-specific endpoints are gated by the
CurrentUserDepdependency.
π Security & Middleware β
1. Authentication and local development β
The owner selects none, session, or auth0 with CAMPLY_AUTH_MODE, independently of the environment. HTTP Basic authentication is unsupported.
- Automatic login (
none, default): every request uses the shared admin identity; no login/signup/logout UI. - Password sessions (
session): the app posts username/password JSON toPOST /api/login. The response contains the profile and sets a signed HTTP-only session cookie plus a CSRF cookie. Each login persists auser_sessionsrecord whose UUID is embedded in the signed JWT asjti. The frontend confirms the cookie withGET /api/mebefore opening the dashboard; rejected cookies keep the user on the login form with setup guidance. Scan queries do not automatically retry 401/403 responses. A scan query's 401 clears the cached profile and scans, cancels any profile refresh, and returns the user to sign-in. Mutations requireX-CSRF-Tokenmatching the signed session.POST /api/logoutrevokes the currentuser_sessionsrow and clears the cookies. The shared account has no signup. Cookies have an absolute lifetime, and individual revocation, logout, or credential/secret changes invalidate them immediately. - Auth0 (
auth0): requests require an RS256 bearer token validated against issuer and API audience, and must carryexpand a nonemptysub. Invalid or expired credentials return 401; an unreachable or unusable JWKS endpoint returns 503 so clients can retry. Key sets are cached without caching keys indefinitely, ensuring dropped keys stop verifying once cache refreshes, and JWKS retrieval runs off the asyncio loop. Users are provisioned by verified email and subject on first access. The application starts sign-in on/authand uses the Auth0 SDK. - Browser token storage & tradeoffs (
auth0):Auth0ProviderconfigurescacheLocation="memory",useRefreshTokens={true}, anduseRefreshTokensFallback={true}instead oflocalStorageor server-managed Auth0 BFF sessions. Keeping tokens strictly in memory prevents persistent token theft via XSS (localStorage/sessionStorage) and avoids adding stateful OAuth BFF token storage on the Python API. Tradeoff: in-memory tokens do not survive full page reloads or new tabs directly; silent session recovery across reloads relies on Auth0 Refresh Token Rotation (useRefreshTokens) backed by a silent Auth0 session iframe (useRefreshTokensFallback). When third-party cookies or storage partitioning (e.g., Safari ITP or strict browser privacy settings without an Auth0 Custom Domain) block the silent iframe, renewal returnslogin_requiredand prompts the user to sign in again rather than failing silently. Tokens and credentials are never persisted tolocalStorage/sessionStorageor logged toconsole.*. - Token acquisition classification & bounded session recovery (
auth0):- Client-side
getAccessTokenSilentlyerrors are classified intoexpired(login_required,consent_required,interaction_required,missing_refresh_token,invalid_grant),outage(network errors, timeouts, IdP5xx), orauth_failure(access_denied,invalid_scope, and other OAuth errors). - On backend
401responses inauth0mode, the Axios response interceptor allows at most one deduplicated token renewal (getAccessTokenSilently({ cacheMode: "off" })) only for safe idempotent requests (GET,HEAD,OPTIONS) that have not already retried (!_retried). Unsafe mutations (POST,PUT,PATCH,DELETE) are never automatically replayed on401; they fail immediately with a session-expired prompt and clear auth state. - When renewal fails with
expired/auth_failureor a retried request still returns401, protected React Query caches (["me"],["scans"],["admin"]) are cleared and a clear sign-in error is surfaced without redirect or retry loops. 503verification-service responses (JWKS or/userinfooutages) andoutagetoken errors keep the current user session intact and surface a temporary outage error (allowing at most one query retry).403(ERR_VERIFIED_EMAIL_REQUIRED,ERR_INVITE_REQUIRED,ERR_PASSWORD_CHANGE_REQUIRED) and409(ERR_EMAIL_CONFLICT) surface clear messages without query retries.- Protected queries (
useScans,useAdmin*) wait untilisReady && Boolean(user), and switching Auth0 subjects (auth0User.sub) or signing out clears user/scan/admin caches so prior-account data cannot leak across sessions.
- Client-side
- Trusted email provisioning & userinfo fallback: Auth0 identity subjects (
sub) are kept strictly separate from email addresses;subis never used as an email placeholder. The backend only trusts verified emails. Email verification status is resolved by inspecting token claims (emailandemail_verified, including namespacedhttps://camply/emailandhttps://camply/email_verified). When absent or unverified in claims, the backend falls back toGET https://{auth0_domain}/userinfousing the bearer token. Userinfo profiles are cached in memory (bounded to 1,000 entries, 10-minute TTL, keyed by the SHA-256 digest of the token; raw tokens are never logged). Upstream userinfo network or service failures return 503 so clients can retry. New users without a verified email receive403 Forbidden(ERR_VERIFIED_EMAIL_REQUIRED). - Duplicate emails & account-linking rules: camply never automatically merges or links user identities solely because their email addresses match. Explicit proof-of-ownership account linking is out of scope. If an incoming identity presents a verified email already belonging to another account (such as an in-app password session user or a different Auth0 subject), the backend rejects the request with
409 Conflict(ERR_EMAIL_CONFLICT) without modifying either user. Concurrent first-login races on the sameauth0_idsafely resolve to the winning record without 500 errors. - Email change synchronization: For existing users matched by
auth0_id, presenting a verified token with a new email address updatesUser.email(case-normalized) if unclaimed by another account. If the new email is already claimed, the request returns 409ERR_EMAIL_CONFLICTwithout modifying the user. Unverified email changes are ignored and do not sync. Because subscriptions and preferences key onUser.id, scans, notification settings, and invitation eligibility (is_invited) are fully preserved across email changes. GET /api/auth-config: public configuration returnsauth_mode,auth0_domain,auth0_client_id,auth0_audience,auto_login,signup_enabled, andinvite_only. The React SDK requests the returned audience. Auth0 mode must supply domain, audience, and client ID.GET /api/me: the profile exposesis_invited,invitation_status(pending,approved,rejected, ornull),is_admin, andscanning_enabled. The existing database column remainsis_early_access_userfor compatibility with stored data.
Session cookies include both a jti referencing an active user_sessions row and a credential version derived by HMAC from the current salted password hash. Every authenticated session request verifies both the credential version and that the user_sessions row exists, belongs to the user, has revoked_at IS NULL, and has not passed expires_at. POST /api/change-password and admin password resets revoke all active user_sessions rows for the user; POST /api/change-password creates a fresh session for the current browser and rotates its CSRF token. Users can list and individually revoke active password sessions via GET /api/me/sessions and DELETE /api/me/sessions/{session_id} (returning 404 outside session mode or for sessions not owned by the caller). Legacy cookies without a jti or credential version require sign-in again. Stored bootstrap passwords replace the configured password for authentication; the configured username remains an alias. Session mode honors the stored administrator role, including bootstrap account demotions. Automatic login restores administrator access and ignores password-change flags; Auth0 also ignores these session-only flags.
2. Optional invite-only guard β
CAMPLY_INVITE_ONLY defaults to false. When enabled, every /api/scans operation requires the user's is_invited flag. Uninvited authenticated callers receive 403 with ERR_INVITE_REQUIRED. The frontend gates dashboard and scan detail routes with the invitation request screen. Profiles and public metadata remain accessible. Existing scan ownership checks apply in both configurations.
3. Invitation requests and admin review β
POST /api/request-access stores a pending request with a normalized lowercase email and optional name, accepting duplicate emails idempotently. When a new request is persisted (not on duplicate submissions), best-effort background notifications are sent via ntfy or Pushover to configured administrators (is_admin=True, scanning_enabled=True, and valid channel credentials). It does not grant access or send email.
On first-time Auth0 provisioning with a verified email, matching AccessRequest rows are linked via user_id; an approved request grants is_invited=True, while pending or rejected requests link user_id with is_invited=False. Existing uninvited Auth0 users who change to an unclaimed approved verified email also receive is_invited=True, unless they already have a rejected request. Unverified emails are rejected (403 ERR_VERIFIED_EMAIL_REQUIRED) and never claim approved requests. GET /api/me and PATCH /api/me expose invitation_status (pending, approved, rejected, or null) from the most recently updated matching request.
Administrators review requests via GET /api/admin/access-requests (paginated, filterable by status and email/name search) and PATCH /api/admin/access-requests/{id} (approved or rejected), or toggle is_invited directly via PATCH /api/admin/users/{id}. Approving a request links any existing user with that lowercased email and sets is_invited=True; rejecting a previously approved request revokes is_invited for the linked/matching user while blocking self-revocation and bootstrap-admin revocation. Toggling is_invited via PATCH /api/admin/users/{id} symmetrically updates matching AccessRequest rows (pending/rejected -> approved when invited, approved -> rejected when revoked) with reviewer metadata and user_id linkage. All status and invitation changes emit AdminAuditEvent records.
ποΈ Endpoint Definitions β
1. Search & Metadata (Public/Auth-Light) β
GET /api/search?query=<term>: Full-text search for campgrounds and recreation areas (uses theSearchFTS table).GET /api/search/explore: Paginated search with totals and facets. Supportsq,state,provider_id,entity_type,campsite_types,has_electric,pets_allowed,ada_accessible,min_rv_length, proximity bounds (lat/lng/radius_miles), and optional viewport (west,south,east,north) filtering the full matching set before pagination and aggregation. Supply all four finite bounds or none; longitude is within [-180, 180], latitude within [-90, 90], south < north, and west β east. West > east crosses the antimeridian. Viewport filtering excludes missing/invalid coordinates and lat/lon of 0/0; unbounded search retains unmappable places.GET /api/providers: List supported providers and their scanning capabilities.GET /api/provider/{id}: Get a single provider by ID.GET /api/campground/{provider}/{id}: Get a single campground.GET /api/rec-area/{provider}/{id}: Get a recreation area.GET /api/rec-area/{provider}/{id}/campgrounds: List campgrounds within a recreation area.GET /api/rec-area/{provider}/{id}/monitoring-campgrounds: Paginated eligible campgrounds (items,total,eligible_total,has_more,catalog_revision) for selected-campground area scans, with search filtering.
2. User & Profile (Auth-Required) β
GET /api/me: Get current user profile, invitation eligibility andinvitation_status, administrator role, scanning eligibility, and password change status.PATCH /api/me: Update user-specific settings (e.g.,pushover_token) and return the updated profile includinginvitation_status. Requires password update first ifmust_change_passwordis set.POST /api/change-password: Update user password, revoke prior sessions, issue a fresh session, and clearmust_change_password(session mode).GET /api/me/sessions: List active password sessions (id,user_agent,ip_address,created_at,expires_at,is_current) for the authenticated user (session mode; requiresmust_change_password=false).DELETE /api/me/sessions/{session_id}: Revoke a specific password session owned by the authenticated user, clearing cookies if revoking the current session (session mode; requiresmust_change_password=false).
3. Scan Management (Auth-Required + Optional Invitation) β
GET /api/scans: List all scans belonging to the current user (paginated).POST /api/scans: Create a new scan.- Logic: Supports both single
campgroundscans andrecreation_areascans (coverage_mode:"all"for all current and future eligible campgrounds, or"selected"for a fixed list ofcampground_ids). Backend computes a normalizeddefinition_hash, links one sharedUniqueTargetfor campground scans or resolves memberScanTargetcoverage rows for area scans, and rejects unbookable/empty destinations (422) or unknown destinations (404). - Returns
201 Createdon success,409 Conflictif an identicaldefinition_hashsubscription exists for the user.
- Logic: Supports both single
GET /api/scans/{id}: Detailed view of a scan, including membercampgroundscoverage status and campground-attributedscan_results(provider_id,campground_id,campground_name,is_stale).- Result expiration: User-facing results and
found_countomit nights before the current UTC date or outside the target interval, then apply the saved minimum stay. This also applies to paused scans. Successful provider checks replace availability, including clearing results for an empty response; failed checks preserve the latest successful snapshot and timestamp (surfaced withis_stale: truewhen the latest area round attempt failed). PATCH /api/scans/{id}: Edit destination (destination_type,provider_id,campground_idorrecreation_area_id,coverage_mode,campground_ids), dates, filters (min_stay_length,preferred_types,require_electric), oris_active, with optionalrow_versionoptimistic concurrency locking. Target/coverage changes recomputedefinition_hash, bumpdefinition_revision/coverage_revision/row_version, and reconcileScanTargetrows without mutating shared targets or other subscribers. Duplicate definitions orrow_versionmismatches return409, invalid shapes or date ranges return422, and unknown destinations return404. Editing preserves the scan ID, creation date, and active preference unless explicitly changed. Suspended users can edit saved scans, but cannot resume them.DELETE /api/scans/{id}: Unsubscribe from a scan (returns204 No Content).
4. Administration & Operations (Admin-Only) β
GET /api/admin/overview: Summary counts (users, active scans, targets, 24h results).GET /api/admin/users: List users with scanning status, scan counts, pagination, and search.POST /api/admin/users: Create a new database user with password, scanning status, admin status, and optional forced password change (session mode only).GET /api/admin/users/{id}: User detail with scans and audit history.PATCH /api/admin/users/{id}: Update scanning access, invitation eligibility (is_invited), or administrator role, rejecting self-demotion and revocation of the acting or bootstrap administrator's invitation. Password resets andmust_change_passwordupdates require session mode; requests containing either field outside session mode return400before applying changes. Password resets revoke existing sessions and default to requiring password rotation.GET /api/admin/access-requests: List invitation requests with pagination,statusfilter (pending,approved,rejected), and email/namesearch.PATCH /api/admin/access-requests/{id}: Approve or reject (revoke) an invitation request, recording reviewer metadata, updating linked/matching useris_invited, guarding against acting/bootstrap-admin revocation, and recording audit events.GET /api/admin/scans: List all system scans with filters and pagination.GET /api/admin/scans/{id}: Scan detail including target and subscriber info.PATCH /api/admin/scans/{id}: Update scan status (e.g., toggleis_active).GET /api/admin/targets/{id}: Shared target detail and subscribers.GET /api/admin/audit: Immutable admin audit event log with pagination.GET /api/admin/operations: Celery worker states, queue depth, discovery metadata, and recent tasks.GET /api/admin/operations/tasks: Paginated Valkey telemetry stream for recent task executions.GET /api/admin/operations/tasks/{task_id}: Detailed telemetry for a single task execution.GET /api/admin/trends: Server-side Prometheus query proxy forusage,api,worker, andprovidermetrics across24h,7d,30d.
π¦ Request / Response DTOs (Pydantic) β
All schemas are defined in src/camply/server/schemas.py.
ScanCreateRequest β
class ScanCreateRequest(BaseModel):
provider_id: int = Field(..., description="Provider identifier")
destination_type: Literal["campground", "recreation_area"] = "campground"
campground_id: str | None = Field(default=None, min_length=1, max_length=128)
recreation_area_id: str | None = Field(default=None, min_length=1, max_length=128)
coverage_mode: Literal["all", "selected"] | None = None
campground_ids: list[str] | None = None
start_date: date = Field(..., description="Check-in date")
end_date: date = Field(..., description="Check-out date")
min_stay_length: int = Field(default=1, ge=1)
preferred_types: list[str] = Field(default_factory=list)
require_electric: bool = Field(default=False)
require_accessible: bool = Field(default=False)
min_rv_length: int | None = Field(default=None, ge=1, le=200)ScanUpdateRequest accepts the same fields as optional plus is_active: bool | None and row_version: int | None for optimistic concurrency control.
ScanResponse β
class ScanResponse(BaseModel):
id: UUID
destination_type: Literal["campground", "recreation_area"] = "campground"
destination_name: str = ""
provider_id: int
campground_id: str | None
campground_name: str | None = ""
recreation_area_id: str | None = None
recreation_area_name: str = ""
coverage_mode: Literal["all", "selected"] | None = None
campground_ids: list[str] = Field(default_factory=list)
eligible_campground_count: int = 1
unavailable_selection_count: int = 0
matching_campground_count: int = 0
destination_available: bool = True
coverage_status: str = "waiting"
checked_campground_count: int = 0
failed_campground_count: int = 0
pending_campground_count: int = 0
last_full_checked_at: datetime | None = None
row_version: int = 1
start_date: date
end_date: date
is_active: bool
min_stay_length: int
preferred_types: list[str]
require_electric: bool
require_accessible: bool = False
min_rv_length: int | None = None
last_checked_at: datetime | None
found_count: int
created_at: datetimeScanDetailResponse extends ScanResponse β
Adds:
campgrounds: list[ScanCampgroundItem]
results: list[ScanResultItem]ScanResultItem β
class ScanResultItem(BaseModel):
provider_id: int = 0
campground_id: str = ""
campground_name: str = ""
last_checked_at: datetime | None = None
is_stale: bool = False
campsite_id: str
campsite_name: str
available_dates: list[str]
campsite_type: str | None
is_electric: bool | None
is_accessible: bool | None
permitted_equipment: list[str] = Field(default_factory=list)
max_vehicle_length: int | None = None
booking_url: strUser scan results and found_count apply the saved site preferences (preferred_types, require_electric, require_accessible, fail-closed min_rv_length, and allowed_weekdays) and minimum consecutive stay. Dates represent available nights in qualifying blocks; check-out is the day after the last night. Booking links are derived from the provider's campground URL without making a provider request. Legacy snapshots have an empty name and unknown attributes until refreshed. Admin shared-target views remain unfiltered.
Scan create/PATCH accept allowed_weekdays, a nonempty list of strict integers from 0 (Monday) to 6 (Sunday), normalized by sorting and removing duplicates. Omitted creation values allow all seven; omitted PATCH values preserve the saved preference. Explicit all-seven selection resets to unrestricted, while null, empty lists, booleans, strings, fractions and out-of-range values are invalid. List/detail/create/update responses expose all seven for unrestricted scans, including existing rows. The field belongs to each subscription; shared target identity and duplicate subscription rules stay unchanged.
Creation and edits to dates, nights or minimum stay validate that the merged criteria can contain a qualifying consecutive stay in the remaining date range, before mutation. Impossible combinations return 422 with guidance to change dates, selected nights or length. Provider availability is not part of this validation. Reads, unrelated edits and status-only updates remain possible after expiration. Results and counts exclude disallowed occupied nights before consecutive grouping; checkout itself need not be a selected weekday.
π Client Generation Workflow β
- Backend developer updates the FastAPI router.
- Run
task backend:checkto ensure types are correct. - Start the backend:
task backend:dev. - Run:
task frontend:codegenfrom the repository root.- Fetches
http://localhost:8000/api/openapi.json. - Generates TypeScript types in
src/frontend/lib/api/generated/schema.ts.
- Fetches
- Register new endpoints in
src/frontend/lib/api.tsandsrc/frontend/lib/structs.ts.
πΊοΈ Endpoint Summary β
| Method | Path | Auth | Invitation (when enabled) | Purpose |
|---|---|---|---|---|
| GET | /api/search?query= | β | β | Search campgrounds/rec areas |
| GET | /api/providers | β | β | List providers |
| GET | /api/provider/{id} | β | β | Single provider |
| GET | /api/campground/{provider}/{id} | β | β | Single campground |
| GET | /api/rec-area/{provider}/{id} | β | β | Single rec area |
| GET | /api/rec-area/{provider}/{id}/campgrounds | β | β | Campgrounds in rec area |
| GET | /api/rec-area/{provider}/{id}/monitoring-campgrounds | β | β | Paginated eligible area campgrounds |
| GET | /api/me | β | β | Current user profile |
| PATCH | /api/me | β | β | Update profile |
| POST | /api/change-password | β | β | Change password (session) |
| GET | /api/me/sessions | β | β | List active password sessions |
| DELETE | /api/me/sessions/{session_id} | β | β | Revoke a password session |
| GET | /api/scans | β | β | List user scans |
| POST | /api/scans | β | β | Create scan |
| GET | /api/scans/{id} | β | β | Scan detail |
| PATCH | /api/scans/{id} | β | β | Update scan |
| DELETE | /api/scans/{id} | β | β | Delete scan |
| GET | /api/health | β | β | Health check |
| GET | /api/admin/overview | β (Admin) | β | Admin KPI overview |
| GET | /api/admin/users | β (Admin) | β | List users with status |
| POST | /api/admin/users | β (Admin) | β | Create user with credentials |
| GET | /api/admin/users/{id} | β (Admin) | β | User details and audit |
| PATCH | /api/admin/users/{id} | β (Admin) | β | Update user (scanning, invite, role) |
| GET | /api/admin/access-requests | β (Admin) | β | List invitation requests |
| PATCH | /api/admin/access-requests/{id} | β (Admin) | β | Approve or reject access request |
| GET | /api/admin/scans | β (Admin) | β | List all system scans |
| GET | /api/admin/scans/{id} | β (Admin) | β | Scan detail and target info |
| PATCH | /api/admin/scans/{id} | β (Admin) | β | Update scan (toggle active) |
| GET | /api/admin/targets/{id} | β (Admin) | β | Shared target detail |
| GET | /api/admin/audit | β (Admin) | β | Immutable audit event log |
| GET | /api/admin/operations | β (Admin) | β | Celery worker states & queue |
| GET | /api/admin/operations/tasks | β (Admin) | β | Valkey telemetry stream |
| GET | /api/admin/operations/tasks/{id} | β (Admin) | β | Task execution telemetry |
| POST | /api/admin/operations/sync-providers | β (Admin) | β | Dispatch provider catalog sync |
| GET | /api/admin/trends | β (Admin) | β | Prometheus metrics proxy |
Admin contract and monitoring availability β
Admin frontend types reference the generated OpenAPI schema. Run task api:generate after changing response models; task api:check verifies drift without starting a server and runs in CI. Overview returns suspended/dormant counts and the actual overdue threshold (cooldown plus two discovery intervals). Scan lists support target_status=active|overdue|dormant; target detail uses the same status values.
Operations reports broker connectivity separately from worker inspection and marks incomplete snapshots as stale. Queue/discovery outages preserve prior successful values with explicit availability flags. Task-stream outages return available=false, not an empty success. Prometheus outages retain the last successful trend series and timestamp with available=false. Celery inspection remains read-only and browser requests only reach FastAPI.
Admin workload fields are nullable: an unanswered or malformed inspection reply is unknown, while a responding workerβs empty task list is a measured zero. Undefined Prometheus samples retain their timestamps with value: null, preserving chart gaps and table coverage. Recent task records include an optional event_id and one-based attempt; older producer records use their Valkey stream ID for row identity and leave the attempt unknown. History readers exclude records older than 24 hours.
Geographic discovery (public) β
GET /api/search/map/summary returns global filtered total, mappable_total, unmappable_total, and nullable circular bounds. GET /api/search/map adds required west, south, east, north, and zoom (0β19), returning an echoed viewport and at most 512 location/group features. Longitude west > east means an antimeridian crossing; west=-180/east=180 is the full world. Invalid/nonfinite request bounds return 422. Only finite catalog coordinates within Β±90/Β±180 other than lat/lon 0/0 are mapped.
Both routes and GET /api/search/map/members reuse the existing Explore predicates, including PostgreSQL fuzzy matching. Map membership ignores list pagination/sort. Groups aggregate every matching visible row in a server-selected geographic grid; singleton features carry the existing search-result metadata. Global counts differ from visible represented counts. Member requests carry cell_id, the group's captured viewport, and the same filters, plus page_size (default 50, maximum 100) and optional after_id (the previous next_cursor). This keyset interface keeps co-located places reachable without fetching every list page or transferring the catalog.
These routes expose public catalog metadata and make no campsite-availability claim. Each request reflects the current catalog; no cross-request snapshot is guaranteed during metadata refresh. Existing protected scan endpoints still enforce monitoring access. See the mapping API contract. Generate/check types using task api:generate and task api:check.
Test notifications β
POST /api/me/notifications/test accepts the same optional settings fields as PATCH /api/me, merged over the authenticated user's current preferences without persistence. It sends one fixed notification and returns { "status": "sent", "provider": "ntfy" | "pushover" } only on explicit upstream acceptance. Missing Pushover user/application credentials return 400/503, a topic claimed by another user returns 409, invalid settings return 422, and sanitized upstream failures return 502. Authentication (401), eligibility/password/invitation restrictions (403), and cookie-session CSRF checks apply. No worker or active scan is required.