Wolt Drive API error handling
Managing both expected and unexpected errors is crucial when integrating with Wolt Drive APIs.
API relies on standard HTTP response codes to indicate the outcome of API requests. Status 5XX should be retried, while retrying any of the requests with 4XX status will result in the same response. Retries should follow a retry strategy with maximum 5 retries per request and, if possible, exponential back-off (increased time between retries).
A clear feedback loop for errors is needed to keep users informed of delivery unavailability or any mishaps. Additionally, error responses should be logged for further analysis.
Senders or recipients should never need to double-check delivery status by contacting support. Do not indicate a delivery is in progress if it failed at creation. These features are tested by Wolt during integration tests.
Status code | Procedure | Explanation |
---|---|---|
2XX | Success | Successful operation |
400 | Do not retry | Payload error, or delivery unavailable. See the response payload for details. |
401 | Do not retry | Unauthorized. The Bearer token ("merchant key") does not match with the resource ID in path. |
404 | Do not retry | Invalid resource ID in path parameters, wrong venue/merchant ID. Invalid shipment promise ID. |
422 | Do not retry | Request payload did not pass validation. Location and reason is detailed in the error response. |
429 | Wait before retry | Abnormally large number of requests was received. Wait 5 seconds to 1 minute before retrying. |
500 | Retry | General error. Retry the request. If the issue persists, please contact your Wolt contact person. |
Standard error response formats
400 Invalid payload
In the provided example, dropoff location is too far from the pickup location. Standard format applies to venueful and venueless endpoints. Webhook service and order modification endpoints may have different response formatting, detailed in their documentation.
See the list of error codes below.
{"error_code": "DROPOFF_OUTSIDE_OF_DELIVERY_AREA","reason": "Dropoff location is outside of the delivery area","details": "Delivery distance between pickup and dropoff (10711m) is longer than maximum allowed distance (8000m)"}
401 Unauthorized
In the provided example, used merchant key does not allow access to merchant's resources.
{"detail": "Token not found for the given key and author"}
404 Not found
In the provided example, venue ID does not exist in the system.
{"detail": "Not Found"}
Additionally, shipment promise ID does not exist in the system.
{"error_code": "SHIPMENT_PROMISE_NOT_FOUND","reason": "Shipment promise not found","details": "Shipment Promise not found for the given id: {id}"}
422 Unprocessable Entity
In the provided example, recipient phone number does not pass validation.
{"detail": [{"type": "value_error","loc": ["body", "recipient", "phone_number"],"msg": "Value error, Impossible phone number: {phone_number}"}]}
500 Generic Internal Error
{"error_code": "GENERIC_INTERNAL_ERROR","reason": "Internal server error","details": ""}
Error codes
Error code | Explanation | Action |
---|---|---|
SHIPMENT_PROMISE_NOT_FOUND | Shipment promise ID is invalid or promise is expired. | Create a new shipment promise and use its ID to create a delivery. |
DROPOFF_OUTSIDE_OF_DELIVERY_AREA | Dropoff location is outside of the delivery area. | Do not allow creating a Wolt Drive delivery to this location. |
INVALID_DROPOFF_ADDRESS | Dropoff location is invalid. | Verify dropoff location details. |
INVALID_PICKUP_ADDRESS | Invalid pickup address. | Verify pickup location details (venueless). |
INVALID_PAYLOAD | General invalid payload. | Fix the request payload by following the response details. |
REQUEST_OUTSIDE_DELIVERY_HOURS | Delivery requested outside delivery hours. | Do not allow creating a Wolt Drive delivery, or do not allow the selected delivery time. |
INVALID_SCHEDULED_DROPOFF_TIME | Invalid scheduled dropoff time. | Do not allow creating a Wolt Drive delivery on the selected delivery time. |
CASH_ON_DELIVERY_DISABLED | Delivery order includes cash fields but cash has been disabled. | Do not allow cash orders. |
DELIVERY_NOT_ENABLED_FOR_DELIVERY_AREA | New deliveries in this area are currently disabled. | Do not allow creating a Wolt Drive delivery at this time. |
DELIVERY_AREA_CLOSED | Delivery area is closed. | Do not allow creating a Wolt Drive delivery at this time. |
DELIVERY_AREA_CLOSED_TEMPORARILY | Delivery area is closed temporarily. | Do not allow creating a Wolt Drive delivery at this time. |
DUPLICATE_ORDER | Duplicate order exists with same merchant reference id. | Check if a duplicate order exists, or change the merchant reference ID. |
VENUE_CLOSED | Delivery from the venue is not possible at this time. | Do not allow creating a Wolt Drive delivery at this time. |
MISSING_MERCHANT_CONFIGURATION | Account is not configured correctly. | Contact Wolt to fix. |
B2B_CONFIG_NOT_FOUND | Account is not configured correctly. | Contact Wolt to fix. |
CORPORATE_PAYMENT_METHOD_NOT_FOUND | Account is not configured correctly. | Contact Wolt to fix. |
DELIVERY_CONFIG_MISSING_PRICING | Delivery area is not configured correctly. | Contact Wolt to fix. |
VENUE_ORDER_LIMIT_EXCEEDED | Order limit exceeded. | Contact Wolt to fix. |
GENERIC_INTERNAL_ERROR | Generic internal error. | Retry the request. If the error persists, contact Wolt for further analysis. |