API Reference Overview
The Ever Works provides a comprehensive REST API built with Next.js API routes. This section documents all available endpoints, authentication methods, and usage examples.
Base URL
Development: http://localhost:3000/api
Production: https://yourdomain.com/api
Authentication
The API supports multiple authentication methods:
1. Session-based Authentication
Used for web application requests:
// Automatic for browser requests with valid session
fetch('/api/items', {
credentials: 'include'
})
2. API Key Authentication
For server-to-server requests:
fetch('/api/items', {
headers: {
'Authorization': 'Bearer your-api-key'
}
})
3. JWT Token Authentication
For mobile or SPA applications:
fetch('/api/items', {
headers: {
'Authorization': 'Bearer your-jwt-token'
}
})
Response Format
All API responses follow a consistent format:
Success Response
{
"success": true,
"data": {
// Response data
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"version": "1.0.0"
}
}