Troubleshooting 400 Error with Custom Optimization Including Second Depot Visit

Hello,

I am currently developing a routing optimisation script that involves not only standard delivery jobs but also incorporates a visit to a second depot for vehicles that have picked up refrigerated products. Despite ensuring that all job IDs are unique and properly formatted, I’m facing a persistent 400 error with the message { "code": 2, "error": "Invalid or missing id for job." }.

Here is an example payload for one vehicle, including a job representing a visit to the refrigerated depot (refrigerated-depot-1000):

Code:
{
“jobs”: [
{“id”: “1”, “location”: [-2.237471, 53.300451], “service”: 1200},
{“id”: “refrigerated-depot-1000”, “location”: [-2.484544, 53.099061], “service”: 900},
{“id”: “4”, “location”: [-2.214494, 53.347666], “service”: 1200},

],
“vehicles”: [
{
“id”: 0,
“profile”: “driving-car”,
“start”: [-2.354695, 53.310299],
“end”: [-2.354695, 53.310299],
“capacity”: [50],
“time_window”: [28800, 64800]
}
… (Added 2 more vehciles)
]
}

The goal is for the vehicles to visit the second depot after completing any pickups that involve refrigerated items, before proceeding with other deliveries. Each job, including these special depot visits, has a unique ID. Coordinates are provided in the [longitude, latitude] format, and service times are integers representing seconds. This error occurs for all vehicles, suggesting a systematic issue with how the second depot visits are being handled or interpreted by the API.

I have confirmed the API key’s validity and reviewed the latest documentation without identifying any format discrepancies. Could you please assist in diagnosing the cause of this error? Are there specific considerations or requirements for adding such intermediate depot visits in the optimisation requests that I might have overlooked?

Any guidance or insights would be greatly appreciated as I work to implement this feature.

Thank you

Hey,

as stated in the API Playground, we use VROOM to provide the optimization service. The VROOM API docs state that id has to be an integer - which it is not.

Best regards