{
  "openapi": "3.1.0",
  "info": {
    "title": "SonarLink HTTP API",
    "version": "1.15.0-dev.17",
    "description": "Endpoints for controlling SonarLink, your gateway for interacting with Cerulean Sonar devices.",
    "contact": {
      "name": "Cerulean Sonar",
      "url": "https://github.com/CeruleanSonar/SonarView",
      "email": "support@ceruleansonar.com"
    }
  },
  "servers": [
    {
      "url": "/",
      "description": "The SonarLink instance serving this page"
    }
  ],
  "tags": [
    {
      "name": "public",
      "description": "These endpoints are recommended for developer use and SonarLink automation."
    },
    {
      "name": "internal",
      "description": "Endpoints used by SonarView, not recommended for use in other applications. If you need to use any of these, please drop us a line so we can improve the API."
    }
  ],
  "components": {
    "schemas": {
      "SessionId": {
        "type": "integer",
        "minimum": 0,
        "description": "Identifier of an active session."
      },
      "DeviceOptions": {
        "type": "object",
        "properties": {},
        "additionalProperties": {},
        "description": "Device-specific options. The exact keys vary by product."
      },
      "DeviceId": {
        "type": "integer",
        "minimum": 0,
        "maximum": 255,
        "description": "Identifier of a device within a session. Used for disambiguating which device a message came from or is going to."
      },
      "ProductId": {
        "type": "string",
        "description": "What product is this device?",
        "enum": [
          "dvl75",
          "gps",
          "insight240",
          "mbes24016",
          "nmea_out",
          "os3d45016",
          "os450",
          "os450c",
          "p360",
          "ping",
          "rovl",
          "s500",
          "tracker650",
          "ydnu-02"
        ],
        "x-enumDescriptions": {
          "ping": "Ping",
          "s500": "Sounder S500",
          "p360": "Ping360",
          "os450": "Omniscan 450",
          "os450c": "Omniscan 450C",
          "insight240": "Insight 240",
          "mbes24016": "Surveyor 240-16",
          "dvl75": "DVL-75",
          "tracker650": "Tracker 650",
          "gps": "Generic GPS Device",
          "ydnu-02": "Yacht Devices NMEA2000 USB Gateway",
          "os3d45016": "Omniscan 3D",
          "rovl": "ROV Locator",
          "nmea_out": "NMEA Output"
        }
      },
      "ConnectionStatus": {
        "type": "string",
        "enum": [
          "PENDING",
          "CONNECTED",
          "CLOSED"
        ],
        "description": "Connection status of a device or platform within a session.",
        "x-enumDescriptions": {
          "PENDING": "The connection is being established; no data has been received yet.",
          "CONNECTED": "The transport is up and data is being exchanged.",
          "CLOSED": "The connection was closed and will not reconnect."
        }
      },
      "SessionPlatform": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "protocol": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "mavlink2rest",
              "chasing",
              "blueye",
              "deeptrekker",
              "qysea",
              null
            ],
            "default": null,
            "description": "What type of vehicle is this, for communication purposes."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "examples": [
              "ws://blueos.local:6040/",
              "tcp://192.168.1.101:5555",
              "udp://255.255.255.255:8500?rxport=8500"
            ],
            "description": "How to connect to the vehicle? Acceptable values depend on the value of `protocol`"
          },
          "options": {
            "type": [
              "object",
              "null"
            ],
            "properties": {},
            "additionalProperties": {},
            "description": "Opaque, platform-specific options. Acceptable values depend on the value of `protocol`"
          },
          "model": {
            "type": "string",
            "description": "How to visually portray the vehicle",
            "examples": [
              "blue_boat"
            ]
          },
          "nickname": {
            "type": [
              "string",
              "null"
            ]
          },
          "device_id": {
            "$ref": "#/components/schemas/DeviceId"
          },
          "status": {
            "$ref": "#/components/schemas/ConnectionStatus"
          }
        },
        "additionalProperties": {},
        "description": "The platform (vehicle) as reported within an active session, with its connection status."
      },
      "ValidationError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable error message."
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {}
            },
            "description": "Request type validation issues."
          }
        },
        "required": [
          "error",
          "issues"
        ],
        "additionalProperties": {}
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable error message."
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": {}
      },
      "PlatformSpec": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "protocol": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "mavlink2rest",
              "chasing",
              "blueye",
              "deeptrekker",
              "qysea",
              null
            ],
            "default": null,
            "description": "What type of vehicle is this, for communication purposes."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "examples": [
              "ws://blueos.local:6040/",
              "tcp://192.168.1.101:5555",
              "udp://255.255.255.255:8500?rxport=8500"
            ],
            "description": "How to connect to the vehicle? Acceptable values depend on the value of `protocol`"
          },
          "options": {
            "type": [
              "object",
              "null"
            ],
            "properties": {},
            "additionalProperties": {},
            "description": "Opaque, platform-specific options. Acceptable values depend on the value of `protocol`"
          },
          "model": {
            "type": "string",
            "description": "How to visually portray the vehicle",
            "examples": [
              "blue_boat"
            ]
          }
        },
        "additionalProperties": {},
        "examples": [
          {
            "protocol": "mavlink2rest",
            "options": {
              "system_id": 1
            },
            "url": "ws://blueos.local:6040/",
            "model": "blue_boat"
          },
          {
            "protocol": "blueye",
            "url": "tcp://192.168.1.101:5555",
            "model": "blueye_x3"
          },
          {
            "protocol": "chasing",
            "url": "udp://255.255.255.255:8500?rxport=8500",
            "model": "chasing_m2_pro_max"
          },
          {
            "protocol": null,
            "model": "submarine"
          }
        ],
        "description": "The platform (vehicle) a session is attached to."
      },
      "SessionPlan": {
        "type": "object",
        "properties": {
          "session_plan_name": {
            "type": "string",
            "minLength": 1,
            "description": "The nickname of a session plan.",
            "examples": [
              "my_plan"
            ]
          },
          "devices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "examples": [
                    "tcp://192.168.1.1:51200"
                  ]
                },
                "product_id": {
                  "$ref": "#/components/schemas/ProductId"
                },
                "device_id": {
                  "$ref": "#/components/schemas/DeviceId"
                },
                "nickname": {
                  "type": "string"
                },
                "options": {
                  "$ref": "#/components/schemas/DeviceOptions"
                },
                "init_hex": {
                  "type": "string",
                  "description": "Deprecated. Hex-encoded bytes to send the device once connected, and again whenever it reconnects - but only for a product SonarLink doesn't set up itself from `options`; for the others it's ignored.",
                  "deprecated": true
                }
              },
              "required": [
                "url",
                "product_id"
              ],
              "additionalProperties": {},
              "description": "A device to connect to within a session."
            }
          },
          "platform": {
            "$ref": "#/components/schemas/PlatformSpec"
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether a session started from this plan is running."
          }
        },
        "required": [
          "session_plan_name",
          "devices",
          "platform",
          "is_active"
        ],
        "additionalProperties": {},
        "description": "A session plan from the SonarLink config, with its devices and platform as `/start_session` would connect to them."
      }
    },
    "parameters": {}
  },
  "paths": {
    "/status": {
      "get": {
        "tags": [
          "public"
        ],
        "description": "Report SonarLink runtime status. This includes software version, host, and active sessions.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sonarlink_version": {
                      "type": "string",
                      "examples": [
                        "1.2.3"
                      ]
                    },
                    "os_hostname": {
                      "type": "string",
                      "examples": [
                        "sonarlink.local"
                      ]
                    },
                    "sessions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "session_id": {
                            "$ref": "#/components/schemas/SessionId"
                          },
                          "session_uptime": {
                            "type": "number",
                            "description": "Seconds since the session started.",
                            "examples": [
                              123.4
                            ]
                          },
                          "session_devices": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "url": {
                                  "type": "string",
                                  "format": "uri",
                                  "examples": [
                                    "tcp://192.168.1.1:51200"
                                  ]
                                },
                                "options": {
                                  "$ref": "#/components/schemas/DeviceOptions"
                                },
                                "device_id": {
                                  "$ref": "#/components/schemas/DeviceId"
                                },
                                "product_id": {
                                  "$ref": "#/components/schemas/ProductId"
                                },
                                "nickname": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "status": {
                                  "$ref": "#/components/schemas/ConnectionStatus"
                                }
                              },
                              "additionalProperties": {},
                              "description": "A device as reported within an active session."
                            }
                          },
                          "session_platform": {
                            "$ref": "#/components/schemas/SessionPlatform"
                          },
                          "session_clients": {
                            "type": "array",
                            "items": {
                              "description": "Clients connected to SonarLink - typically live viewing sessions"
                            }
                          },
                          "session_plan_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "is_recording": {
                            "type": "boolean",
                            "default": false
                          }
                        },
                        "required": [
                          "session_id",
                          "session_uptime",
                          "session_devices",
                          "session_clients"
                        ],
                        "additionalProperties": {},
                        "description": "A snapshot of one active session."
                      }
                    },
                    "serial_okay": {
                      "type": "boolean",
                      "description": "Can SonarLink enumerate and connect to USB devices?"
                    },
                    "cerulean_internal": {
                      "type": "boolean",
                      "enum": [
                        true
                      ],
                      "description": "Is Sonarlink running with internal development/troubleshooting features enabled?",
                      "x-scalar-ignore": true
                    }
                  },
                  "required": [
                    "sonarlink_version",
                    "os_hostname",
                    "sessions",
                    "serial_okay"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "internal"
        ],
        "description": "Report SonarLink runtime status. This includes software version, host, and active sessions.",
        "deprecated": true,
        "x-scalar-stability": "deprecated",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sonarlink_version": {
                      "type": "string",
                      "examples": [
                        "1.2.3"
                      ]
                    },
                    "os_hostname": {
                      "type": "string",
                      "examples": [
                        "sonarlink.local"
                      ]
                    },
                    "sessions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "session_id": {
                            "$ref": "#/components/schemas/SessionId"
                          },
                          "session_uptime": {
                            "type": "number",
                            "description": "Seconds since the session started.",
                            "examples": [
                              123.4
                            ]
                          },
                          "session_devices": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "url": {
                                  "type": "string",
                                  "format": "uri",
                                  "examples": [
                                    "tcp://192.168.1.1:51200"
                                  ]
                                },
                                "options": {
                                  "$ref": "#/components/schemas/DeviceOptions"
                                },
                                "device_id": {
                                  "$ref": "#/components/schemas/DeviceId"
                                },
                                "product_id": {
                                  "$ref": "#/components/schemas/ProductId"
                                },
                                "nickname": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "status": {
                                  "$ref": "#/components/schemas/ConnectionStatus"
                                }
                              },
                              "additionalProperties": {},
                              "description": "A device as reported within an active session."
                            }
                          },
                          "session_platform": {
                            "$ref": "#/components/schemas/SessionPlatform"
                          },
                          "session_clients": {
                            "type": "array",
                            "items": {
                              "description": "Clients connected to SonarLink - typically live viewing sessions"
                            }
                          },
                          "session_plan_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "is_recording": {
                            "type": "boolean",
                            "default": false
                          }
                        },
                        "required": [
                          "session_id",
                          "session_uptime",
                          "session_devices",
                          "session_clients"
                        ],
                        "additionalProperties": {},
                        "description": "A snapshot of one active session."
                      }
                    },
                    "serial_okay": {
                      "type": "boolean",
                      "description": "Can SonarLink enumerate and connect to USB devices?"
                    },
                    "cerulean_internal": {
                      "type": "boolean",
                      "enum": [
                        true
                      ],
                      "description": "Is Sonarlink running with internal development/troubleshooting features enabled?",
                      "x-scalar-ignore": true
                    }
                  },
                  "required": [
                    "sonarlink_version",
                    "os_hostname",
                    "sessions",
                    "serial_okay"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/connect": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Start a new session connecting to the given devices. Where you can, prefer `/start_session` with a session plan from the SonarLink config.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "devices": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri",
                          "examples": [
                            "tcp://192.168.1.1:51200"
                          ]
                        },
                        "product_id": {
                          "$ref": "#/components/schemas/ProductId"
                        },
                        "device_id": {
                          "$ref": "#/components/schemas/DeviceId"
                        },
                        "nickname": {
                          "type": "string"
                        },
                        "options": {
                          "$ref": "#/components/schemas/DeviceOptions"
                        },
                        "init_hex": {
                          "type": "string",
                          "description": "Deprecated. Hex-encoded bytes to send the device once connected, and again whenever it reconnects - but only for a product SonarLink doesn't set up itself from `options`; for the others it's ignored.",
                          "deprecated": true
                        }
                      },
                      "required": [
                        "url",
                        "product_id"
                      ],
                      "additionalProperties": {},
                      "description": "A device to connect to within a session."
                    }
                  },
                  "platform": {
                    "$ref": "#/components/schemas/PlatformSpec"
                  },
                  "session_plan_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The session plan this session was started from, if any. Missing, null, or blank: an ad-hoc session."
                  }
                },
                "required": [
                  "devices"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session_id": {
                      "$ref": "#/components/schemas/SessionId"
                    },
                    "is_recording": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "session_id"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/logging": {
      "post": {
        "tags": [
          "public"
        ],
        "description": "Start or stop capturing data from a session into a svlog or svlz file.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "description": "The nickname of a session plan.",
                        "examples": [
                          "my_plan"
                        ]
                      },
                      {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Identifier of an active session.",
                        "examples": [
                          0
                        ]
                      }
                    ],
                    "description": "An active session: the name of the session plan it was started from, or its id.",
                    "examples": [
                      "my_plan",
                      0
                    ]
                  },
                  "session_id": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
                    "deprecated": true
                  },
                  "enable": {
                    "type": "boolean",
                    "description": "True to start logging, false to stop."
                  },
                  "subpath": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "The destination directory name, when enabling logging. Defaults to the session plan's name, or else the first device's product name."
                  }
                },
                "required": [
                  "session",
                  "enable"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success."
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/session_plans": {
      "get": {
        "tags": [
          "public"
        ],
        "description": "List the session plans set up in SonarView's Session Configurations. Each is a named set of devices, and optionally a vehicle, that `/start_session` can start a session from.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plans": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SessionPlan"
                      }
                    }
                  },
                  "required": [
                    "plans"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/start_session": {
      "post": {
        "tags": [
          "public"
        ],
        "description": "Start a session from a session plan, connecting to its devices and vehicle just as SonarView does. If a session from that plan is already running, responds with that one instead.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session_plan_name": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The nickname of a session plan.",
                    "examples": [
                      "my_plan"
                    ]
                  }
                },
                "required": [
                  "session_plan_name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session_id": {
                      "$ref": "#/components/schemas/SessionId"
                    },
                    "is_recording": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "session_id"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "There is no session plan by that name, or it is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/end_session": {
      "post": {
        "tags": [
          "public"
        ],
        "description": "End an active session, given its id or the session plan it was started from.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "description": "The nickname of a session plan.",
                        "examples": [
                          "my_plan"
                        ]
                      },
                      {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Identifier of an active session.",
                        "examples": [
                          0
                        ]
                      }
                    ],
                    "description": "An active session: the name of the session plan it was started from, or its id.",
                    "examples": [
                      "my_plan",
                      0
                    ]
                  },
                  "session_id": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
                    "deprecated": true
                  }
                },
                "required": [
                  "session"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success."
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/device_options": {
      "post": {
        "tags": [
          "public"
        ],
        "description": "Update some of a device's options within an active session - such as range, gain, and whether it is pinging - and apply them to the device. Options not given keep their values, and options SonarLink doesn't recognize are kept as-is. Responds with the device's options after the update.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "description": "The nickname of a session plan.",
                        "examples": [
                          "my_plan"
                        ]
                      },
                      {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Identifier of an active session.",
                        "examples": [
                          0
                        ]
                      }
                    ],
                    "description": "An active session: the name of the session plan it was started from, or its id.",
                    "examples": [
                      "my_plan",
                      0
                    ]
                  },
                  "session_id": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
                    "deprecated": true
                  },
                  "device_id": {
                    "$ref": "#/components/schemas/DeviceId"
                  },
                  "options": {
                    "$ref": "#/components/schemas/DeviceOptions"
                  }
                },
                "required": [
                  "session",
                  "device_id",
                  "options"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceOptions"
                }
              }
            }
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request references a session or device that does not exist, or the options, merged with the device's, are not valid for it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/update_device_options": {
      "post": {
        "tags": [
          "internal"
        ],
        "deprecated": true,
        "x-scalar-stability": "deprecated",
        "description": "Like `/device_options`, but responds with an empty body, as older SonarLinks do. Kept for compatibility.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "description": "The nickname of a session plan.",
                        "examples": [
                          "my_plan"
                        ]
                      },
                      {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Identifier of an active session.",
                        "examples": [
                          0
                        ]
                      }
                    ],
                    "description": "An active session: the name of the session plan it was started from, or its id.",
                    "examples": [
                      "my_plan",
                      0
                    ]
                  },
                  "session_id": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
                    "deprecated": true
                  },
                  "device_id": {
                    "$ref": "#/components/schemas/DeviceId"
                  },
                  "options": {
                    "$ref": "#/components/schemas/DeviceOptions"
                  }
                },
                "required": [
                  "session",
                  "device_id",
                  "options"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success."
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The request references a session or device that does not exist, or the options, merged with the device's, are not valid for it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/join": {
      "get": {
        "description": "Stream a live session's packets, in the svlog packet format `.svlog` files store, for as long as the connection stays open. The session's current `SONARLINK_JSON` state packet is sent first. Prefer `/connect_ws`.",
        "tags": [
          "public"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "An active session: the name of the session plan it was started from, or its id. A value of only digits is taken as an id.",
              "examples": [
                "my_plan",
                "0"
              ]
            },
            "required": true,
            "description": "An active session: the name of the session plan it was started from, or its id. A value of only digits is taken as an id.",
            "name": "session",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
              "examples": [
                0
              ]
            },
            "required": false,
            "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
            "deprecated": true,
            "name": "session_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The session's packets, until the connection closes.",
            "content": {
              "application/x-cerulean-svlog": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "The query string failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "422": {
            "description": "The request references a session that does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "Stream a live session's packets, in the svlog packet format `.svlog` files store, for as long as the connection stays open. The session's current `SONARLINK_JSON` state packet is sent first. Prefer `/connect_ws`. Also streams the request body to the session's devices, as `/connect_ws` does the messages sent on it. SonarLink handles both directions at once, but few HTTP clients can: browsers' `fetch` can't read the response until the request body ends, and proxies may hold the body back until then. That's why `/connect_ws` is preferred: WebSocket clients, browsers included, send and receive at once.",
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "An active session: the name of the session plan it was started from, or its id. A value of only digits is taken as an id.",
              "examples": [
                "my_plan",
                "0"
              ]
            },
            "required": true,
            "description": "An active session: the name of the session plan it was started from, or its id. A value of only digits is taken as an id.",
            "name": "session",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
              "examples": [
                0
              ]
            },
            "required": false,
            "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
            "deprecated": true,
            "name": "session_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The session's packets, until the connection closes.",
            "content": {
              "application/x-cerulean-svlog": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "The query string failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "422": {
            "description": "The request references a session that does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/discover_devices": {
      "post": {
        "tags": [
          "public"
        ],
        "description": "Find the devices on the local network and serial ports, and list them once they have had `wait_s` seconds to answer. The URLs listed are what a session or session plan connects to.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "wait_s": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 10,
                    "default": 2,
                    "description": "How long to wait for devices to answer, in seconds. The default gives serial devices, which have 0.7 s to answer, and slow networks time to."
                  },
                  "hosts": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Addresses to also ask directly, for devices a broadcast doesn't reach (e.g. across a router)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "devices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "examples": [
                              "tcp://192.168.1.1:51200"
                            ]
                          },
                          "product_id": {
                            "$ref": "#/components/schemas/ProductId"
                          },
                          "connectable": {
                            "type": "boolean",
                            "description": "Could SonarLink reach the device at this URL?"
                          },
                          "variant": {
                            "type": "string",
                            "description": "Hardware variant.",
                            "examples": [
                              "AIO",
                              "upgrade"
                            ]
                          },
                          "firmware_version": {
                            "type": "string",
                            "description": "Firmware version the device reports.",
                            "examples": [
                              "1.2.3"
                            ]
                          }
                        },
                        "required": [
                          "url",
                          "product_id",
                          "connectable"
                        ],
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "devices"
                  ],
                  "additionalProperties": {},
                  "description": "The devices found on the network and serial ports."
                }
              }
            }
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/start_discovery": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Attempt to find all devices both on the local network and attached as serial devices. Results are collected asynchronously and can be retrieved with `/get_discovery_data`. Prefer `/discover_devices`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "hosts": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "check_com_ports": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success."
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/get_discovery_data": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Retrieve the current discovery results as a list of devices. Requires first calling `/start_discovery`.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string"
                      },
                      "product_id": {
                        "$ref": "#/components/schemas/ProductId"
                      },
                      "connectable": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "url"
                    ],
                    "additionalProperties": {}
                  },
                  "description": "Devices found by discovery so far."
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/setip": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Broadcast a message to all hosts on the local network. Typically used to send commands to a device that might be needed even if the device has an invalid IP address (e.g. setting device self-assigned IP addresses, rebooting)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "port": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "msg": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "port",
                  "msg"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success."
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/diagnostics": {
      "get": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Technical information about the server process and underlying system.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {},
                  "description": "Server process and system information. The exact keys are not stable."
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/probe_url": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Check whether a URL is reachable.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "reachable",
                        "unreachable",
                        "skipped"
                      ]
                    },
                    "reason": {
                      "type": "string",
                      "description": "Why the URL is unreachable or was skipped."
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/relay_sftp": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Relay a file to a remote host via SFTP. Used for sending new firmware to the Omniscan 3D.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "host": {
                    "type": "string",
                    "minLength": 1
                  },
                  "remote_path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "file_data_base64": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "host",
                  "remote_path",
                  "file_data_base64"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "success"
                  ],
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/get_or_create_config": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Return the SonarLink config file, creating it if absent.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schema_version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "schema_version"
                  ],
                  "additionalProperties": {},
                  "description": "A SonarLink config file."
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/update_config": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Write a new config and return the updated file.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "config": {}
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schema_version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "schema_version"
                  ],
                  "additionalProperties": {},
                  "description": "A SonarLink config file."
                }
              }
            }
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/get_file_by_dir": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Return the SonarLink config file found under the given directory.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string"
                  }
                },
                "required": [
                  "path"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schema_version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "schema_version"
                  ],
                  "additionalProperties": {},
                  "description": "A SonarLink config file."
                }
              }
            }
          },
          "204": {
            "description": "There is no config file under that directory."
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/get_default_config": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Return the built-in default config.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schema_version": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "schema_version"
                  ],
                  "additionalProperties": {},
                  "description": "A SonarLink config file."
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/check_directory_accessible": {
      "post": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Check whether the server has permission to write to a given directory.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dir": {
                    "type": "string"
                  }
                },
                "required": [
                  "dir"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean",
                  "description": "Whether the server can write to the directory."
                }
              }
            }
          },
          "400": {
            "description": "The request body failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "415": {
            "description": "The request body was not sent as JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/register_service": {
      "get": {
        "tags": [
          "public"
        ],
        "description": "BlueOS service registration endpoint. See [BlueOS documentation](https://blueos.cloud/docs/stable/development/extensions/#web-interface-http-server).",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "icon": {
                      "type": "string"
                    },
                    "company": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "webpage": {
                      "type": "string"
                    },
                    "api": {
                      "type": "string"
                    },
                    "new_page": {
                      "type": "boolean"
                    },
                    "works_in_relative_paths": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "name",
                    "description",
                    "icon",
                    "company",
                    "version",
                    "webpage",
                    "api",
                    "new_page",
                    "works_in_relative_paths"
                  ],
                  "additionalProperties": {},
                  "description": "The BlueOS extension metadata."
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/recent_data": {
      "get": {
        "tags": [
          "public"
        ],
        "description": "The last few seconds of a live session's data, as `/join` would have streamed it and `.svlog` files store it, led by the session's current `SONARLINK_JSON` state packet. SonarLink keeps only the most recent 16 MB or so of each session's data, so a long window may start later than asked.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "An active session: the name of the session plan it was started from, or its id. A value of only digits is taken as an id.",
              "examples": [
                "my_plan",
                "0"
              ]
            },
            "required": true,
            "description": "An active session: the name of the session plan it was started from, or its id. A value of only digits is taken as an id.",
            "name": "session",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
              "examples": [
                0
              ]
            },
            "required": false,
            "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
            "deprecated": true,
            "name": "session_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "number",
              "exclusiveMinimum": 0,
              "default": 15,
              "description": "How far back to go, in seconds.",
              "examples": [
                15
              ]
            },
            "required": false,
            "description": "How far back to go, in seconds.",
            "name": "duration_s",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The session's recent packets.",
            "content": {
              "application/x-cerulean-svlog": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "The query string failed schema validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "422": {
            "description": "The request references a session that does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/list_logs": {
      "get": {
        "tags": [
          "public"
        ],
        "description": "List the recordings (svlog and svlz files) under the configured log directory. Download one with `/log/{plan}/{filename}`.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "logs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "plan": {
                            "type": "string",
                            "description": "The directory a recording is in, within the log directory: SonarLink names it after the session's plan, or else its first device's product.",
                            "examples": [
                              "my_plan"
                            ]
                          },
                          "filename": {
                            "type": "string",
                            "description": "The recording's file name.",
                            "examples": [
                              "2026-08-05-14-30.svlz"
                            ]
                          },
                          "url": {
                            "type": "string",
                            "description": "Where to download it: `/log/{plan}/{filename}`, each part percent-encoded.",
                            "examples": [
                              "/log/my_plan/2026-08-05-14-30.svlz"
                            ]
                          },
                          "size": {
                            "type": "number",
                            "minimum": 0,
                            "description": "File size in bytes."
                          },
                          "modified_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "When the file was last modified."
                          }
                        },
                        "required": [
                          "plan",
                          "filename",
                          "url",
                          "size",
                          "modified_at"
                        ],
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "logs"
                  ],
                  "additionalProperties": {},
                  "description": "The recordings (svlog and svlz files) under the configured log directory."
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/log/{plan}/{filename}": {
      "get": {
        "tags": [
          "public"
        ],
        "description": "Download a recording, given its `plan` and `filename` as `/list_logs` gives them - e.g. `/log/my_plan/2026-08-05-14-30.svlz`.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The directory a recording is in, within the log directory: SonarLink names it after the session's plan, or else its first device's product.",
              "examples": [
                "my_plan"
              ]
            },
            "required": true,
            "description": "The directory a recording is in, within the log directory: SonarLink names it after the session's plan, or else its first device's product.",
            "name": "plan",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The recording's file name.",
              "examples": [
                "2026-08-05-14-30.svlz"
              ]
            },
            "required": true,
            "description": "The recording's file name.",
            "name": "filename",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The recording.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "There is no such recording.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`plan` and `filename` don't name a recording in the log directory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/errlog": {
      "get": {
        "tags": [
          "public"
        ],
        "description": "Return the SonarLink error log as JSON lines.",
        "responses": {
          "200": {
            "description": "The error log, one JSON object per line.",
            "content": {
              "application/x-json-lines": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error in SonarLink."
          }
        }
      }
    },
    "/errlog_ws": {
      "get": {
        "tags": [
          "internal"
        ],
        "x-scalar-stability": "experimental",
        "description": "Start a WebSocket connection to send client error logs to the server",
        "responses": {
          "101": {
            "description": "The connection was upgraded to a WebSocket."
          },
          "426": {
            "description": "The request was a plain HTTP request - expected WebSocket connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/connect_ws": {
      "get": {
        "tags": [
          "public"
        ],
        "description": "Start a bidirectional WebSocket connection to interact with a session, given its id or the session plan it was started from.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "An active session: the name of the session plan it was started from, or its id. A value of only digits is taken as an id.",
              "examples": [
                "my_plan",
                "0"
              ]
            },
            "required": true,
            "description": "An active session: the name of the session plan it was started from, or its id. A value of only digits is taken as an id.",
            "name": "session",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
              "examples": [
                0
              ]
            },
            "required": false,
            "description": "Deprecated: use `session`. Identifier of an active session, used when `session` isn't given.",
            "deprecated": true,
            "name": "session_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Present and non-empty to also send data to the session’s devices."
            },
            "required": false,
            "description": "Present and non-empty to also send data to the session’s devices.",
            "name": "write",
            "in": "query"
          }
        ],
        "responses": {
          "101": {
            "description": "The connection was upgraded to a WebSocket."
          },
          "426": {
            "description": "The request was a plain HTTP request - expected WebSocket connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}