Base URL
All API endpoints are prefixed with:Authentication
The API uses JWT (JSON Web Token) authentication via HTTP-only cookies. After successful login, the server sets atoken cookie that is automatically sent with subsequent requests.
Cookie Configuration
- Name:
token - Type: HTTP-only
- SameSite:
lax - Max Age: 3600000ms (1 hour)
- Secure:
false(development mode)
Authorization
The API implements role-based access control (RBAC) with the following roles:- Usuario: Standard user with access to products and categories
- Administrador: Admin user with full access including user management
Response Format
All API responses follow a consistent JSON structure.Success Response
Indicates if the request was successful
HTTP status code
Success or informational message
Response data payload (null if no data)
Error Response
Always
false for errorsHTTP error status code
Error message
Detailed error information (null if not available)
HTTP Status Codes
The API uses standard HTTP status codes:| Code | Description |
|---|---|
| 200 | Success |
| 201 | Resource created successfully |
| 400 | Bad request or resource not found |
| 401 | Unauthorized (invalid credentials) |
| 403 | Forbidden (insufficient permissions) |
| 500 | Internal server error |
