{
  "openapi": "3.1.0",
  "info": {
    "title": "Fleet API",
    "version": "3.0.0",
    "description": "Register your robots with REMI, report their state and events, and declare what they can do."
  },
  "servers": [
    {
      "url": "https://api.remi.robot.com/api/v3"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Fleet",
      "description": "How your fleet is wired into REMI."
    },
    {
      "name": "Capabilities",
      "description": "What your robots can do."
    },
    {
      "name": "Bots",
      "description": "Register, update, retire and list your robots."
    },
    {
      "name": "State and events",
      "description": "Push robot state and events instead of being polled or using MQTT."
    }
  ],
  "paths": {
    "/fleet": {
      "get": {
        "operationId": "getFleetConfig",
        "tags": [
          "Fleet"
        ],
        "summary": "Get fleet configuration",
        "description": "How your fleet is wired into REMI. Read it to confirm what REMI believes before you debug anything else.",
        "x-scope": "fleet",
        "responses": {
          "200": {
            "description": "The configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetFleetConfigResponse"
                },
                "example": {
                  "data": {
                    "namespace": "partner_acme",
                    "bot_id_prefix": "ACME-",
                    "requires_fleet_serial": false,
                    "transport": "http",
                    "base_url": "https://fleet.example.com/v1",
                    "token_set": true,
                    "poll_interval_active_ms": 2000,
                    "poll_interval_idle_ms": 15000,
                    "max_bots": 200,
                    "contract_version": "2026-09",
                    "capabilities": {
                      "supports_command_interrupt": true,
                      "default": {
                        "has_door": true,
                        "supported_commands": [
                          "navigate_to",
                          "cancel_navigation",
                          "set_door"
                        ]
                      },
                      "overrides": {
                        "ACME-4T002": {
                          "has_door": false,
                          "supported_commands": [
                            "navigate_to",
                            "cancel_navigation"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "404": {
            "description": "`FLEET_NOT_CONFIGURED`: No fleet configuration for your namespace yet. Create it with `PATCH /fleet`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "FLEET_NOT_CONFIGURED",
                "when": "No fleet configuration for your namespace yet. Create it with `PATCH /fleet`."
              }
            ]
          }
        }
      },
      "patch": {
        "operationId": "updateFleetConfig",
        "tags": [
          "Fleet"
        ],
        "summary": "Configure the fleet",
        "description": "The first call creates the configuration; later calls change only the fields sent.\n\n- `transport: \"http\"` needs a `base_url` and a token on file.\n- Changing `base_url` needs a new `token` in the same call. A stored token is never carried to a new endpoint.\n- Poll intervals, bot id prefix and namespace are set at onboarding and cannot be changed here.",
        "x-scope": "fleet",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateFleetConfigRequest"
              },
              "example": {
                "transport": "http",
                "base_url": "https://fleet.example.com/v1",
                "token": "k3VnQ8xLw2ZpR7tYb5MdC9sHf1GjA4uE"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The configuration after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateFleetConfigResponse"
                },
                "example": {
                  "data": {
                    "namespace": "partner_acme",
                    "bot_id_prefix": "ACME-",
                    "requires_fleet_serial": false,
                    "transport": "http",
                    "base_url": "https://fleet.example.com/v1",
                    "token_set": true,
                    "poll_interval_active_ms": 2000,
                    "poll_interval_idle_ms": 15000,
                    "max_bots": 200,
                    "contract_version": "2026-09",
                    "capabilities": {
                      "supports_command_interrupt": true,
                      "default": {
                        "has_door": true,
                        "supported_commands": [
                          "navigate_to",
                          "cancel_navigation",
                          "set_door"
                        ]
                      },
                      "overrides": {
                        "ACME-4T002": {
                          "has_door": false,
                          "supported_commands": [
                            "navigate_to",
                            "cancel_navigation"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_ERROR`: Empty body, unknown field, or a value of the wrong type.\n\n`INVALID_BASE_URL`: `base_url` is not an absolute `https` URL.\n\n`TOKEN_TOO_SHORT`: `token` has fewer than 32 characters.\n\n`TOKEN_REQUIRED_WITH_BASE_URL`: `base_url` changes and no new `token` was sent.\n\n`INCOMPLETE_HTTP_CONFIG`: `transport` is `http` and there is no `base_url` or no token on file.\n\n`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "VALIDATION_ERROR",
                "when": "Empty body, unknown field, or a value of the wrong type."
              },
              {
                "code": "INVALID_BASE_URL",
                "when": "`base_url` is not an absolute `https` URL."
              },
              {
                "code": "TOKEN_TOO_SHORT",
                "when": "`token` has fewer than 32 characters."
              },
              {
                "code": "TOKEN_REQUIRED_WITH_BASE_URL",
                "when": "`base_url` changes and no new `token` was sent."
              },
              {
                "code": "INCOMPLETE_HTTP_CONFIG",
                "when": "`transport` is `http` and there is no `base_url` or no token on file."
              },
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "409": {
            "description": "`NAMESPACE_NOT_MQTT_SAFE`: Your namespace is not `[a-z0-9_]+`. Ask Robot.com to change it first.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "NAMESPACE_NOT_MQTT_SAFE",
                "when": "Your namespace is not `[a-z0-9_]+`. Ask Robot.com to change it first."
              }
            ]
          }
        }
      }
    },
    "/fleet/capabilities": {
      "post": {
        "operationId": "setFleetCapabilities",
        "tags": [
          "Capabilities"
        ],
        "summary": "Set fleet capabilities",
        "description": "Replaces the whole document. The document is optional: without one, REMI sends `set_door` to every bot and treats `supports_command_interrupt` as false.\n\n- It describes your hardware, not who is connected. Never send it from an empty or partial roster.\n- A bot whose effective `has_door` is false gets no `set_door`, and its `manual_close_door` is turned on. REMI never turns it back off.",
        "x-scope": "fleet",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCapabilitiesRequest"
              },
              "example": {
                "supports_command_interrupt": true,
                "default": {
                  "has_door": true,
                  "supported_commands": [
                    "navigate_to",
                    "cancel_navigation",
                    "set_door"
                  ]
                },
                "overrides": {
                  "ACME-4T002": {
                    "has_door": false,
                    "supported_commands": [
                      "navigate_to",
                      "cancel_navigation"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetFleetCapabilitiesResponse"
                },
                "example": {
                  "data": {
                    "supports_command_interrupt": true,
                    "default": {
                      "has_door": true,
                      "supported_commands": [
                        "navigate_to",
                        "cancel_navigation",
                        "set_door"
                      ]
                    },
                    "overrides": {
                      "ACME-4T002": {
                        "has_door": false,
                        "supported_commands": [
                          "navigate_to",
                          "cancel_navigation"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_ERROR`: A required field is missing, or a command type is unknown.\n\n`CAPABILITIES_MISSING_REQUIRED_COMMANDS`: `default.supported_commands` lacks `navigate_to` or `cancel_navigation`. Nothing is stored.\n\n`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "VALIDATION_ERROR",
                "when": "A required field is missing, or a command type is unknown."
              },
              {
                "code": "CAPABILITIES_MISSING_REQUIRED_COMMANDS",
                "when": "`default.supported_commands` lacks `navigate_to` or `cancel_navigation`. Nothing is stored."
              },
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "404": {
            "description": "`FLEET_NOT_CONFIGURED`: No fleet configuration for your namespace yet. Create it with `PATCH /fleet`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "FLEET_NOT_CONFIGURED",
                "when": "No fleet configuration for your namespace yet. Create it with `PATCH /fleet`."
              }
            ]
          }
        }
      },
      "patch": {
        "operationId": "patchFleetCapabilities",
        "tags": [
          "Capabilities"
        ],
        "summary": "Update fleet capabilities",
        "description": "Merges into the stored document, which must exist: create it with `POST` first. `default` and `overrides` are replaced whole when sent, so to remove an override, send `overrides` without it.",
        "x-scope": "fleet",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchCapabilitiesRequest"
              },
              "example": {
                "supports_command_interrupt": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored document after the merge.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatchFleetCapabilitiesResponse"
                },
                "example": {
                  "data": {
                    "supports_command_interrupt": false,
                    "default": {
                      "has_door": true,
                      "supported_commands": [
                        "navigate_to",
                        "cancel_navigation",
                        "set_door"
                      ]
                    },
                    "overrides": {
                      "ACME-4T002": {
                        "has_door": false,
                        "supported_commands": [
                          "navigate_to",
                          "cancel_navigation"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_ERROR`: Empty body, unknown field, or an invalid value.\n\n`CAPABILITIES_MISSING_REQUIRED_COMMANDS`: `default.supported_commands` lacks `navigate_to` or `cancel_navigation`. Nothing is stored.\n\n`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "VALIDATION_ERROR",
                "when": "Empty body, unknown field, or an invalid value."
              },
              {
                "code": "CAPABILITIES_MISSING_REQUIRED_COMMANDS",
                "when": "`default.supported_commands` lacks `navigate_to` or `cancel_navigation`. Nothing is stored."
              },
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "404": {
            "description": "`FLEET_NOT_CONFIGURED`: No fleet configuration for your namespace yet. Create it with `PATCH /fleet`.\n\n`CAPABILITIES_NOT_SET`: No document on file yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "FLEET_NOT_CONFIGURED",
                "when": "No fleet configuration for your namespace yet. Create it with `PATCH /fleet`."
              },
              {
                "code": "CAPABILITIES_NOT_SET",
                "when": "No document on file yet."
              }
            ]
          }
        }
      }
    },
    "/fleet/bots": {
      "post": {
        "operationId": "registerBot",
        "tags": [
          "Bots"
        ],
        "summary": "Register a bot",
        "description": "Call once per bot, when it enters service. The bot has no location until Robot.com operations places it, and is not assigned before.\n\n- An existing id is a conflict, not an overwrite: use `PATCH` to change a bot.\n- Registering a retired bot of yours again reactivates it, keeping its stored `fleet_serial` unless you send one.",
        "x-scope": "fleet",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterBotRequest"
              },
              "example": {
                "bot_id": "ACME-4T001",
                "fleet_serial": "AC7F3K2",
                "manual_close_door": true,
                "commercial_name": "Acme 4T001",
                "console_url": "https://console.example.com/robots/4T001",
                "tags": [
                  "acme-fleet",
                  "lockable-door"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The registered bot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisterBotResponse"
                },
                "example": {
                  "data": {
                    "bot_id": "ACME-4T001",
                    "namespace": "partner_acme",
                    "location_id": null,
                    "fleet_serial": "AC7F3K2",
                    "manual_close_door": true,
                    "commercial_name": "Acme 4T001",
                    "console_url": "https://console.example.com/robots/4T001",
                    "tags": [
                      "acme-fleet",
                      "lockable-door"
                    ],
                    "retired_at": null
                  }
                }
              }
            }
          },
          "400": {
            "description": "`INVALID_BODY`: A required field is missing, or a field has the wrong type or length.\n\n`BOT_ID_NOT_NAMESPACED`: `bot_id` does not start with your bot id prefix.\n\n`BOT_ID_NOT_MQTT_SAFE`: `bot_id` is not the prefix followed by `[A-Za-z0-9_.-]+`, or is longer than 64 characters.\n\n`FLEET_SERIAL_REQUIRED`: Your fleet has `requires_fleet_serial: true` and the bot would have no `fleet_serial`.\n\n`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "INVALID_BODY",
                "when": "A required field is missing, or a field has the wrong type or length."
              },
              {
                "code": "BOT_ID_NOT_NAMESPACED",
                "when": "`bot_id` does not start with your bot id prefix."
              },
              {
                "code": "BOT_ID_NOT_MQTT_SAFE",
                "when": "`bot_id` is not the prefix followed by `[A-Za-z0-9_.-]+`, or is longer than 64 characters."
              },
              {
                "code": "FLEET_SERIAL_REQUIRED",
                "when": "Your fleet has `requires_fleet_serial: true` and the bot would have no `fleet_serial`."
              },
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "404": {
            "description": "`FLEET_NOT_CONFIGURED`: No fleet configuration for your namespace yet. Create it with `PATCH /fleet`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "FLEET_NOT_CONFIGURED",
                "when": "No fleet configuration for your namespace yet. Create it with `PATCH /fleet`."
              }
            ]
          },
          "409": {
            "description": "`BOT_ID_TAKEN`: The id exists and is not a retired bot of yours.\n\n`FLEET_SERIAL_TAKEN`: Another bot of yours in service already addresses that robot. Retire the other one first.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "BOT_ID_TAKEN",
                "when": "The id exists and is not a retired bot of yours."
              },
              {
                "code": "FLEET_SERIAL_TAKEN",
                "when": "Another bot of yours in service already addresses that robot. Retire the other one first."
              }
            ]
          }
        }
      },
      "get": {
        "operationId": "listBots",
        "tags": [
          "Bots"
        ],
        "summary": "List bots",
        "description": "What REMI sees of your fleet, to find out why a bot is not assigned. Ordered by `bot_id`, retired bots included (always with `retired` in `blocked_by`).",
        "x-scope": "fleet",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1 to 200.",
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "`next_cursor` of the previous page. Only valid with the same `limit`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of bots.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListBotsResponse"
                },
                "example": {
                  "data": [
                    {
                      "bot_id": "ACME-4T001",
                      "fleet_serial": "AC7F3K2",
                      "location_id": "7Nk2QhVpXrLmT4wZaBcDe",
                      "current_job_id": null,
                      "assignable": true,
                      "blocked_by": [],
                      "state_age_ms": 1840
                    },
                    {
                      "bot_id": "ACME-4T002",
                      "fleet_serial": null,
                      "location_id": "7Nk2QhVpXrLmT4wZaBcDe",
                      "current_job_id": "ES-5867",
                      "assignable": false,
                      "blocked_by": [
                        "battery_below_minimum"
                      ],
                      "state_age_ms": 2100
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_ERROR`: `limit` is not an integer from 1 to 200.\n\n`INVALID_CURSOR`: The cursor is malformed or was issued for a different `limit`.\n\n`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "VALIDATION_ERROR",
                "when": "`limit` is not an integer from 1 to 200."
              },
              {
                "code": "INVALID_CURSOR",
                "when": "The cursor is malformed or was issued for a different `limit`."
              },
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "404": {
            "description": "`FLEET_NOT_CONFIGURED`: No fleet configuration for your namespace yet. Create it with `PATCH /fleet`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "FLEET_NOT_CONFIGURED",
                "when": "No fleet configuration for your namespace yet. Create it with `PATCH /fleet`."
              }
            ]
          }
        }
      }
    },
    "/fleet/bots/{bot_id}": {
      "patch": {
        "operationId": "updateBot",
        "tags": [
          "Bots"
        ],
        "summary": "Update a bot",
        "description": "Changes only the fields sent. `bot_id`, `namespace` and `location_id` cannot be changed.\n\n- `tags` replaces the whole list.\n- Changing `fleet_serial` is refused while the bot holds a job, and takes the bot off duty until an operator puts it back.",
        "x-scope": "fleet",
        "parameters": [
          {
            "name": "bot_id",
            "in": "path",
            "required": true,
            "description": "The bot id you registered.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBotRequest"
              },
              "example": {
                "manual_close_door": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The bot after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateBotResponse"
                },
                "example": {
                  "data": {
                    "bot_id": "ACME-4T001",
                    "namespace": "partner_acme",
                    "location_id": "7Nk2QhVpXrLmT4wZaBcDe",
                    "fleet_serial": "AC7F3K2",
                    "manual_close_door": false,
                    "commercial_name": "Acme 4T001",
                    "console_url": "https://console.example.com/robots/4T001",
                    "tags": [
                      "acme-fleet",
                      "lockable-door"
                    ],
                    "retired_at": null
                  }
                }
              }
            }
          },
          "400": {
            "description": "`IMMUTABLE_FIELD`: The body contains `bot_id`, `namespace` or `location_id`.\n\n`INVALID_BODY`: A field has the wrong type or length, or is unknown.\n\n`FLEET_SERIAL_REQUIRED`: Your fleet has `requires_fleet_serial: true` and the bot would have no `fleet_serial`.\n\n`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "IMMUTABLE_FIELD",
                "when": "The body contains `bot_id`, `namespace` or `location_id`."
              },
              {
                "code": "INVALID_BODY",
                "when": "A field has the wrong type or length, or is unknown."
              },
              {
                "code": "FLEET_SERIAL_REQUIRED",
                "when": "Your fleet has `requires_fleet_serial: true` and the bot would have no `fleet_serial`."
              },
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "404": {
            "description": "`FLEET_NOT_CONFIGURED`: No fleet configuration for your namespace yet. Create it with `PATCH /fleet`.\n\n`BOT_NOT_FOUND`: Unknown bot, or one that belongs to another partner.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "FLEET_NOT_CONFIGURED",
                "when": "No fleet configuration for your namespace yet. Create it with `PATCH /fleet`."
              },
              {
                "code": "BOT_NOT_FOUND",
                "when": "Unknown bot, or one that belongs to another partner."
              }
            ]
          },
          "409": {
            "description": "`BOT_HOLDS_JOB`: `fleet_serial` changes while the bot holds a job.\n\n`FLEET_SERIAL_TAKEN`: Another bot of yours in service already addresses that robot. Retire the other one first.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "BOT_HOLDS_JOB",
                "when": "`fleet_serial` changes while the bot holds a job."
              },
              {
                "code": "FLEET_SERIAL_TAKEN",
                "when": "Another bot of yours in service already addresses that robot. Retire the other one first."
              }
            ]
          }
        }
      },
      "delete": {
        "operationId": "retireBot",
        "tags": [
          "Bots"
        ],
        "summary": "Retire a bot",
        "description": "Takes the bot out of service: it is no longer assigned, and its state and events are refused. History is kept, and registering the same id again reactivates it. Retiring twice is safe.",
        "x-scope": "fleet",
        "parameters": [
          {
            "name": "bot_id",
            "in": "path",
            "required": true,
            "description": "The bot id you registered.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The retired bot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetireBotResponse"
                },
                "example": {
                  "data": {
                    "bot_id": "ACME-4T002",
                    "retired_at": "2026-06-17T15:52:00.000Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "404": {
            "description": "`FLEET_NOT_CONFIGURED`: No fleet configuration for your namespace yet. Create it with `PATCH /fleet`.\n\n`BOT_NOT_FOUND`: Unknown bot, or one that belongs to another partner.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "FLEET_NOT_CONFIGURED",
                "when": "No fleet configuration for your namespace yet. Create it with `PATCH /fleet`."
              },
              {
                "code": "BOT_NOT_FOUND",
                "when": "Unknown bot, or one that belongs to another partner."
              }
            ]
          },
          "409": {
            "description": "`BOT_HOLDS_JOB`: The bot is running a job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "BOT_HOLDS_JOB",
                "when": "The bot is running a job."
              }
            ]
          }
        }
      }
    },
    "/fleet/state": {
      "post": {
        "operationId": "pushBotState",
        "tags": [
          "State and events"
        ],
        "summary": "Push bot state",
        "description": "The push alternative to being polled. While pushes keep arriving, REMI does not poll your `GET /bots`; it polls again after 60 seconds without one.\n\n- Up to 200 states per request. One invalid state, or one bot that is unknown or retired, rejects the whole request.\n- A state not newer than the last accepted for its bot is discarded and counted in `rejected`.",
        "x-scope": "fleet",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushBotStateRequest"
              },
              "example": {
                "bots": [
                  {
                    "bot_id": "ACME-4T001",
                    "seq": 88215,
                    "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": 1.4
                    },
                    "door": "closed",
                    "current_command": {
                      "id": "ES-5867/pickup",
                      "state": "executing",
                      "accepted_at": "2026-06-17T15:46:31.220Z",
                      "updated_at": "2026-06-17T15:47:10.000Z"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Counts of accepted and discarded states.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushBotStateResponse"
                },
                "example": {
                  "data": {
                    "accepted": 1,
                    "rejected": 0
                  }
                }
              }
            }
          },
          "400": {
            "description": "`INVALID_STATE`: `bots` is not an array, or a state is missing a required field.\n\n`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "INVALID_STATE",
                "when": "`bots` is not an array, or a state is missing a required field."
              },
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "404": {
            "description": "`FLEET_NOT_CONFIGURED`: No fleet configuration for your namespace yet. Create it with `PATCH /fleet`.\n\n`BOT_NOT_FOUND`: A `bot_id` is not a registered bot of yours, or is retired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "FLEET_NOT_CONFIGURED",
                "when": "No fleet configuration for your namespace yet. Create it with `PATCH /fleet`."
              },
              {
                "code": "BOT_NOT_FOUND",
                "when": "A `bot_id` is not a registered bot of yours, or is retired."
              }
            ]
          },
          "413": {
            "description": "`PAYLOAD_TOO_LARGE`: More than 200 states.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "PAYLOAD_TOO_LARGE",
                "when": "More than 200 states."
              }
            ]
          }
        }
      }
    },
    "/fleet/events": {
      "post": {
        "operationId": "reportBotEvent",
        "tags": [
          "State and events"
        ],
        "summary": "Report a bot event",
        "description": "Events are optional and safe to resend. `arrived` lets REMI react the moment a bot stops instead of on the next poll; the job still advances from `current_command` in the state. `blocked` opens an operator task that stays open until `unblocked`.",
        "x-scope": "fleet",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BotEvent"
              },
              "example": {
                "bot_id": "ACME-4T001",
                "type": "arrived",
                "command_id": "ES-5867/pickup",
                "occurred_at": "2026-06-17T15:51:07.000Z"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The event was accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportBotEventResponse"
                },
                "example": {
                  "data": {
                    "accepted": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "`INVALID_EVENT`: Unknown `type`, or `arrived` without `command_id`.\n\n`PARTNER_NOT_FOUND`: Your namespace has no partner record yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "INVALID_EVENT",
                "when": "Unknown `type`, or `arrived` without `command_id`."
              },
              {
                "code": "PARTNER_NOT_FOUND",
                "when": "Your namespace has no partner record yet."
              }
            ]
          },
          "401": {
            "description": "Missing or invalid API key. The body is `{ \"message\": \"Unauthorized\" }`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            },
            "x-error-codes": [
              {
                "when": "Missing or invalid API key."
              }
            ]
          },
          "403": {
            "description": "The API key does not have the `fleet` scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "when": "The API key does not have the `fleet` scope."
              }
            ]
          },
          "404": {
            "description": "`FLEET_NOT_CONFIGURED`: No fleet configuration for your namespace yet. Create it with `PATCH /fleet`.\n\n`BOT_NOT_FOUND`: `bot_id` is not a registered bot of yours, or is retired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "x-error-codes": [
              {
                "code": "FLEET_NOT_CONFIGURED",
                "when": "No fleet configuration for your namespace yet. Create it with `PATCH /fleet`."
              },
              {
                "code": "BOT_NOT_FOUND",
                "when": "`bot_id` is not a registered bot of yours, or is retired."
              }
            ]
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key with the `fleet` scope, sent as `Authorization: Bearer <key>`. Ask your Robot.com representative for one."
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Always `about:blank`."
          },
          "title": {
            "type": "string",
            "description": "The HTTP status text."
          },
          "status": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "detail": {
            "type": "string",
            "description": "Human-readable. Do not parse it: branch on `code`."
          },
          "instance": {
            "type": "string",
            "description": "The request path."
          },
          "code": {
            "description": "Stable machine-readable error code, when the error has one.",
            "type": "string"
          },
          "params": {
            "description": "Values that explain the error, keyed by name.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "instance"
        ]
      },
      "FleetConfig": {
        "type": "object",
        "properties": {
          "namespace": {
            "type": "string",
            "description": "Your partner namespace. Permanent. It is the segment in every MQTT topic and client id."
          },
          "bot_id_prefix": {
            "type": "string",
            "description": "Every bot id must start with it. Defaults to your namespace in uppercase plus a hyphen."
          },
          "requires_fleet_serial": {
            "type": "boolean",
            "description": "Whether every bot you register needs `fleet_serial`. Set by Robot.com, read-only."
          },
          "transport": {
            "type": "string",
            "enum": [
              "mqtt",
              "http"
            ]
          },
          "base_url": {
            "description": "Where REMI calls you in `http` mode. Null when none is set.",
            "type": [
              "string",
              "null"
            ]
          },
          "token_set": {
            "type": "boolean",
            "description": "Whether a bearer token for calling you is on file. The token is never returned."
          },
          "poll_interval_active_ms": {
            "type": "number",
            "description": "How often REMI polls `GET /bots` while any of your bots holds a job. Set at onboarding."
          },
          "poll_interval_idle_ms": {
            "type": "number",
            "description": "How often REMI polls `GET /bots` while your fleet is idle. Set at onboarding."
          },
          "max_bots": {
            "type": "number",
            "description": "The fleet size agreed at onboarding. At most 200."
          },
          "contract_version": {
            "type": "string",
            "description": "The contract version your fleet was onboarded against."
          },
          "capabilities": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FleetCapabilities"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until you set a document."
          }
        },
        "required": [
          "namespace",
          "bot_id_prefix",
          "requires_fleet_serial",
          "transport",
          "base_url",
          "token_set",
          "poll_interval_active_ms",
          "poll_interval_idle_ms",
          "max_bots",
          "contract_version",
          "capabilities"
        ]
      },
      "FleetCapabilities": {
        "type": "object",
        "properties": {
          "supports_command_interrupt": {
            "type": "boolean",
            "description": "Whether a `navigate_to` sent during another navigation is accepted and replaces it. Fleet-wide. Without a document this is false."
          },
          "default": {
            "type": "object",
            "properties": {
              "has_door": {
                "type": "boolean",
                "description": "Whether the bot has a remotely controllable cargo door. False: `set_door` is never sent."
              },
              "supported_commands": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "navigate_to",
                    "cancel_navigation",
                    "set_door"
                  ]
                },
                "description": "The command types this bot accepts."
              }
            },
            "required": [
              "has_door",
              "supported_commands"
            ],
            "description": "Applies to every bot unless overridden."
          },
          "overrides": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "has_door": {
                  "type": "boolean",
                  "description": "Whether the bot has a remotely controllable cargo door. False: `set_door` is never sent."
                },
                "supported_commands": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "navigate_to",
                      "cancel_navigation",
                      "set_door"
                    ]
                  },
                  "description": "The command types this bot accepts."
                }
              }
            },
            "description": "Keyed by bot id and merged over `default`, field by field."
          }
        },
        "required": [
          "supports_command_interrupt",
          "default",
          "overrides"
        ]
      },
      "FleetBot": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string"
          },
          "namespace": {
            "type": "string"
          },
          "location_id": {
            "description": "The location the bot serves, set by Robot.com operations. Null until placed: a bot with no location is never assigned.",
            "type": [
              "string",
              "null"
            ]
          },
          "fleet_serial": {
            "description": "Null means the robot is `bot_id` minus your prefix.",
            "type": [
              "string",
              "null"
            ]
          },
          "manual_close_door": {
            "type": "boolean"
          },
          "commercial_name": {
            "type": "string"
          },
          "console_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "retired_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the bot was retired. Null while in service."
          }
        },
        "required": [
          "bot_id",
          "namespace",
          "location_id",
          "fleet_serial",
          "manual_close_door",
          "commercial_name",
          "console_url",
          "tags",
          "retired_at"
        ]
      },
      "FleetBotListItem": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string"
          },
          "fleet_serial": {
            "type": [
              "string",
              "null"
            ]
          },
          "location_id": {
            "description": "Null until Robot.com operations places the bot.",
            "type": [
              "string",
              "null"
            ]
          },
          "current_job_id": {
            "description": "The job the bot holds, or null.",
            "type": [
              "string",
              "null"
            ]
          },
          "assignable": {
            "type": "boolean",
            "description": "True when `blocked_by` is empty."
          },
          "blocked_by": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every reason the bot is not assigned, in this order: `disconnected`, `unavailable`, `battery_below_minimum`, `no_position`, `no_location`, `state_stale`, `retired`."
          },
          "state_age_ms": {
            "description": "Age of the latest state REMI holds. Null if none was received. Above 60000 the bot counts as stale.",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "bot_id",
          "fleet_serial",
          "location_id",
          "current_job_id",
          "assignable",
          "blocked_by",
          "state_age_ms"
        ]
      },
      "RegisterBotRequest": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string",
            "minLength": 1,
            "description": "Your bot id prefix followed by `[A-Za-z0-9_.-]+`, at most 64 characters in total."
          },
          "fleet_serial": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "The id your own system uses for the robot, when it differs from `bot_id`. At most 128 characters."
          },
          "manual_close_door": {
            "description": "True when the door must be closed by hand: REMI never sends `set_door` closed to this bot. Defaults to false.",
            "type": "boolean"
          },
          "commercial_name": {
            "description": "Display name shown to operators. Defaults to `bot_id`.",
            "type": "string",
            "minLength": 1
          },
          "console_url": {
            "description": "The robot's page in your own operator console. Operators open it from the bot's Console.",
            "type": "string",
            "minLength": 1
          },
          "tags": {
            "description": "Operational tags, up to 32 of at most 64 characters. Unknown tags are created. Jobs with `options.bot_tags` only go to bots carrying every tag. On update, replaces the whole list.",
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        },
        "required": [
          "bot_id"
        ]
      },
      "UpdateBotRequest": {
        "type": "object",
        "properties": {
          "fleet_serial": {
            "description": "`null` removes the mapping. Refused while the bot holds a job.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "description": "The id your own system uses for the robot, when it differs from `bot_id`. At most 128 characters."
              },
              {
                "type": "null"
              }
            ]
          },
          "manual_close_door": {
            "description": "True when the door must be closed by hand.",
            "type": "boolean"
          },
          "commercial_name": {
            "description": "Display name shown to operators.",
            "type": "string",
            "minLength": 1
          },
          "console_url": {
            "description": "`null` removes it, and the bot's Console goes back to REMI's own.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "description": "Operational tags, up to 32 of at most 64 characters. Unknown tags are created. Jobs with `options.bot_tags` only go to bots carrying every tag. On update, replaces the whole list.",
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        },
        "additionalProperties": false
      },
      "UpdateFleetConfigRequest": {
        "type": "object",
        "properties": {
          "transport": {
            "description": "How state and commands travel. `http`: REMI polls your `GET /bots` unless you push. `mqtt`: the MQTT topics.",
            "type": "string",
            "enum": [
              "mqtt",
              "http"
            ]
          },
          "base_url": {
            "description": "Required for `http`. An absolute `https` URL. REMI appends the Partner API paths to it.",
            "type": "string"
          },
          "token": {
            "description": "Required for `http`. A secret of your choosing, at least 32 characters, sent as `Authorization: Bearer <token>` on every call to you. Never returned.",
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "SetCapabilitiesRequest": {
        "type": "object",
        "properties": {
          "supports_command_interrupt": {
            "type": "boolean",
            "description": "Whether a `navigate_to` sent during another navigation is accepted and replaces it. Fleet-wide. Without a document this is false."
          },
          "default": {
            "type": "object",
            "properties": {
              "has_door": {
                "type": "boolean",
                "description": "Whether the bot has a remotely controllable cargo door. False: `set_door` is never sent."
              },
              "supported_commands": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "navigate_to",
                    "cancel_navigation",
                    "set_door"
                  ]
                },
                "description": "The command types this bot accepts."
              }
            },
            "required": [
              "has_door",
              "supported_commands"
            ],
            "description": "Applies to every bot unless overridden."
          },
          "overrides": {
            "default": {},
            "description": "Keyed by bot id and merged over `default`, field by field.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "has_door": {
                  "type": "boolean",
                  "description": "Whether the bot has a remotely controllable cargo door. False: `set_door` is never sent."
                },
                "supported_commands": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "navigate_to",
                      "cancel_navigation",
                      "set_door"
                    ]
                  },
                  "description": "The command types this bot accepts."
                }
              }
            }
          }
        },
        "required": [
          "supports_command_interrupt",
          "default"
        ]
      },
      "PatchCapabilitiesRequest": {
        "type": "object",
        "properties": {
          "supports_command_interrupt": {
            "type": "boolean"
          },
          "default": {
            "type": "object",
            "properties": {
              "has_door": {
                "type": "boolean",
                "description": "Whether the bot has a remotely controllable cargo door. False: `set_door` is never sent."
              },
              "supported_commands": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "navigate_to",
                    "cancel_navigation",
                    "set_door"
                  ]
                },
                "description": "The command types this bot accepts."
              }
            },
            "required": [
              "has_door",
              "supported_commands"
            ]
          },
          "overrides": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "has_door": {
                  "type": "boolean",
                  "description": "Whether the bot has a remotely controllable cargo door. False: `set_door` is never sent."
                },
                "supported_commands": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "navigate_to",
                      "cancel_navigation",
                      "set_door"
                    ]
                  },
                  "description": "The command types this bot accepts."
                }
              }
            }
          }
        },
        "additionalProperties": false
      },
      "BotState": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string"
          },
          "seq": {
            "description": "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.",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the state was measured on your side, not when it was sent."
          },
          "available": {
            "type": "boolean",
            "description": "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": {
            "description": "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.",
            "type": "boolean"
          },
          "connected": {
            "type": "boolean",
            "description": "Whether you have a live link to the bot. In MQTT mode the broker connection decides instead."
          },
          "position": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number",
                "minimum": -90,
                "maximum": 90,
                "description": "Latitude in decimal degrees, WGS 84."
              },
              "lng": {
                "type": "number",
                "minimum": -180,
                "maximum": 180,
                "description": "Longitude in decimal degrees, WGS 84."
              },
              "azimuth": {
                "description": "Compass bearing in degrees: 0 = North, clockwise, nominally [0, 360).",
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lng"
            ]
          },
          "battery": {
            "type": "object",
            "properties": {
              "percentage": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100,
                "description": "State of charge, 0 to 100. Below 20 the bot gets no new jobs."
              }
            },
            "required": [
              "percentage"
            ]
          },
          "motion": {
            "type": "object",
            "properties": {
              "speed_mps": {
                "type": "number",
                "minimum": 0,
                "description": "Ground speed in meters per second."
              }
            },
            "required": [
              "speed_mps"
            ]
          },
          "door": {
            "type": "string",
            "enum": [
              "opened",
              "closed",
              "opening",
              "closing",
              "stalled",
              "unknown",
              "unsupported"
            ],
            "description": "Cargo door state. Send `unknown` when you cannot read it and `unsupported` when the bot has no controllable door, never `closed`."
          },
          "current_command": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CommandStatus"
              },
              {
                "type": "null"
              }
            ],
            "description": "The latest command this bot accepted. REMI counts a command as delivered when its `id` appears here. Null if none yet."
          }
        },
        "required": [
          "bot_id",
          "timestamp",
          "available",
          "connected",
          "position",
          "battery",
          "door",
          "current_command"
        ]
      },
      "CommandStatus": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "description": "The command id REMI sent."
          },
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "executing",
              "succeeded",
              "failed",
              "rejected"
            ],
            "description": "`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": {
            "description": "Required unless `state` is `rejected`.",
            "type": "string",
            "format": "date-time"
          },
          "rejected_at": {
            "description": "Required when `state` is `rejected`, absent otherwise.",
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "description": "When `state` last changed.",
            "type": "string",
            "format": "date-time"
          },
          "error": {
            "description": "Set when `state` is `failed` or `rejected`. On a rejection, `code` is one of the four rejection codes.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          },
          "corrected_position": {
            "description": "Where the bot will really stop when you moved a `navigate_to` destination. Only while `accepted` or `executing`.",
            "type": "object",
            "properties": {
              "lat": {
                "type": "number",
                "minimum": -90,
                "maximum": 90,
                "description": "Latitude in decimal degrees, WGS 84."
              },
              "lng": {
                "type": "number",
                "minimum": -180,
                "maximum": 180,
                "description": "Longitude in decimal degrees, WGS 84."
              }
            },
            "required": [
              "lat",
              "lng"
            ]
          },
          "correction_distance_m": {
            "description": "Meters between the requested destination and `corrected_position`, or, on a `DESTINATION_UNREACHABLE` rejection, your network.",
            "type": "number",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "state"
        ]
      },
      "BotEvent": {
        "type": "object",
        "properties": {
          "bot_id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "arrived",
              "blocked",
              "unblocked"
            ],
            "description": "`arrived`: a navigation finished. `blocked` and `unblocked` open and close an operator task."
          },
          "command_id": {
            "description": "Required for `arrived`: the id of the navigation command that just completed.",
            "type": "string",
            "minLength": 1
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened on your side, not when you sent it."
          },
          "detail": {
            "description": "For `blocked`: `{ \"reason\": string, \"message\": string }`.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "bot_id",
          "type",
          "occurred_at"
        ]
      },
      "GetFleetConfigResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/FleetConfig"
          }
        },
        "required": [
          "data"
        ]
      },
      "UpdateFleetConfigResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/FleetConfig"
          }
        },
        "required": [
          "data"
        ]
      },
      "SetFleetCapabilitiesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/FleetCapabilities"
          }
        },
        "required": [
          "data"
        ]
      },
      "PatchFleetCapabilitiesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/FleetCapabilities"
          }
        },
        "required": [
          "data"
        ]
      },
      "RegisterBotResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/FleetBot"
          }
        },
        "required": [
          "data"
        ]
      },
      "UpdateBotResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/FleetBot"
          }
        },
        "required": [
          "data"
        ]
      },
      "RetireBotResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "bot_id": {
                "type": "string"
              },
              "retired_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "When the bot was retired."
              }
            },
            "required": [
              "bot_id",
              "retired_at"
            ]
          }
        },
        "required": [
          "data"
        ]
      },
      "ListBotsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FleetBotListItem"
            }
          },
          "next_cursor": {
            "description": "Pass it as `cursor` for the next page. Null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "next_cursor"
        ]
      },
      "PushBotStateResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "accepted": {
                "type": "number",
                "description": "States forwarded to REMI."
              },
              "rejected": {
                "type": "number",
                "description": "States discarded because a newer one was already accepted for that bot."
              }
            },
            "required": [
              "accepted",
              "rejected"
            ]
          }
        },
        "required": [
          "data"
        ]
      },
      "PushBotStateRequest": {
        "type": "object",
        "properties": {
          "bots": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BotState"
            },
            "description": "Complete bot states, at most 200 per request."
          }
        },
        "required": [
          "bots"
        ]
      },
      "ReportBotEventResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "accepted": {
                "type": "boolean",
                "const": true
              }
            },
            "required": [
              "accepted"
            ]
          }
        },
        "required": [
          "data"
        ]
      }
    }
  }
}
