API Overview
CodeNotify provides a comprehensive RESTful API for managing competitive programming contest notifications across multiple platforms.
Base URL
Development: http://localhost:3000
Production: https://api.codenotify.devAPI Version
Current version: v1 (no version prefix in URL)
Authentication
Most endpoints require JWT authentication. Include the access token in the Authorization header:
http
Authorization: Bearer <your_access_token>Token Types
- Access Token: Short-lived (15 minutes), used for API requests
- Refresh Token: Long-lived (7 days), used to obtain new access tokens
Request Format
Headers
http
Content-Type: application/json
Authorization: Bearer <access_token>Body
All POST/PATCH requests accept JSON payloads:
json
{
"field1": "value1",
"field2": "value2"
}Response Format
Success Response
json
{
"id": "string",
"field1": "value1",
"field2": "value2",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z"
}Paginated Response
json
{
"data": [...],
"pagination": {
"total": 100,
"limit": 20,
"offset": 0,
"hasNext": true,
"hasPrev": false
}
}Error Response
json
{
"statusCode": 400,
"message": "Error description",
"error": "Bad Request"
}HTTP Status Codes
| Code | Description |
|---|---|
| 200 | OK - Request successful |
| 201 | Created - Resource created successfully |
| 204 | No Content - Resource deleted successfully |
| 400 | Bad Request - Invalid request parameters |
| 401 | Unauthorized - Missing or invalid authentication |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource not found |
| 409 | Conflict - Resource already exists |
| 422 | Unprocessable Entity - Validation failed |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error - Server error |
Rate Limiting
- Default: 100 requests per 15 minutes per IP
- Authenticated: 1000 requests per 15 minutes per user
- Admin: Unlimited
Rate limit headers:
http
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200Pagination
Endpoints returning lists support pagination:
http
GET /contests?limit=20&offset=0Parameters:
limit(default: 20, max: 100) - Number of items per pageoffset(default: 0) - Number of items to skip
Filtering & Sorting
Filtering
http
GET /contests?platform=codeforces&phase=BEFORE&difficulty=MEDIUMSorting
http
GET /contests?sortBy=startTime&sortOrder=ascParameters:
sortBy- Field to sort by (e.g., startTime, createdAt)sortOrder- Sort direction:ascordesc
Search
Full-text search on supported endpoints:
http
GET /contests/search?q=educationalTimestamps
All timestamps are in ISO 8601 format (UTC):
2025-01-01T12:00:00.000ZEnums
ContestPlatform
typescript
enum ContestPlatform {
CODEFORCES = 'codeforces',
LEETCODE = 'leetcode',
CODECHEF = 'codechef',
ATCODER = 'atcoder'
}ContestPhase
typescript
enum ContestPhase {
BEFORE = 'BEFORE',
CODING = 'CODING',
FINISHED = 'FINISHED'
}DifficultyLevel
typescript
enum DifficultyLevel {
BEGINNER = 'BEGINNER',
EASY = 'EASY',
MEDIUM = 'MEDIUM',
HARD = 'HARD',
EXPERT = 'EXPERT'
}UserRole
typescript
enum UserRole {
USER = 'user',
ADMIN = 'admin'
}API Modules
Authentication
- Sign Up - Create new user account
- Sign In - Authenticate user
- Refresh Token - Get new access token
- Sign Out - Invalidate tokens
Users
- Get Profile - Get current user profile
- Update Profile - Update user information
- Delete Account - Delete user account
Contests
- List Contests - Get all contests with pagination
- Get Contest - Get contest by ID
- Filter by Platform - Platform-specific contests
- Upcoming Contests - Get upcoming contests
- Running Contests - Get active contests
- Finished Contests - Get past contests
- Search Contests - Full-text search
- Contest Statistics - Analytics and insights
- Sync Contests - Trigger platform sync (admin)
Notifications
- Get Notifications - List user notifications
- Mark as Read - Mark notification as read
- Test Email - Send test email notification
Examples
cURL
bash
# Login
curl -X POST http://localhost:3000/auth/signin \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","password":"password123"}'
# Get contests
curl -X GET http://localhost:3000/contests \
-H "Authorization: Bearer <access_token>"JavaScript (Fetch)
javascript
// Login
const response = await fetch('http://localhost:3000/auth/signin', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: 'user@example.com',
password: 'password123'
})
});
const { accessToken } = await response.json();
// Get contests
const contests = await fetch('http://localhost:3000/contests', {
headers: { 'Authorization': `Bearer ${accessToken}` }
});Python (Requests)
python
import requests
# Login
response = requests.post('http://localhost:3000/auth/signin', json={
'email': 'user@example.com',
'password': 'password123'
})
access_token = response.json()['accessToken']
# Get contests
contests = requests.get('http://localhost:3000/contests', headers={
'Authorization': f'Bearer {access_token}'
})Webhooks
Subscribe to real-time events:
contest.created- New contest addedcontest.starting- Contest starting sooncontest.finished- Contest endednotification.sent- Notification delivered
Support
- Documentation: https://docs.codenotify.dev
- GitHub: https://github.com/Celestial-0/codenotify
- Issues: https://github.com/Celestial-0/codenotify/issues
Changelog
v0.1.0-beta (2026-01-06)
- Initial beta release
- Auto-login after email verification
- Centralized version management
- Dynamic GitHub-based changelog

