┌─────────────┐
│New Order │
└──────┬──────┘
│ Polling/Webhook
▼
┌─────────────────────────┐
│Get Order Details │
└──────┬──────────────────┘
│ GET /orders/{id}
▼
┌──────────────────────┐
│Assign Driver │
└──────┬───────────────┘
│ POST /assignDriver
▼
┌──────────────────────┐
│Order Pickup │
├──────┬───────────────┤
│ POST │ /goingToOrigin
│ POST │ /arrivedAtOrigin
└──────┬───────────────┘
│
▼
┌──────────────────────┐
│Order Delivery │
├──────┬───────────────┤
│ POST │ /dispatch
│ POST │ /arrivedAtDestination
└──────┬───────────────┘
│
▼
┌──────────────────────┐
│Verify Code │
└──────┬───────────────┘
│ POST /verifyDeliveryCode
▼
┌─────────────┐
│Delivered ✓ │
└─────────────┘excludeHeartbeat=true parameter to prevent the store from remaining open unintentionally.Authorization: Bearer YOUR_TOKEN header401 Unauthorized error, your token has expired. Request a new one immediately.429 Too Many RequestsRetry-After header indicates how many seconds to wait before retrying| Code | Meaning | What to do |
|---|---|---|
200 | OK | Request successful |
202 | Accepted | Async operation accepted (result will come via event) |
400 | Bad Request | Invalid payload or missing field - check your request |
401 | Unauthorized | Token expired or invalid - renew the token |
403 | Forbidden | No permission for this merchant - check permissions |
404 | Not Found | Order not found or not eligible |
409 | Conflict | Operation invalid for current order state |
412 | Precondition Failed | Order must be in valid state before this action |
422 | Unprocessable Entity | Data rejected by business logic (e.g., wrong code) |
429 | Too Many Requests | Rate limit exceeded - wait before retrying |
500 | Server Error | Server error - retry after 30 seconds |
/assignDriver, /goingToOrigin, etc. return 202 because operations are processed asynchronously.What it means: Your request was accepted, but the result will come via an event (polling or webhook).Example:curl -X POST https://api.ifood.com.br/logistics/v1.0/orders/{id}/assignDriver \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"workerName":"John","workerPhone":"1199999999","workerVehicleType":"MOTORCYCLE"}'
# Response: 202 Accepted (empty body)
# Result: You'll receive an event confirming the assignment/arrivedAtDestination before /dispatchassignDriver → goingToOrigin → arrivedAtOrigin → dispatch → arrivedAtDestination → verifyDeliveryCode/verifyDeliveryCode and the order is not eligible.Common causes:DELIVERY_DROP_CODE_REQUESTED eventarrivedAtDestination before verifying codeDELIVERY_DROP_CODE_REQUESTED event via polling/webhook. If not, the order doesn't require code validation.| Operation | Endpoint | Method |
|---|---|---|
| Assign driver | /assignDriver | POST |
| Notify pickup | /goingToOrigin | POST |
| Confirm pickup | /arrivedAtOrigin | POST |
| Notify delivery | /dispatch | POST |
| Confirm delivery | /arrivedAtDestination | POST |
| Verify code | /verifyDeliveryCode | POST |
| Get order | /orders/{id} | GET |