๐ API Overview โ
KitchenAsty exposes a RESTful JSON API at /api/.
๐ Base URL โ
http://localhost:3000/api๐ Authentication โ
Protected endpoints require a JWT token in the Authorization header:
Authorization: Bearer <token>Obtain a token via the Authentication endpoints.
๐ฆ Response Format โ
All responses follow a consistent shape:
โ Success โ
json
{
"success": true,
"data": { ... }
}๐ Success with Pagination โ
json
{
"success": true,
"data": [ ... ],
"pagination": {
"page": 1,
"limit": 20,
"total": 150,
"totalPages": 8
}
}โ Error โ
json
{
"success": false,
"error": "Description of the error"
}๐ Pagination โ
List endpoints support pagination via query parameters:
| Parameter | Description | Default |
|---|---|---|
page | Page number | 1 |
limit | Items per page | 20 |
๐ข Common HTTP Status Codes โ
| Code | Meaning |
|---|---|
200 | โ Success |
201 | โ Created |
400 | โ ๏ธ Bad request (validation error) |
401 | ๐ Unauthorized (missing or invalid token) |
403 | ๐ซ Forbidden (insufficient permissions) |
404 | ๐ Not found |
429 | โฑ๏ธ Too many requests (rate limited) |
500 | ๐ฅ Internal server error |
โฑ๏ธ Rate Limiting โ
All /api/ endpoints are rate-limited:
- 100 requests per 15-minute window per IP address
- Returns
429with a JSON error when exceeded - Standard
RateLimit-*headers are included in responses
๐ OpenAPI / Swagger โ
Interactive API documentation is available at:
- ๐ฅ๏ธ Swagger UI: http://localhost:3000/api/docs
- ๐ OpenAPI JSON: http://localhost:3000/api/openapi.json
๐ Health Check โ
GET /api/healthjson
{
"success": true,
"data": {
"status": "ok",
"timestamp": "2025-01-01T00:00:00.000Z",
"version": "1.0.0"
}
}