[Epic] M2M API — keyed third-party data API + guest throttling

Open
#416 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
8/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
django, python

Research direction

This is an epic with no code change of its own; the design lives in docs/features/m2m-api/README.md on the branch named in the body. Read that doc first, then the linked child issues, starting with pskillen/meshflow-api#417 (guest endpoint throttling), which the epic says ships independently. Done means the child issues close and the epic's listed deliverables exist, so a newcomer should pick up one child issue rather than this epic.

Written by the indexing model from the issue text.

Description

enhancement

Summary

A read-only, versioned machine-to-machine API at /api/m2m/v1/ for third-party dashboards and analytics. It is separate from the bot ingest API (NodeAPIKey) and the web UI API (JWT).

  • Approved users (Django group m2m_api) mint their own API keys, several per user, after accepting versioned terms: acceptable use, good faith, non-commercial, attribution. Data is licensed CC BY-NC 4.0.
  • Data is aggregates first (packets today, nodes heard, role mix, feeder counts, time series), plus infrastructure nodes with health metrics. Meshtastic and MeshCore are strictly split. No positions.
  • This epic also adds throttling to the existing guest-readable endpoints, which are currently unthrottled, so the M2M terms can't be bypassed by scraping.

Motivating request: a scotmesh-style dashboard (cf. https://meshcore.scotmesh.net/) for the Meshtastic side, linking back to Meshflow node pages.

Design doc: docs/features/m2m-api/README.md (on branch claude/elegant-ramanujan-llmcka until merged)

Key decisions

Topic Decision
Path /api/m2m/v1/ on the existing domain; key management at /api/m2m/keys/ (JWT)
Mint permission Django group m2m_api (or staff), checked only when minting
Request auth API key only: exists, hash matches, not revoked, owner.is_active. No group check per request.
Disabling a user Kills all their keys immediately and stamps them revoked
Group removal Stops new mints only; existing keys keep working
Withdraw One staff operation: remove from group and revoke all keys
Terms bump 90-day grace period, then 403 until re-accepted
"Today" UTC calendar day, documented in feature docs and OpenAPI
Infra roles (MT) nodes.constants.INFRASTRUCTURE_ROLES (ROUTER, ROUTER_CLIENT, REPEATER, ROUTER_LATE). Not CLIENT_BASE.
Infra types (MC) adv_type repeater, room
Feeders Aggregate counts only
Positions Omitted
Opt-out ObservedNode.m2m_opt_out, settable by claimant, managed-node owner or staff. Excluded from per-node output, still counted in aggregates.
Ingress Prod reaches Django only via Cloudflare Tunnel, so CF-Connecting-IP is trusted in prod (behind a setting)
Initial rates Guest 120/min/IP · guest expensive 10/min/IP · JWT user 600/min · M2M 60/min + 5000/day per key, same ceiling per owner

Breakdown (delivery order)

API (meshflow-api)

  • pskillen/meshflow-api#417 Guest endpoint throttling. Ships independently.
  • pskillen/meshflow-api#418 API keys: model, auth, terms, CRUD, throttles
  • pskillen/meshflow-api#419 Staff "withdraw M2M access" (needs #418)
  • pskillen/meshflow-api#420 Node opt-out flag
  • pskillen/meshflow-api#421 v1 Meshtastic data endpoints (needs #418, #420). Unblocks the requester.
  • pskillen/meshflow-api#422 Usage metering (needs #418)
  • pskillen/meshflow-api#423 v1 MeshCore endpoints (needs #421)
  • pskillen/meshflow-api#424 History: role-mix snapshots, infra health (later)

UI (meshflow-ui)

  • pskillen/meshflow-ui#362 Developer / API access page (with #418)
  • pskillen/meshflow-ui#363 Opt-out toggle (with #420)

Done when

  • Guest endpoints are throttled in prod with CF-aware client IPs, and ingest is untouched.
  • An approved user can mint a key in the UI, and the scotmesh-style dashboard can be built against /api/m2m/v1/meshtastic/*.
  • MeshCore endpoints reach parity.
  • openapi-m2m.yaml is published, and ENV_VARS.md, REDIS.md and permissions/README.md are updated.
Dominant language
Python
Stars
1
Forks
0
Avg merge
1d 20h
Merged PRs (30d)
5

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pskillen/meshflow-api

All issues in pskillen/meshflow-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.