The shipments that go wrong
Most shipments are delivered and you never think about them again. A small share are not: the carrier loses them, damages them, cannot find the address, or customs holds them. Those are incidences, and they are where the money leaks — a package that does not arrive is a refund, a replacement, and a customer who may not come back.
You need this if you run an operation. This is the exception queue, and unattended is the number that costs money: a problem nobody has claimed for yet.
The Incidences API is the queue of those shipments. One row per shipment that entered a problem status, with the claim attending it when one exists.
Incidence vs. ticketAn incidence is a fact: this shipment reached a bad status. A ticket is what you do about it — the claim you file with Envia. One incidence takes one ticket. Until it has one, the incidence is
unattended, and nobody is working it.
What counts as an incidence
An incidence is recorded the moment a shipment reaches one of these statuses. They are managed server-side; read the live list from GET /companies/autoticket-config rather than hardcoding the IDs.
shipment_status_id | Status | What happened |
|---|---|---|
10 | Lost | The carrier cannot locate the package. |
14 | Damaged | The package arrived, or was found, physically damaged. |
21 | Address error | The address could not be resolved by the carrier. |
41 | Wrong address | The package went to the wrong place. |
29 | Customs delay | Held in customs on an international shipment. |
A shipment that is merely late is not an incidence — delays are tracked through the normal shipment status and are claimed as a delay ticket when they pass the promised date.
The loop
GET /shipment-incidences/metrics → how big is the problem right now?
GET /shipment-incidences?attention_status=unattended
→ the backlog: problems with no claim
POST /company/tickets → file the claim (links itself)
GET /shipment-incidences?attention_status=open_ticket
→ what is in progress
1. Size the queue. GET /shipment-incidences/metrics returns four numbers and nothing else. It is the cheap call: poll it on a schedule, and only page through the list when unattended is above zero.
curl --request GET \
--url https://queries.test.envia.com/shipment-incidences/metrics \
--header "Authorization: Bearer $ENVIA_TOKEN"{ "total": 37, "unattended": 12, "open_ticket": 19, "resolved": 6 }2. Pull the backlog. GET /shipment-incidences with attention_status=unattended returns exactly the shipments with a problem and no claim.
curl --request GET \
--url 'https://queries.test.envia.com/shipment-incidences?attention_status=unattended&limit=50' \
--header "Authorization: Bearer $ENVIA_TOKEN"3. File the claim. Each row carries a ticket_type_id — the claim type that matches the problem. Pass it straight through as type_id to POST /company/tickets together with the shipment_id, and the new ticket links itself to the incidence.
curl --request POST \
--url https://queries.test.envia.com/company/tickets \
--header "Authorization: Bearer $ENVIA_TOKEN" \
--header 'Content-Type: application/json' \
--data '{
"type_id": 5,
"shipment_id": 182694,
"comments": "Box crushed on arrival, contents broken."
}'4. Reconcile the odd one out. If a ticket and an incidence were created separately and never matched, PUT /shipment-incidences/{id}/ticket joins them.
Read insurance_status before you promise anything
insurance_status before you promise anythingEvery row says what can actually be recovered:
insurance_status | Meaning | What you can claim |
|---|---|---|
insured | The shipment carries insurance. | The insured value, subject to the claim being upheld. |
uninsured | A value was declared, but no insurance was bought. | Only what the carrier's own liability covers. |
undeclared | No declared value on any package. | Effectively nothing — there is no value on record. |
undeclared is the one that hurts. It is decided at label time, not at claim time: if your integration does not send declaredValue when it generates the label, a lost package has no value to claim against. Fix it upstream, in your call to the Shipping API, not here.
Automatic tickets
By default Envia opens the claim for you when a shipment reaches an incidence status. That is usually what you want: the claim starts moving before anyone looks at a dashboard.
Turn it off, per status, when your system is the one that files claims — otherwise your integration will keep finding a ticket already open on incidences it was about to claim.
curl --request PUT \
--url https://queries.test.envia.com/companies/autoticket-config \
--header "Authorization: Bearer $ENVIA_TOKEN" \
--header 'Content-Type: application/json' \
--data '{ "shipment_status_id": 14, "enabled": false }'With it off for a status, attention_status=unattended becomes a queue you own end to end.
Paging, filtering and roles
- Newest first, always. There is no sort parameter.
limitdefaults to 50. Values of 300 or more silently fall back to 50 — ask for 299 or less.trackingmatches the tracking number or the recipient name, partially. It is the search box, not an exact lookup.shipment_status_idfilters by the status that opened the incidence;guide_status_idby where the shipment is now. A package flagged damaged and later delivered matchesshipment_status_id=14andguide_status_id=3at the same time.- Users on a restricted role only see incidences on shipments they created. A support dashboard that looks empty for one user and full for another is usually this, not a bug.
What this API does not do
- It does not create incidences. They appear from tracking events; there is no endpoint to raise one by hand.
- It does not resolve them. Resolution happens on the ticket — see Tickets Overview.
- It does not cover returns. A package coming back on purpose is a return, not an incidence.
Need Help?Building against the Incidences API and something isn't behaving as expected?
Our support team is ready to help 🚀Create a support ticket here and we'll guide you through setup and troubleshooting.