Skip to main content

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:
x-api-key
string
required
Your API key for accessing the API endpoints

JWT Token Authentication

For protected endpoints, include a JWT token in the Authorization header:
Authorization
string
required
Bearer token in the format: Bearer <token>
The JWT token is obtained after successful registration or login and is valid for 8 hours.

Request Format

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"

Response Format

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

400
Bad Request
The request was invalid or missing required fields
401
Unauthorized
Authentication failed or token is invalid
403
Forbidden
Invalid API Key or insufficient permissions
404
Not Found
The requested resource was not found
409
Conflict
Resource already exists (e.g., email already registered)
500
Internal Server Error
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.

Build docs developers (and LLMs) love