Errors — Shipping API
Read a Shipping API error, know what its code means, and decide what to do next.
Every integration hits errors. This page tells you how to read them, what they mean, and what to do — so you can unblock yourself without opening a ticket.
Error response format
The Shipping API wraps errors inside a meta / error object:
{
"meta": "error",
"error": {
"code": 1125,
"description": "Invalid Option",
"message": "No hay cobertura para el destino seleccionado."
}
}| Field | Type | Description |
|---|---|---|
meta | string | "error" for error responses |
error.code | int | Numeric application error code — not an HTTP status |
error.description | string | Short error category (e.g., "Invalid Option") |
error.message | string | Human-readable detail, often relayed from the carrier |
Checkmeta, not the HTTP statusMost Shipping API errors return HTTP
200with"meta": "error"in the body. If your client only branches on the HTTP status code, it will treat failures as successes. Always inspectmetafirst.
Authentication errors are the exception — they return a plain-text string instead of JSON:
"Authentication error."
Handle this by checking the Content-Type header, or by wrapping JSON parsing in a try/catch.
Before you write your error handling
Two things to know about error.code as it stands today:
- A code can cover more than one situation.
1129, for example, is used both for "too many tracking numbers in one request" and for "no coverage for the selected addresses". error.messageis not stable. It is relayed from the carrier, so it arrives in Spanish, English, Portuguese or French depending on which carrier answered.
So: branch on the family (the groups below), never on error.message text. We are working on disambiguating the codes; any change will be announced in the Changelog with a transition period.
Error families
🗺️ Coverage — 1102 1125
1102 1125The carrier does not serve that origin or destination.
What to do: quote with a different carrier. This is expected, not a bug in your integration — coverage in Latin America varies a lot by postal code.
How to avoid it: validate the postal code with the Geocodes API before quoting, and quote several carriers in parallel rather than one.
📦 Service capability — 1100 1105 1145
1100 1105 1145The carrier has coverage, but does not accept that kind of shipment: pallets, that weight, or international.
Typical messages: Doesn't support pallet · Doesn't support international shipments · Doesn't support more than {n}kg for package unit
What to do: choose a different service.
❓ Codes with several meanings — 1126 1129
1126 1129These two codes carry several unrelated meanings, depending on the carrier:
| Code | What the message said | What it actually was |
|---|---|---|
1126 | No se ha encontrado el Código DANE de la Ciudad Destino | Your address: a Colombian city holding a name instead of the DANE code |
1126 | Erro desconhecido com os Correios · Client authentication failed | The carrier's side failing |
1126 | No applicable coverage found | Coverage |
1129 | Service not found for carrier Estafeta. | A service code that does not exist |
1129 | For shipments in Brazil, it is necessary to provide the DC-e or NF-e information. | A missing fiscal document |
1129 | Cobertura solo en bogotá | Coverage |
What to do: show the message to a person, and fix the request if it names a field. Do not treat these codes as coverage and move on to the next carrier: in Colombia, the next one may accept a wrong address.
🧾 Quoted, but cannot be booked — 1172
1172The quote offered the service, and the label call refuses it:
{ "meta": "error", "error": { "code": 1172, "message": "SERVICE_QUOTE_ONLY",
"description": "This service is currently restricted to quoting only; new shipments cannot be created with it.",
"scope": "service", "selfImposed": false } }The quote does not mark these services. Estafeta ground is one.
What to do: try the next service from the same quote, and stop offering the quote-only one to your buyer. Do not retry the same service.
🧮 Declared value and items disagree — 1212
1212With dutiesPaymentEntity: "envia_guaranteed", the package's declaredValue and the sum of its items[].price must agree within 15%:
{ "meta": "error", "error": { "code": 1212, "message": "Declared value (4.75 USD) diverges 94.41% from the sum of the package items (84.95 USD), above the 15% limit allowed for envia_guaranteed shipments" } }The usual cause is the currency, not the arithmetic. declaredValue is read in your account's currency, and items[].price in the origin country's — and neither follows settings.currency. A Mexican account that writes an USD 85 product as 85 declares 85 MXN.
What to do: write both values in the currency the API reads them in, and make them match.
✍️ Missing or invalid data — 1127 1220
1127 1220A required field is missing, or a value exceeds its maximum length.
Typical messages: El número de teléfono del origen es requerido · NIT/CC destino no puede ser vacío o tener un tamaño inválido · The value of {field} is too long
This is the one family that is always fixable on your side.
How to avoid it: check Address requirements by country before building the shipment. Required fields change per country and per carrier — in Mexico some carriers refuse a label without the colonia in district, Brazil needs a CPF or CNPJ in identificationNumber, Colombia resolves by city rather than postal code — and every country needs number and postalCode on the label, see Addresses by Country. This is the most common cause of failures in new integrations.
🚚 Unknown carrier or service — 1101 1140
1101 1140The carrier or service you sent does not exist, is spelled differently, or is not enabled for your account. A service code typed by hand — estafeta_terrestre where the code is ground — also lands here, as 1129 (next family).
What to do: read the available services from Get services for your country and shipment type, and use the identifier exactly as returned. Do not type them by hand.
DHL also answers 1140 ("Price plan requested not found") when it has no price for the route, and that is what a destination postal code that does not exist gets. If the carrier and the service came from the catalog, read 1140 from DHL as no coverage for that route.
💳 Insufficient balance — 1110
1110There is no balance to charge the label against.
What to do: add funds. Do not retry automatically — the retry will fail the same way and may trigger alerts on your side.
🔍 Not found — 1115 1116 1128
1115 1116 1128The shipment, label or pickup does not exist.
What to do: check the number. If you have just created the label, wait a moment: several carriers take minutes to register the tracking number in their own systems. A 1128 immediately after generate is almost always this, not a real error.
🚫 Cancellation rejected — 1120
1120The shipment can no longer be canceled.
What to do: each carrier has its own cancellation window, and once the parcel has been picked up it usually cannot be canceled at all. Check the shipment status before attempting.
🚧 The carrier does not support that action — 900
900{ "error": { "code": 900, "description": "Invalid Action",
"message": "Carrier castores doesn't have the action rateFtl" } }Not every carrier does everything. Pickups, branch lookups, freight and returns are each a separate capability, and the mix differs by carrier and by country.
What to do: check before you offer it. GET /carrier-actions lists what each carrier supports in a country and needs no token. Do not infer capability from the fact that a carrier returned a rate.
📦 One pickup a day is enough — 1130
1130{ "error": { "code": 1130,
"message": "Pickup already scheduled today, you only need 1 pickup to ship all of your packages." } }A second pickup request on the same day is refused. It is not an error in your integration — the carrier is already coming, and everything you label today goes with it.
What to do: treat it as success. If you label shipments through the day, schedule the pickup once and add tracking numbers to that one rather than asking again per shipment.
📮 A pickup needs a shipment first — 1131
1131{ "error": { "code": 1131, "description": "Invalid Option",
"message": "No shipment found for this postal code." } }A pickup is a collection of shipments you have already created, not a standalone booking. A request from an origin postal code with no shipments waiting is refused, and the message does not say why.
What to do: create the labels first, then schedule the pickup from the same origin postal code. If you schedule per order, you will hit 1130 instead: one pickup covers everything you label that day.
📅 Pickup day rejected — 1139
1139The carrier will not collect on the date you asked for.
What to do: carriers refuse weekends, public holidays, dates too far out, and — late in the day — same-day requests. The message does not say which of those it is. Ask for the next business day, and treat this as a prompt to offer the buyer another date rather than as a failure.
⚙️ Carrier error — 1300 1401
1300 1401The carrier returned an error of its own, or authentication against its system failed. error.message usually carries the carrier's original text.
What to do: retry with exponential backoff (for example 1s, 2s, 4s, up to 3 attempts). If it persists for more than a few minutes, the carrier is probably down — quote with another one. Sustained 1401 on a single carrier may be a credential problem on our side: open a ticket.
One error shape that does not follow the rule
Most failures answer { "meta": "error", "error": { … } }. An unhandled exception answers something else entirely:
{ "code": 400, "message": "Unmanaged exception: ErrorException",
"description": "Undefined property: stdClass::$confirmation",
"reference": "ep-6abc1c8bf2544" }There is no meta, so a client that checks meta === 'error' reads it as a success and then fails on a body that has none of the fields it expected.
What to do: treat a response with no meta as a failure too. The reference is worth logging — quote it in a ticket and we can find the exact request.
A label request that does not answer
Creating a label can take a while, because Envia waits for the carrier. If POST /ship/generate/ times out on your side, or answers with an HTML page instead of JSON, the label may exist and be charged anyway.
In sandbox, a Guatemala label answered with an HTML error page. The shipment had been created, with status Created, and had been charged.
What to do: do not retry blindly: a second request buys a second label. First list the shipments created since your request with List shipments, using date_from and date_to, and look for one to the same destination. If you find it, use it or cancel it. Retry only when it is not there.
Recommended handling pattern
async function shipOrHandle(url, opts) {
const res = await fetch(url, opts);
const body = await res.json(); // may throw on auth errors — see above
if (body.meta === 'error') {
const code = body.error.code;
const RETRYABLE = [1300, 1401];
const NO_COVERAGE = [1102, 1125];
const BAD_DATA = [400, 1127, 1220]; // 400: a required field is missing or too long
const AMBIGUOUS = [1126, 1129]; // several meanings — a person reads them
const QUOTE_ONLY = 1172;
if (RETRYABLE.includes(code)) return retryWithBackoff();
if (NO_COVERAGE.includes(code)) return tryAnotherCarrier();
if (code === QUOTE_ONLY) return tryNextServiceFromSameQuote();
if (BAD_DATA.includes(code)) return showToUser(body.error.message);
if (AMBIGUOUS.includes(code)) return showToUser(body.error.message);
if (code === 1110) return alertLowBalance(); // never retry
logForReview(body.error); // unknown code: log it, don't guess
}
return body.data;
}Five rules:
- Never retry
1110. It is a balance problem, not a transient failure. - Never match on
error.messagein code. It changes without notice and arrives in several languages. Where the code is ambiguous —1126,1129— the answer is to show the message to a person, not to parse it. - Always log unknown codes instead of treating them as generic. That is how you find out something changed on our side.
- A schema error is
"code": 400inside an HTTP 200, not an HTTP 400. Required property missing and String is too long both come this way. - The message of a
400repeats your whole request, the recipient's name, email and phone included:Required property missing: postalCode, data: {...}. Show it to the person who sent the request, not to a buyer, and remove the personal data before you log it.
Management API errors
The Management API (queries.envia.com) does not use the meta / error envelope: it reports failures with standard HTTP status codes and a statusCode / error / message body. If your client talks to both APIs, handle each shape separately — see Error Response Format.
Next steps
Updated 13 days ago