> For the complete documentation index, see [llms.txt](https://docs.moodymusic.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.moodymusic.xyz/api-reference.md).

# API Reference

The Moody Music backend provides RESTful endpoints for authentication, payments, guild configuration, and real-time events.

## Base URL

The API is served from your configured `VITE_API_URL`. All endpoints prefixed with `/api/`.

## Authentication

| Method | Endpoint                     | Description                |
| ------ | ---------------------------- | -------------------------- |
| GET    | `/api/auth/login`            | Redirect to Discord OAuth2 |
| GET    | `/api/auth/discord/callback` | OAuth2 callback handler    |
| GET    | `/api/auth/user/:discordId`  | Get user premium status    |

## Sections

* Authentication — Discord OAuth2 flow and JWT tokens
* Payments — Razorpay order creation and verification
* Real-Time Events — SSE streams and Redis Pub/Sub
