API Reference

Complete reference for the Anilay Go backend REST API. All request and response bodies use JSON.

Authentication
Endpoints marked with Auth require the header: Authorization: Bearer <access_token>
Access tokens are JWT with a 15-minute lifetime. Refresh tokens last 30 days. When the access token expires, use POST /api/v1/auth/refresh to obtain a new pair.
365 endpoints

System

13

Service health, platform utilities, uploads, telemetry, and mobile integration.

Health

2

Service health and readiness probes.

Platform & Tools

11

Client-facing telemetry for active-session progression and player/source diagnostics. Heartbeats drive presence-minute progression; player events provide source-health diagnostics. Search and user-IP logs are written server-side from existing handlers and middleware. Manage API keys for third-party integrations. Analytics beacon, support forms, and public runtime settings used by the frontend. Expo Push token registration for the iOS/Android app. Tokens are fanned out to the Expo Push API on every in-app notification. User-facing R2 uploads (admin uploads use /admin/r2). These routes live on the Next.js side because the R2 SDK is JS-only; the Go API does not sign or handle R2 writes.

Authentication

24

Registration, sessions, tokens, OAuth, verification, password recovery, and 2FA.

Users & Profiles

31

User accounts, public profiles, customization, and profile inventory.

Users

15

Public user profiles and search. Current-user and lookup endpoints. /users/me returns the full user (profile + settings + customization) — use it instead of /auth/me in the UI.

Profile Customization

16

Apply owned items to profile slots (background, avatar, frame, badge, theme, skin). Customization catalog, gifts and administration. Public catalog and ownership use Store endpoints. Admin writes use one canonical customization contract.

Anime

23

Anime catalog data, page payloads, user lists, and episode social activity.

Catalog & Page Data

13

Browse, search, and get detailed anime information. All endpoints are public and responses are cached. Single merged payload for the anime page (override -> local -> stored Shikimori snapshot). A live Shikimori request is made when the snapshot is missing or still lacks a critical field.

Anime Lists

8

Manage personal anime watch lists. Track status, score, and episode progress.

Episode Social

2

Per-episode likes/dislikes and 1–10 ratings. One reaction + one score per user per (anime, episode).

Community

57

Comments, friendships, collections, news, and user notifications.

Comments

12

Threaded comments on anime pages with up/down voting. Muted users are blocked at /anime/:id/comments POST. Same threaded model as anime comments. Vote via POST /comments/:id/vote and delete via DELETE /comments/:id (shared).

Friends

10

Friend requests, management, and blocking.

Collections

29

User-curated lists of anime. Three-tier visibility: public (indexed on the browse page), unlisted (link-only), private (owner-only). Items store the Shikimori ID plus denormalised title/poster so adding an anime does not require it to exist in our local catalog. Phase 1 covers CRUD + items; groups, social (likes/favorites/views/forks), comments, cover upload, and challenge mode arrive in later phases.

News

2

Admin-authored news posts. Comments use the polymorphic comments table (target_type=news).

Notifications

4

In-app notification management.

Progression

12

Player progress, achievements, quests, coins, and rewards.

Progress

3

Path of Ascension: races (human, elf, vampire, ork), age accrual per watched episode, evolution, and racial passives. Accrual runs inside POST /anime-list/:anime_id/episode with a 15-minute anti-abuse cooldown. Streak resets after 6 hours of inactivity.

Achievements

3

View and manage achievement unlock status.

Quests

2

Weekly staged quest chains with coin rewards.

Economy

4

Virtual currency (coins), daily rewards, and transactions.

Watch Together

10

Shared rooms, synchronization, presence, and watch-party controls.

Chat

95

Messaging, attachments, servers, roles, channels, and moderation tools.

Messages

26

Direct messages (E2EE via Signal-style X3DH + ratcheted AEAD), group DMs, the global announcement channel, and the support queue. Hosted under chat.anilay.com (prod) / chat-staging.anilay.com (staging). WebSocket gateway at /api/v1/chat/ws delivers realtime MESSAGE_CREATE / REACTION / TYPING / READ_RECEIPT events; REST below is the authoritative source for state-changing operations.

Servers, Roles & Channels

69

Discord-style servers with roles, categories, channels, and per-channel permission overrides. Permission model: 64-bit bitflag (see frontend/src/lib/chat/perms.ts for the exhaustive list). Effective perms = @everyone role | user role perms → @everyone channel override → union of user-role channel overrides → user-specific channel override; ADMINISTRATOR and server ownership short-circuit to full. Cached in Redis per (user, channel) with a 60s TTL; every role / override change invalidates the relevant keys.

Store

17

Shop catalog, marketplace transactions, inventory, and merch orders.

Shop & Marketplace

13

Browse and purchase cosmetic items with coins. User-to-user item trading marketplace. Backend-driven store: catalog, purchase/claim, inventory, wishlist, featured. StoreItem JSON uses media_url (mapped from file_url), theme_payload/skin_payload, and per-viewer owned/in_wishlist.

Merch Orders

4

Real-money merch checkout. Payment is provider-agnostic (Stub adapter now — admin confirms; YooKassa later).

Admin

78

All administrator-only operations grouped by product area.

Core

52

Administrative endpoints. Requires authentication AND admin role.

Chat

3

Staff-only endpoints behind RequireAdmin(). Hosted on chat.anilay.com / chat-staging.anilay.com alongside the user-facing chat routes.

Store

12

Store catalog + grants + featured + merch orders. Admin only.

News & Moderation

8

News CRUD, comment-report moderation queue, and episode-social reset. Admin only.

Background Videos

3

Server-side transcoding of uploaded background videos (R2 + ffmpeg).

Changelog

5

Public release history and administrator changelog management.