Skip to Content
v1.5Official documentation for the LX CloudPos API · stable in production
v1.5 (current)ErrorsError structure

Error structure

The API returns errors in two formats depending on the type of failure. The simple format is used for business errors; the detailed format appears when request model validation fails (ASP.NET ProblemDetails).

Simple format

{ "error": "Producto 999 no encontrado." }

Detailed format (model validation)

{ "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1", "title": "One or more validation errors occurred.", "status": 400, "errors": { "Lineas": ["The Lineas field is required."], "Cliente.IdCliente": ["The IdCliente field must be greater than 0."] } }

Recommendation for the client

function extractError(response) { if (response.data?.error) return response.data.error; if (response.data?.errors) { return Object.entries(response.data.errors) .map(([campo, mensajes]) => `${campo}: ${mensajes.join(', ')}`) .join('; '); } return `HTTP ${response.status}`; }