AttendiBotAttendiBot

API Reference

HTTP endpoints for the Rust backend API.

This reference documents every HTTP endpoint on the Rust backend (default port 8080). Use it when integrating with the API directly or extending the BFF. Router: backend/crates/bot/src/http/router.rs.

Authentication

Public routes

No authentication required.

Authenticated routes (/api/v1/*)

Require Authorization: Bearer <internal-jwt> header.

The JWT is minted by the web BFF with HS256 using the shared API_INTERNAL_SECRET. Claims:

ClaimDescription
user_idDiscord user ID
guild_idTarget guild ID
expExpiration (60 second TTL)

Each guild-scoped route also verifies the caller has Manage Server permission via Discord REST API.

Webhook route

POST /webhooks/attendance requires x-webhook-secret header matching WEBHOOK_SECRET. Currently returns 501 Not Implemented.


Public endpoints

GET /health

Bot and database health check.

Response: 200 OK

{ "status": "ok" }

GET /verify/session/{session_id}

Verify a voice session Ed25519 signature.

Parameters:

NameTypeDescription
session_idUUIDVoice session identifier

Response: 200 OK

{ "valid": true }

Returns 400 for invalid UUID format.


GET /verify/period/{guild_id}/{period_index}

Verify an archived period snapshot signature.

Parameters:

NameTypeDescription
guild_idIntegerDiscord guild ID
period_indexIntegerArchived period index

Response: 200 OK

{ "valid": true }

Authenticated endpoints (/api/v1)

All routes require JWT auth. Base path: /api/v1/guilds/{guild_id}.

Overview & analytics

MethodPathDescription
GET/overviewGuild overview (occupancy, period, signing status)
GET/leaderboardCurrent period leaderboard
GET/stats?user_id=Per-user stats for current period
GET/channel-stats?channel_id=Per-channel stats
GET/analytics/heatmapActivity heatmap data
GET/analytics/live-occupancyLive voice occupancy

Tracking settings

MethodPathDescription
PATCH/tracking-modeSet Off / Allowlist / Denylist / All
GET/tracked-channelsList tracked channels
POST/tracked-channelsAdd tracked channel
DELETE/tracked-channels/{channel_id}Remove tracked channel
GET/fairnessGet fairness settings
PATCH/fairnessUpdate fairness settings

Fairness settings body:

{
  "pause_on_mute": false,
  "pause_on_deafen": false,
  "pause_when_solo": false,
  "min_session_seconds": 0
}

Period management

MethodPathDescription
PATCH/reset-intervalConfigure reset schedule
POST/reset-nowForce period reset
GET/signing/historyList archived periods

Signing

MethodPathDescription
POST/signing/generate-keysGenerate Ed25519 keypair
POST/signing/unlockUnlock signing key
GET/signing/statusSigning and period status
GET/signing/public-keyGet public verification key
POST/signing/verify-sessionVerify session signature
POST/signing/verify-periodVerify period snapshot

Discord integration

MethodPathDescription
GET/channelsList guild channels
GET/bot-presentCheck if bot is in guild

Log destinations

MethodPathDescription
GET/log-destinationsList log destinations
POST/log-destinationsAdd log destination
DELETE/log-destinations/{destination_id}Remove destination
PATCH/log-destinations/{destination_id}/typesEnable/disable log type
PATCH/log-destinations/{destination_id}/frequencySet periodic frequency

Pro features

MethodPathDescription
GET/export/period/{period_index}Download signed period export
GET/verified-rolesList verified role rules
POST/verified-rolesCreate/update verified role rule
DELETE/verified-roles/{rule_id}Delete verified role rule
GET/webhooks/settingsGet webhook settings
PATCH/webhooks/settingsUpdate webhook settings

Subscription

MethodPathDescription
GET/subscriptionGet subscription tier info
PATCH/subscriptionUpdate subscription tier

Error responses

Authenticated routes return standard error JSON:

{ "error": "description" }
StatusMeaning
401Missing or invalid JWT
403User lacks Manage Server permission
404Resource not found
422Validation error
500Internal server error

Webhook endpoint (not implemented)

POST /webhooks/attendance

Inbound attendance webhook. Requires x-webhook-secret header.

Status: 501 Not Implemented


Edit on GitHub

On this page