Home

Logistics API Documentation

A complete guide to using your logistics system API

1. Authentication (Login)

Authenticate users and generate a JWT token for secure access to the API.

Endpoint:

POST https://cruzvalle.website/api/auth/login

Request Parameters:

Example Request Body:

{ "email": "admin@example.com", "password": "123456" }

Example Response:

{ "success": true, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }

2. Using the JWT Token

Include the generated token in the Authorization header for all API requests.

Header Example:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

The API validates the token before processing any request. Ensure the token is valid and not expired.

3. Operations for Orders

3.1 Create an Order

Add a new order to the system.

Endpoint:

POST https://cruzvalle.website/api/pedidos/crear

Headers:

Authorization: Bearer [YOUR_JWT_TOKEN]

Example Response:

{ "numero_orden": 14522001, "destinatario": "Carlos Perez", "telefono": "50588889999", "precio": 2500, "producto": "Green Coffee - 3", "cantidad": 3, "pais": "Nicaragua", "departamento": "León", "municipio": "León", "barrio": "San Felipe", "direccion": "De la Catedral 2 cuadras al norte.", "zona": "Centro", "comentario": "Entrega urgente", "coordenadas": "12.437532,-86.879175" }

Example Response:

{ "success": true, "message": "Order successfully created", "data": { "id": 15, "numero_orden": 14522001 } }