Base URL
Endpoints
| Method | Path | Description | Auth |
|---|---|---|---|
POST | /api/auth/register | Create a new user account | Public |
POST | /api/auth/login | Obtain a JWT token | Public |
GET | /api/inventario | List all inventory items | JWT |
POST | /api/inventario | Create an inventory item | JWT |
GET | /api/inventario/{id} | Get a single inventory item | JWT |
PUT | /api/inventario/{id} | Replace an inventory item | JWT |
DELETE | /api/inventario/{id} | Delete an inventory item | JWT |
GET | /api/inventario/{id}/stock?cantidad={qty} | Check stock availability | JWT |
GET | /api/inventario/alertas | List low-stock alerts | JWT |
GET | /api/pedidos | List all orders | JWT |
POST | /api/pedidos | Create an order | JWT |
GET | /api/pedidos/{id} | Get a single order | JWT |
GET | /api/envios | List all shipments | JWT |
POST | /api/envios | Create a shipment | JWT |
GET | /api/envios/{id} | Get a single shipment | JWT |
PATCH | /api/envios/{id}/status?status={status} | Update shipment status | JWT |
Authentication
Every endpoint outside of/api/auth/* requires a valid JWT token. Pass the token in the Authorization header using the Bearer scheme. Tokens are issued by POST /api/auth/login and expire after 24 hours.
Common request headers
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes, for POST/PUT/PATCH requests |
Authorization | Bearer <token> | Yes, for all JWT-protected endpoints |
HTTP status codes
The API uses standard HTTP status codes throughout.| Code | Meaning |
|---|---|
200 | Request succeeded |
201 | Resource created |
204 | No content (successful delete) |
400 | Bad request — malformed body or missing fields |
401 | Unauthorized — token missing, expired, or invalid |
403 | Forbidden — authenticated but not permitted |
404 | Resource not found |
500 | Internal server error |
When the gateway rejects a request with
401, the response body contains a plain-text description: "Token requerido" (missing token) or "Token inválido" (expired or invalid token).CORS
The gateway accepts cross-origin requests from the following origins:| Origin | Use case |
|---|---|
http://localhost:5173 | Local Vite / npm run dev |
http://localhost:3000 | Alternate local dev port |
http://127.0.0.1:5173 | Loopback alias for Vite |
http://localhost | Nginx in Docker |
GET, POST, PUT, PATCH, DELETE, OPTIONS.
Explore by service
Authentication
Register, log in, and obtain a JWT token.
Inventory
Manage products, stock levels, and low-stock alerts.
Orders
Create and retrieve customer orders.
Shipments
Track and update shipment status.