# Track a delivery

> States, polling and the tracker link.

## States

A delivery's progress is one field: `state`.

| State | Meaning |
| --- | --- |
| `draft` | Created with `draft: true`. Nothing happens until you publish it with `PATCH` and `draft: false`. |
| `pending` | Waiting for a bot. |
| `going_to_pickup` | A bot is on its way to the pickup. |
| `at_pickup` | The bot is at the pickup. Load it now. |
| `going_to_dropoff` | Loaded and on its way. |
| `at_dropoff` | The bot is at the dropoff. Unload it now. |
| `delivered` | Handed off. Final. |
| `going_to_return`, `at_return`, `returned` | Canceled after loading, with a return set: the bot brings the order back. `returned` is final. |
| `canceled` | Someone called it off. Final. |
| `failed` | It could not be completed. Final. |

Pickup-only orders have their own states: see [Pickup-only orders](https://docs.remi.robot.com/delivery/pickup-only).

Next to `state`:

- `paused` is true while the delivery is on hold. `state` keeps the leg it was on.
- `arriving` is true while the bot approaches its next stop. Do not load on it: wait for `at_pickup`.

## Follow a delivery

- Poll [`GET /delivery/{id}`](https://docs.remi.robot.com/delivery/reference#getDelivery), or use your own id with `?id_type=external`.
- Or get every change at your URL: [Webhooks](https://docs.remi.robot.com/delivery/webhooks).
- Give your customer `tracker_url`, a live tracking page.

## Timing

- `estimates.pickup` and `estimates.dropoff` say when the bot arrives and finishes at each stop. `source: actual` means it already happened.
- [`POST /delivery/eta`](https://docs.remi.robot.com/delivery/reference#estimateDelivery) gives arrival times before you create a delivery.
- [`GET /delivery/{id}/route`](https://docs.remi.robot.com/delivery/reference#getDeliveryRoute) returns the path left to drive, to draw on a map.

## Cancel or pause

- [`POST /delivery/{id}/cancel`](https://docs.remi.robot.com/delivery/reference#cancelDelivery) works at any state before the end. After loading, with a `return_point` or `options.return_enabled`, the bot brings the order back.
- [`POST /delivery/{id}/pause`](https://docs.remi.robot.com/delivery/reference#pauseDelivery) stops the bot and alerts our operations team; [`resume`](https://docs.remi.robot.com/delivery/reference#resumeDelivery) continues. It is not an emergency stop.
