---
title: "Reverse Route by ID"
method: POST
path: "/routes/{id}/reverse"
tags: ["Routes"]
---

# Reverse Route by ID

`POST /routes/{id}/reverse`

## Request

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

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`](#tag/Webhooks/operation/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.

## Path parameters

- `id` number, required

## Response `200`

Successful response

## Other responses

- `403`: Forbidden. Returned for rate-limit exhaustion (`name = FORBIDDEN`, with `details.retry_after_seconds` and `Retry-After` header) and permission gate failures (`name = PERMISSION`). Inspect `name` to disambiguate. Send `x-sr-api-features: rate-limit-429` to receive `429 RATE_LIMIT_EXCEEDED` for the rate-limit case instead, leaving `403` to mean permission failures only — see [API Features](#section/Getting-started/API-Features).
- `404`: The requested resource was not found.
- `429`: Rate limit exceeded (`name = RATE_LIMIT_EXCEEDED`). **Only returned to callers that opt in** with the `x-sr-api-features: rate-limit-429` request header; without it the same condition returns `403` with `name = FORBIDDEN` and an otherwise identical body. See [API Features](#section/Getting-started/API-Features).
- `500`: An unexpected server error occurred. The body carries only `name` and `description`: internal details are never returned.

---

[API](https://skmtc.dev/smartroutes/apis/smartroutes-api.md) · [All operations](https://skmtc.dev/smartroutes/apis/smartroutes-api/llms.txt) · [OpenAPI document](https://skmtc.dev/smartroutes/apis/smartroutes-api/revisions/a7ea507afac7?raw)
