API Overview
Sunday exposes a RESTful API for all operations. All endpoints are under /api/.
Base URL
http://localhost:3000/apiIn production:
https://your-domain.com/apiAuthentication
Most endpoints require a valid JWT token in the Authorization header:
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...Get a token via the /api/auth/signin endpoint.
Request Format
All POST/PATCH requests should use JSON:
Content-Type: application/jsonResponse Format
Responses are JSON with consistent structure:
Success Response
{
"success": true,
"data": { ... }
}Error Response
{
"error": "Error message",
"details": ["Field-specific errors"]
}HTTP Status Codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request (validation error) |
| 401 | Unauthorized (invalid/missing token) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Not Found |
| 429 | Too Many Requests (rate limited) |
| 500 | Internal Server Error |
Rate Limiting
API endpoints are rate limited to prevent abuse:
| Endpoint Type | Limit | Window |
|---|---|---|
| Auth endpoints | 5 requests | 1 minute |
| Sensitive operations | 10 requests | 1 minute |
| General API | 60 requests | 1 minute |
Rate limit headers are included in responses:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 2025-01-15T12:00:00.000ZWhen rate limited, you'll receive:
HTTP/1.1 429 Too Many Requests
Retry-After: 45
{
"error": "Too many requests",
"message": "Rate limit exceeded. Please try again later."
}Validation
All inputs are validated using Zod schemas. Invalid requests return 400 with details:
{
"error": "Validation failed",
"details": [
{
"path": ["email"],
"message": "Invalid email format"
}
]
}Pagination
List endpoints support pagination:
GET /api/tasks?page=1&limit=20Response includes:
{
"data": [...],
"pagination": {
"page": 1,
"limit": 20,
"total": 150,
"totalPages": 8
}
}API Endpoints
Authentication
POST /api/auth/signup- Create accountPOST /api/auth/signin- Sign inPOST /api/auth/forgot-password- Request resetPOST /api/auth/reset-password- Reset passwordGET /api/auth/verify-email- Verify emailGET /api/auth/me- Get current user
Boards
GET /api/boards- List boardsPOST /api/boards- Create boardGET /api/boards/:id- Get boardPATCH /api/boards/:id- Update boardDELETE /api/boards/:id- Delete boardPOST /api/boards/:id/invite- Invite member
Tasks
GET /api/tasks- List tasksPOST /api/tasks- Create taskGET /api/tasks/:id- Get taskPATCH /api/tasks/:id- Update taskDELETE /api/tasks/:id- Delete task
Workspaces
GET /api/workspaces- List workspacesPOST /api/workspaces- Create workspacePATCH /api/workspaces/:id- Update workspaceDELETE /api/workspaces/:id- Delete workspace