API Reference
The MySagra REST API allows you to manage all aspects of your sagra (food festival) event — from menus and orders to printers and cash registers.
Base URL
https://your-domain.comURL Structure
| Path | Description |
|---|---|
/auth/* | Authentication endpoints (unversioned) |
/events/* | Server-Sent Events channels (unversioned) |
/v1/* | Versioned API resources |
Authentication
Most endpoints require a Bearer token (JWT) sent in the Authorization header:
Authorization: Bearer <accessToken>Obtain tokens via the Authentication endpoints. Access tokens expire after 15 minutes; use the refresh endpoint to obtain new ones.
The default credentials are admin / admin. For security reasons, change your password immediately after the first login using the Users endpoints.
Common Response Codes
| Status | Description |
|---|---|
200 | Success |
201 | Resource created |
204 | Resource deleted (no content) |
400 | Bad request / validation error |
401 | Unauthorized — missing or invalid token |
403 | Forbidden — insufficient permissions |
404 | Resource not found |
409 | Conflict — duplicate resource |
500 | Internal server error |
Error Format
All errors return a JSON object:
{
"message": "Error description"
}or
{
"error": "Error description"
}Resources
| Resource | Description |
|---|---|
| Authentication | Login, logout and token refresh |
| Users | User management (admin only) |
| Categories | Menu category management |
| Foods | Food item management |
| Ingredients | Ingredient management |
| Orders | Order lifecycle management |
| Printers | Thermal printer management |
| Cash Registers | Cash register management |
| Events (SSE) | Real-time Server-Sent Events |
Last updated on