Base URL
All API requests should be made to:
http://localhost:5000/api
Authentication
The API uses two types of authentication:
API Key Authentication
All requests require an API key to be included in the request headers:
Your API key for accessing the API endpoints
JWT Token Authentication
For protected endpoints, include a JWT token in the Authorization header:
Bearer token in the format: Bearer <token>
The JWT token is obtained after successful registration or login and is valid for 8 hours.
All POST requests should include the following header:
Content-Type: application/json
Example Request
curl -X GET http://localhost:5000/api/product \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json"
All API responses follow a standardized format:
Success Response
{
"status": "OK",
"message": "Success message here",
"data": {
// Response data
},
"metadata": {
// Optional metadata (pagination, etc.)
}
}
Error Response
{
"status": "ERROR",
"message": "Error message describing what went wrong",
"data": null
}
Common Error Codes
The request was invalid or missing required fields
Authentication failed or token is invalid
Invalid API Key or insufficient permissions
The requested resource was not found
Resource already exists (e.g., email already registered)
An error occurred on the server
API Documentation
Interactive Swagger documentation is available at:
http://localhost:5000/docs
The Swagger UI provides a complete reference of all available endpoints with the ability to test them directly from your browser.
Rate Limiting
The API implements logging middleware to track all requests. Ensure you handle requests responsibly to maintain optimal performance.
CORS
Cross-Origin Resource Sharing (CORS) is enabled for all origins. Make sure to include the required headers when making requests from web applications.