# Partner API reference

> The endpoints your fleet serves, and REMI calls.

The HTTP API your fleet serves in HTTP mode. REMI calls it to read bot state and to send commands.

- Base URL: `https://fleet.example.com`
- Auth: REMI sends the token you set with `PATCH /fleet` as `Authorization: Bearer <token>`.
- OpenAPI document: https://docs.remi.robot.com/openapi/fleet-partner.json

## State

REMI calls this to read your bots.

### List bots with state

`GET /bots`

REMI polls this while your transport is `http` and you are not pushing state. Return every bot on every call, complete, without pagination: a bot left out, or with an invalid state, counts as a failed sample for that bot.

- Answer within 5 seconds and under 1 MiB. REMI never runs two polls at once: the interval (`poll_interval_active_ms` while any bot holds a job, `poll_interval_idle_ms` otherwise) starts when the previous answer ends.
- A bot becomes disconnected after 3 failed or missing polls in a row, or when its state is 60 seconds old. It reconnects after 2 polls in a row with `connected: true` and a fresh `timestamp`.

Response 200: Every bot of the fleet.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bots` | `BotState[]` | yes | Complete bot states, as `BotState`. |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 401 |  | Reject a missing or wrong bearer token. REMI counts any non-2xx answer as a failed poll. |
| 500 |  | Any other non-2xx status, a timeout, or a body that is not `{ "bots": [...] }` counts as a failed poll for every bot. |

Example response:

```json
{
  "bots": [
    {
      "bot_id": "ACME-4T001",
      "seq": 88214,
      "timestamp": "2026-06-17T15:48:08.000Z",
      "available": true,
      "connected": true,
      "position": {
        "lat": 4.6498,
        "lng": -74.0712,
        "azimuth": 90.3
      },
      "battery": {
        "percentage": 74
      },
      "motion": {
        "speed_mps": 0
      },
      "door": "closed",
      "current_command": {
        "id": "ES-5867/pickup",
        "state": "succeeded",
        "accepted_at": "2026-06-17T15:46:31.220Z",
        "updated_at": "2026-06-17T15:48:05.400Z"
      }
    },
    {
      "bot_id": "ACME-4T002",
      "seq": 51002,
      "timestamp": "2026-06-17T15:48:08.000Z",
      "available": false,
      "connected": true,
      "position": {
        "lat": 4.6498,
        "lng": -74.0712,
        "azimuth": 90.3
      },
      "battery": {
        "percentage": 31
      },
      "motion": {
        "speed_mps": 1.4
      },
      "door": "closed",
      "current_command": {
        "id": "ES-5868/dropoff",
        "state": "executing",
        "accepted_at": "2026-06-17T15:47:55.000Z"
      }
    }
  ]
}
```

## Commands

REMI calls this to give a bot an order.

### Accept a command

`POST /bots/{bot_id}/commands`

REMI gives one bot one command and expects 202 as soon as it is queued, not when the bot finishes. Progress comes back in `current_command` of the bot state.

- Be idempotent on `(bot_id, id)`. An unconfirmed command is resent with the same `id` every 10 seconds, 3 sends in total.
- Only 202 with a valid `CommandStatus` body counts as received. Any other 2xx, or an invalid body, is treated as not received and resent.
- A 202 body with `state: rejected` ends the command. With `state: failed` (its mission already ended), REMI sends a `navigate_to` again under a new id, `<id>~1`, `<id>~2` and so on, at most 5 times.
- A `navigate_to` during another navigation must replace it if you declared `supports_command_interrupt: true`. Otherwise REMI sends `cancel_navigation` first and waits for it.
- `set_door` is never sent to a bot with `has_door: false`, and `closed` never to one with `manual_close_door: true`.
- A corrected destination is information: REMI neither resends nor cancels, and expects the bot to drive to `corrected_position`. Report `position` and `motion` so REMI can see the bot stop within 25 m of it.

Answer a 4xx with a problem body whose `code` is one of the codes below. REMI also reads `reason` and `correction_distance_m`.

Path parameters:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bot_id` | `string` | yes | The `bot_id` REMI registered, not the `fleet_serial`. |

Body:

| Field | Type | Required | Description |
| --- | --- | --- | --- |

Response 202: The command is queued.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The command id REMI sent. |
| `state` | `'accepted' \| 'executing' \| 'succeeded' \| 'failed' \| 'rejected'` | yes | `accepted`: queued. `executing`: in progress. `succeeded`, `failed` and `rejected` are terminal. `failed`: accepted but cannot finish. `rejected`: you will not take it, with `error.code` and `rejected_at`. |
| `accepted_at` | `string (date-time)` | no | Required unless `state` is `rejected`. |
| `rejected_at` | `string (date-time)` | no | Required when `state` is `rejected`, absent otherwise. |
| `updated_at` | `string (date-time)` | no | When `state` last changed. |
| `error` | `object` | no | Set when `state` is `failed` or `rejected`. On a rejection, `code` is one of the four rejection codes. |
| `error.code` | `string` | yes |  |
| `error.message` | `string` | yes |  |
| `corrected_position` | `object` | no | Where the bot will really stop when you moved a `navigate_to` destination. Only while `accepted` or `executing`. |
| `corrected_position.lat` | `number` | yes | Latitude in decimal degrees, WGS 84. -90 to 90. |
| `corrected_position.lng` | `number` | yes | Longitude in decimal degrees, WGS 84. -180 to 180. |
| `correction_distance_m` | `number` | no | Meters between the requested destination and `corrected_position`, or, on a `DESTINATION_UNREACHABLE` rejection, your network. |

Errors:

| Status | Code | When |
| --- | --- | --- |
| 404 | `BOT_NOT_FOUND` | Unknown bot. Final: REMI does not resend. |
| 409 | `COMMAND_EXPIRED` | `expires_at` is in the past. Final: REMI does not resend. |
| 409 | `BOT_BUSY` | The bot cannot take the command in its current state, not transiently. Final: REMI does not resend. |
| 422 | `UNSUPPORTED_COMMAND` | The bot does not support the command type or a parameter. Final: REMI does not resend. |
| 422 | `DESTINATION_UNREACHABLE` | The destination is too far from your drivable network. Include `correction_distance_m`. Final: REMI does not resend. |
| 500 |  | Any 5xx, a timeout or a network failure means not received: REMI resends the same `id` after 10 seconds, 3 sends in total. |

Example request:

```json
{
  "id": "ES-5867/pickup",
  "type": "navigate_to",
  "params": {
    "lat": 4.6512,
    "lng": -74.0689
  },
  "issued_at": "2026-06-17T15:46:31.000Z"
}
```

Example response:

```json
{
  "id": "ES-5867/pickup",
  "state": "accepted",
  "accepted_at": "2026-06-17T15:46:31.220Z",
  "corrected_position": {
    "lat": 4.6513,
    "lng": -74.0688
  },
  "correction_distance_m": 14.2
}
```

## Types

### Problem

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `string` | yes | Always `about:blank`. |
| `title` | `string` | yes | The HTTP status text. |
| `status` | `integer` | yes | -9007199254740991 to 9007199254740991. |
| `detail` | `string` | yes | Human-readable. Do not parse it: branch on `code`. |
| `instance` | `string` | yes | The request path. |
| `code` | `string` | no | Stable machine-readable error code, when the error has one. |
| `params` | `Record<string, unknown>` | no | Values that explain the error, keyed by name. |

### BotState

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bot_id` | `string` | yes |  |
| `seq` | `integer` | no | Increasing per bot. A state is kept only if its `timestamp` is later than the last accepted one, or equal with a higher `seq`. Without it, states are not ordered. 0 to 9007199254740991. |
| `timestamp` | `string (date-time)` | yes | When the state was measured on your side, not when it was sent. |
| `available` | `boolean` | yes | Whether the bot can take new work right now, by your own verdict. Do not fold in connectivity, staleness or out of service. |
| `out_of_service` | `boolean` | no | True when you took the bot out of service. Operators are alerted while it holds a job, and new `navigate_to` commands are held back. Absent means false. |
| `connected` | `boolean` | yes | Whether you have a live link to the bot. In MQTT mode the broker connection decides instead. |
| `position` | `object` | yes |  |
| `position.lat` | `number` | yes | Latitude in decimal degrees, WGS 84. -90 to 90. |
| `position.lng` | `number` | yes | Longitude in decimal degrees, WGS 84. -180 to 180. |
| `position.azimuth` | `number` | no | Compass bearing in degrees: 0 = North, clockwise, nominally [0, 360). |
| `battery` | `object` | yes |  |
| `battery.percentage` | `integer` | yes | State of charge, 0 to 100. Below 20 the bot gets no new jobs. 0 to 100. |
| `motion` | `object` | no |  |
| `motion.speed_mps` | `number` | yes | Ground speed in meters per second. |
| `door` | `enum` | yes | Cargo door state. Send `unknown` when you cannot read it and `unsupported` when the bot has no controllable door, never `closed`. One of `opened`, `closed`, `opening`, `closing`, `stalled`, `unknown`, `unsupported`. |
| `current_command` | `CommandStatus \| null` | yes | The latest command this bot accepted. REMI counts a command as delivered when its `id` appears here. Null if none yet. |

### BotCommand

### CommandStatus

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The command id REMI sent. |
| `state` | `'accepted' \| 'executing' \| 'succeeded' \| 'failed' \| 'rejected'` | yes | `accepted`: queued. `executing`: in progress. `succeeded`, `failed` and `rejected` are terminal. `failed`: accepted but cannot finish. `rejected`: you will not take it, with `error.code` and `rejected_at`. |
| `accepted_at` | `string (date-time)` | no | Required unless `state` is `rejected`. |
| `rejected_at` | `string (date-time)` | no | Required when `state` is `rejected`, absent otherwise. |
| `updated_at` | `string (date-time)` | no | When `state` last changed. |
| `error` | `object` | no | Set when `state` is `failed` or `rejected`. On a rejection, `code` is one of the four rejection codes. |
| `error.code` | `string` | yes |  |
| `error.message` | `string` | yes |  |
| `corrected_position` | `object` | no | Where the bot will really stop when you moved a `navigate_to` destination. Only while `accepted` or `executing`. |
| `corrected_position.lat` | `number` | yes | Latitude in decimal degrees, WGS 84. -90 to 90. |
| `corrected_position.lng` | `number` | yes | Longitude in decimal degrees, WGS 84. -180 to 180. |
| `correction_distance_m` | `number` | no | Meters between the requested destination and `corrected_position`, or, on a `DESTINATION_UNREACHABLE` rejection, your network. |

### BotEvent

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bot_id` | `string` | yes |  |
| `type` | `'arrived' \| 'blocked' \| 'unblocked'` | yes | `arrived`: a navigation finished. `blocked` and `unblocked` open and close an operator task. |
| `command_id` | `string` | no | Required for `arrived`: the id of the navigation command that just completed. |
| `occurred_at` | `string (date-time)` | yes | When it happened on your side, not when you sent it. |
| `detail` | `Record<string, unknown>` | no | For `blocked`: `{ "reason": string, "message": string }`. |

### FleetCapabilities

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `supports_command_interrupt` | `boolean` | yes | Whether a `navigate_to` sent during another navigation is accepted and replaces it. Fleet-wide. Without a document this is false. |
| `default` | `object` | yes | Applies to every bot unless overridden. |
| `default.has_door` | `boolean` | yes | Whether the bot has a remotely controllable cargo door. False: `set_door` is never sent. |
| `default.supported_commands` | `('navigate_to' \| 'cancel_navigation' \| 'set_door')[]` | yes | The command types this bot accepts. |
| `overrides` | `Record<string, { has_door?: boolean, supported_commands?: ('navigate_to' \| 'cancel_navigation' \| 'set_door')[] }>` | no | Keyed by bot id and merged over `default`, field by field. Default `{}`. |
