API Error Guide: How to identify and solve them (400 vs 500)
When integrating with Logcomex APIs (LogManager, NCM Intel, Shipment Intel, etc.), the most important response for your diagnosis is the HTTP Status Code.
Before opening a ticket, check the received code to understand if the necessary action is on your side (client) or ours (server).
1. Client errors (4xx) - Action required: fix your code
These errors indicate that the sent request has formatting, authentication, or data issues. The server rejected the request.
-
400 Bad Request (invalid syntax)
-
What it means: The sent JSON is poorly formatted (extra comma, missing quotes) or you sent the wrong data type (e.g., sent text in a field requiring a number).
-
How to solve: Validate your JSON in a Linter. Check the documentation to ensure mandatory fields are filled and data types (String, Integer, Boolean) are correct.
-
-
401 Unauthorized (authentication failure)
-
What it means: The system did not recognize who you are. Usually issues with the API Key or Token.
-
How to solve:
-
Check if the
x-api-keyorAuthorizationheader is written correctly. -
Check for white spaces before or after the key.
-
Confirm if your key is still active with your Account Manager.
-
-
-
404 Not Found
-
What it means: The Endpoint (URL) is wrong or the Resource ID you tried to fetch does not exist.
-
How to solve: Check the URL spelling in the official documentation. If searching by ID (e.g., specific container), confirm that this ID actually exists in the database.
-
-
429 Too Many Requests (rate limiting)
-
What it means: You exceeded the request limit per month of your plan.
-
How to solve: Implement a backoff logic in your code. Wait a few seconds before retrying.
-
2. Server errors (5xx) - Action required: wait or report
These errors indicate that your request arrived correctly, but the Logcomex server (or an external source) failed to process it.
-
500 Internal Server Error / 502 Bad Gateway
-
What it means: Internal failure or momentary instability.
-
Common scenario in logistics: Many of our APIs query government sources in real-time (Portal Único, Mercante, Sefaz). If these portals are unstable or down, our API will return a 5xx error.
-
How to solve:
-
Wait 5 to 10 minutes and retry.
-
If the error persists for more than 1 hour, open a support ticket.
-
-
-
504 Gateway Timeout
-
What it means: The data source took too long to respond, and the connection expired.
-
How to solve: Wait and retry later.
-
3. How to report an error to the Support team?
If you identified a persistent error or bug, send the information below to speed up technical analysis (without this data, resolution time increases):
-
Full Endpoint: (e.g.,
POST https://api-prd-logmanager.logcomex.io/api/v1/search) -
The Sent Payload (Body): (The exact JSON you sent).
-
The Full Error Response: (The code and JSON message the API returned).
-
Time of attempt: Exact date and time.