Routes

Reverse Route by ID

Reverse the order in which a route visits its stops, for example when the driver would rather run the route from the far end. The route's start and end points stay where they are, and breaks keep their place in the sequence. Every other stop is reversed, and the route's planned times and distances are recalculated for the new order. The response is the updated route in the same shape as GET /routes/{id}.

Reversing deletes every stop and creates it again, so stop ids change. Re-read the route rather than reusing stop ids from before the call. For the same reason, reverse a route before the driver starts it, not once stops are under way or completed. Reversing a dispatched route publishes a routes.edited webhook. is_locked is not enforced (see PUT /routes/{id}).

A route with fewer than two stops (not counting its start, end and breaks) is rejected with 400 INVALID_INPUT. The call is not idempotent: calling it a second time puts the stops back in their original order. A 503 SERVICE_UNAVAILABLE does not prove the reverse failed, so check GET /routes/{id} before you retry.

post/routes/{id}/reverse

Request

  • Base URL: https://api.smartroutes.io/v2
  • URL: https://api.smartroutes.io/v2/routes/{id}/reverse
  • Auth: none declared

Path parameters

idnumber required

ID of the route to reverse.

Response

Successful response

Changes

No recorded changes to this operation across all 1 revision of this API.