Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Ishaq74/concordia/llms.txt
Use this file to discover all available pages before exploring further.
API Architecture
Concordia uses Astro API routes for server-side endpoints. All API routes are located in/src/pages/api/ and follow RESTful conventions.
Base URL Structure
All API endpoints are prefixed with/api/:
Endpoint Categories
- Authentication:
/api/auth/*- Better Auth endpoints (login, register, session) - Admin Blog:
/api/admin/blog/*- Blog management (articles, authors, categories, comments, media) - Admin Services:
/api/admin/services/*- Services management (services, categories, availability, bookings, media) - Admin Organizations:
/api/admin/organizations/*- Organization and member management - Client Auth:
/api/auth-client/*- Client-side auth helpers (verification, password reset) - Profile:
/api/profile/*- User profile management
Request/Response Patterns
Request Format
All API endpoints accept JSON payloads:Response Format
Successful responses return JSON with HTTP 200/201:HTTP Status Codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request (invalid input) |
| 401 | Unauthorized (not authenticated) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Not Found |
| 413 | Payload Too Large |
| 415 | Unsupported Media Type |
| 429 | Too Many Requests (rate limited) |
| 500 | Internal Server Error |
Authentication Requirements
Admin Endpoints
All/api/admin/* endpoints require:
- Active session (cookie or Bearer token)
- Admin role (checked via
guardAdminhelper)
Public Endpoints
/api/auth/*- Open for authentication flows/api/auth-client/*- Open for email verification and password reset
Session Management
Sessions are managed by Better Auth with:- Cookie-based sessions (default)
- Bearer token support (for API clients)
- Session duration: 7 days
- Session refresh: Every 24 hours
- Absolute timeout: 7 days
Rate Limiting
Concordia implements database-backed rate limiting through Better Auth.Configuration
From/src/lib/auth/auth.ts:105-127:
Rate Limits
| Endpoint Type | Max Requests | Window |
|---|---|---|
| Global (per IP) | 100 requests | 1 minute |
| Sign In | 5 attempts | 15 minutes |
| Sign Up | 10 attempts | 1 hour |
Rate Limit Headers
When rate limited, responses include:- HTTP 429 Too Many Requests
- Error message:
"Too many login attempts"or similar
Error Handling
Common Error Codes
| Error Code | Description |
|---|---|
invalid_body | Request body is not valid JSON |
missing_action | Required action field missing |
missing_id | Required id field missing |
not_found | Resource does not exist |
forbidden | User lacks permission |
unknown_action | Invalid action specified |
internal_error | Server error occurred |
Error Response Example
Security Headers
All API responses include security headers:Pagination
List endpoints support pagination via query parameters:Parameters
Page number (1-indexed)
Items per page (max: 100)
Response Format
Filtering & Search
Most list endpoints support filtering:q- Text search (slug, title, email, etc.)status- Filter by status (draft, published, etc.)featured- Filter featured items (true/false)category- Filter by category IDorganizationId- Filter by organization
Example
Audit Logging
All admin actions are logged to theaudit_log table:
Logged Actions
- All CRUD operations (create, update, delete)
- Authentication events (login, logout, signup)
- Member management (invite, remove, role changes)
- Content publication (publish, unpublish)
API Endpoints by Category
Authentication & Users
- Authentication API - Login, registration, email verification, password reset
- Profile API - User profile management (GET, PATCH)
- Users API - Admin user management, roles, bans, sessions
Content Management
- Blog API - Articles, authors, categories, comments, media
Services & Bookings
- Services API - Service listings, categories, availability, bookings (admin)
- Public Bookings API - Customer-facing booking creation
Organizations
- Organizations API - Organization CRUD, members, invitations, profiles
Next Steps
Authentication API
Login, register, and session management
Profile API
User profile CRUD operations
Blog API
Manage articles, authors, and categories
Services API
Service listings, bookings, and availability
Organizations API
Organization and member management
Users API
Admin user management and moderation