Upload Files

Purpose

Necessary step before calibrating ridescan or before trying to assess risk scores. You've to upload at least 15 files for a new robot and mission combination to start calibration. After which you will have to upload files inorder to get the risk score associated with the files.

Note: If you're using our package, you can successfully skip these steps. As the uploading process is handled for you during calibration as well as during risk score calculation.

Request Parameters

  • robot_name (string, required)
  • mission_name (string, required)
  • data-type (string, required)
  • execution-type (string, required)
  • file (file, required)

Headers

  • Authorization: Bearer <jwt>
  • Content-Type: application/json

Example Request

const url = "https://api.ridescan.cloud/api/upload";
const headers = {
  "Authorization": "Bearer <jwt>",
  // ⚠️ Do NOT set Content-Type manually here, form-data will handle it
};

// file path you want to upload
const filePath = "./path/to/your/file.txt";  

// read the file as a stream
const fileStream = fs.createReadStream(filePath);

const robotName = "Spot";
const missionName = "Carrying items";
const dataType = "Routine"; // for example

// put into fileMeta object
const fileMeta = {
  file: fileStream,
  fileName: filePath.split("/").pop(),
};

const formData = new FormData();
formData.append("robot-name", robotName);
formData.append("mission-name", missionName);
formData.append("file", fileMeta.file, fileMeta.fileName); 
formData.append("data-type", dataType);
formData.append("execution-type", "Normal");

(async () => {
  try {
    const res = await axios.post(url, formData, {
      headers: {
        ...headers,
        ...formData.getHeaders(), // merge form-data headers (important)
      },
    });
    console.log("Upload successful:", res.data);
  } catch (error) {
    console.error("Upload failed:", error.response?.data || error.message);
  }
})();}

Sample Response

{
    "message": "File uploaded and processing started successfully",
    "mission_id": 236,
    "robot_id": 129,
    "newFile": {
        "file_size": 2650029,
        "id": 3535,
        "original_filename": "testing3.bag",
        "risk_score": null,
        "unique_filename": "Spot#Carrying Items#2#6550c823-cacb-4522-bdb9-a04ea9d90b54#testing3.bag",
        "upload_time": "2025-08-31T07:40:21.427000"
    }
}

Want to test with real data?

Download a sample ZIP file with example data to get started right away.

Download Sample ZIP