{
  "openapi" : "3.1.0",
  "info" : {
    "title" : "CAN Faults API",
    "description" : "This API is used for retrieving fault summaries, fetching active faults, and listing faults with filtering \noptions. It also provides endpoints to list, send, resolve, and summarize simulated faults.",
    "version" : "1.0"
  },
  "servers" : [ {
    "url" : "https://iris.trackunit.com/public/api/can-faults",
    "description" : "Production"
  } ],
  "security" : [ {
    "authorizationBearer" : [ ]
  } ],
  "tags" : [ {
    "name" : "Faults",
    "description" : "Faults API"
  }, {
    "name" : "Faults Summary",
    "description" : "Faults Summary API"
  }, {
    "name" : "Simulated Faults",
    "description" : "Simulated Faults API"
  }, {
    "name" : "Unit Active Faults",
    "description" : "Unit Active Faults API"
  } ],
  "paths" : {
    "/simulated-faults/list" : {
      "get" : {
        "tags" : [ "Simulated Faults" ],
        "summary" : "Get simulatable faults",
        "description" : "Get simulatable faults by machine ID",
        "operationId" : "getSimulatableFaults",
        "parameters" : [ {
          "name" : "machineId",
          "in" : "header",
          "description" : "Machine ID",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "OK",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/SimulatedFaultsRepresentation"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            }
          },
          "401" : {
            "description" : "Invalid or missing bearer token in Authorization header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "403" : {
            "description" : "User not allowed to make this request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "404" : {
            "description" : "Resource not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          }
        },
        "deprecated" : true
      }
    },
    "/simulated-faults/list/simulated" : {
      "get" : {
        "tags" : [ "Simulated Faults" ],
        "summary" : "Get simulated faults",
        "description" : "Get simulated faults by machine ID",
        "operationId" : "getSimulatedFaults",
        "parameters" : [ {
          "name" : "machineId",
          "in" : "header",
          "description" : "Machine ID",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "OK",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/SimulatedFaultsRepresentation"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            }
          },
          "401" : {
            "description" : "Invalid or missing bearer token in Authorization header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "403" : {
            "description" : "User not allowed to make this request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "404" : {
            "description" : "Resource not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          }
        },
        "deprecated" : true
      }
    },
    "/simulated-faults/resolve" : {
      "post" : {
        "tags" : [ "Simulated Faults" ],
        "summary" : "Resolve simulated fault",
        "description" : "Resolve simulated fault by machine ID and fault description ID",
        "operationId" : "resolveSimulatedFault",
        "parameters" : [ {
          "name" : "machineId",
          "in" : "header",
          "description" : "Machine ID",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        }, {
          "name" : "faultDescriptionId",
          "in" : "header",
          "description" : "Fault Description ID",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "OK"
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            }
          },
          "401" : {
            "description" : "Invalid or missing bearer token in Authorization header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "403" : {
            "description" : "User not allowed to make this request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "404" : {
            "description" : "Resource not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          }
        },
        "deprecated" : true
      }
    },
    "/simulated-faults/send" : {
      "post" : {
        "tags" : [ "Simulated Faults" ],
        "summary" : "Send simulated fault",
        "description" : "Send simulated fault by machine ID and fault description ID",
        "operationId" : "sendSimulatedFault",
        "parameters" : [ {
          "name" : "descriptionId",
          "in" : "header",
          "description" : "Description ID",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "machineId",
          "in" : "header",
          "description" : "Machine ID",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "OK"
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            }
          },
          "401" : {
            "description" : "Invalid or missing bearer token in Authorization header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "403" : {
            "description" : "User not allowed to make this request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "404" : {
            "description" : "Resource not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          }
        },
        "deprecated" : true
      }
    },
    "/simulated-faults/summary" : {
      "get" : {
        "tags" : [ "Simulated Faults" ],
        "summary" : "Get simulated faults summary",
        "description" : "Get simulated faults summary",
        "operationId" : "getSimulatedFaultsSummary",
        "responses" : {
          "200" : {
            "description" : "OK",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/SimulatedFaultSummaryRepresentation"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            }
          },
          "401" : {
            "description" : "Invalid or missing bearer token in Authorization header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "403" : {
            "description" : "User not allowed to make this request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "404" : {
            "description" : "Resource not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          }
        },
        "deprecated" : true
      }
    },
    "/get-unit-active-faults" : {
      "get" : {
        "tags" : [ "Unit Active Faults" ],
        "summary" : "Get unit active faults",
        "description" : "Get unit active faults by unit ID and date range",
        "operationId" : "getUnitActiveFaultsByRequestParams",
        "parameters" : [ {
          "name" : "id",
          "in" : "query",
          "description" : "Unit ID",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int32"
          }
        }, {
          "name" : "from",
          "in" : "query",
          "description" : "Date and time in ISO 8601 format",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "to",
          "in" : "query",
          "description" : "Date and time in ISO 8601 format",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "OK",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/UnitActiveFaultsListRepresentation"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            }
          },
          "401" : {
            "description" : "Invalid or missing bearer token in Authorization header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "403" : {
            "description" : "User not allowed to make this request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "404" : {
            "description" : "Resource not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          }
        }
      },
      "post" : {
        "tags" : [ "Unit Active Faults" ],
        "summary" : "Get unit active faults",
        "description" : "Get unit active faults by unit ID and date range",
        "operationId" : "getUnitActiveFaultsByRequestBody",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/UnitActiveFaultsRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "OK",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/UnitActiveFaultsListRepresentation"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            }
          },
          "401" : {
            "description" : "Invalid or missing bearer token in Authorization header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "403" : {
            "description" : "User not allowed to make this request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "404" : {
            "description" : "Resource not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          }
        }
      }
    },
    "/faults" : {
      "post" : {
        "tags" : [ "Faults" ],
        "summary" : "Get faults",
        "description" : "Get faults by machine IDs and date range, and optionally by SPN, FMI, and SA",
        "operationId" : "getFaults",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/FaultsRequestRepresentation"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "OK",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/FaultsResponseRepresentation"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            }
          },
          "401" : {
            "description" : "Invalid or missing bearer token in Authorization header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "403" : {
            "description" : "User not allowed to make this request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "404" : {
            "description" : "Resource not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          }
        }
      }
    },
    "/faults-summary" : {
      "post" : {
        "tags" : [ "Faults Summary" ],
        "summary" : "Get faults summary",
        "description" : "Get faults summary by machine IDs and date range",
        "operationId" : "getFaultsSummary",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/FaultsRequestRepresentation"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "OK",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/FaultSummaryRepresentation"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            }
          },
          "401" : {
            "description" : "Invalid or missing bearer token in Authorization header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "403" : {
            "description" : "User not allowed to make this request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "404" : {
            "description" : "Resource not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components" : {
    "schemas" : {
      "ConstraintViolationError" : {
        "type" : "object",
        "properties" : {
          "code" : {
            "type" : [ "string", "null" ],
            "description" : "Alphanumeric code (snake case) describing use case specific error"
          },
          "message" : {
            "type" : "string",
            "description" : "Detailed description of error"
          },
          "properties" : {
            "type" : [ "object", "null" ],
            "additionalProperties" : { },
            "description" : "Additional properties to be included in the error response"
          },
          "status" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "HTTP status code"
          },
          "violations" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/Violation"
            }
          }
        }
      },
      "DefaultError" : {
        "type" : "object",
        "properties" : {
          "code" : {
            "type" : [ "string", "null" ],
            "description" : "Alphanumeric code (snake case) describing use case specific error"
          },
          "message" : {
            "type" : "string",
            "description" : "Detailed description of error"
          },
          "properties" : {
            "type" : [ "object", "null" ],
            "additionalProperties" : { },
            "description" : "Additional properties to be included in the error response"
          },
          "status" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "HTTP status code"
          }
        }
      },
      "FaultCodeSummaryRepresentation" : {
        "type" : "object",
        "properties" : {
          "affectedMachineIds" : {
            "type" : "array",
            "items" : {
              "type" : "integer",
              "format" : "int32"
            },
            "uniqueItems" : true
          },
          "failureModeIndicator" : {
            "type" : "integer",
            "format" : "int32"
          },
          "faultCount" : {
            "type" : "integer",
            "format" : "int32"
          },
          "sourceAddress" : {
            "type" : "integer",
            "format" : "int32"
          },
          "suspectParameterNumber" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "FaultRepresentation" : {
        "type" : "object",
        "properties" : {
          "endTime" : {
            "type" : "string",
            "format" : "date-time"
          },
          "failureModeIndicator" : {
            "type" : "integer",
            "format" : "int32"
          },
          "machineId" : {
            "type" : "integer",
            "format" : "int32"
          },
          "sourceAddress" : {
            "type" : "integer",
            "format" : "int32"
          },
          "startTime" : {
            "type" : "string",
            "format" : "date-time"
          },
          "suspectParameterNumber" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "FaultSummaryRepresentation" : {
        "type" : "object",
        "properties" : {
          "faultCodeSummaries" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/FaultCodeSummaryRepresentation"
            }
          },
          "faultTimePeriodSummaries" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/FaultTimePeriodSummaryRepresentation"
            }
          }
        }
      },
      "FaultTimePeriodSummaryRepresentation" : {
        "type" : "object",
        "properties" : {
          "affectedMachineCount" : {
            "type" : "integer",
            "format" : "int32"
          },
          "date" : {
            "type" : "string",
            "format" : "date"
          },
          "faultCount" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "FaultsRepresentation" : {
        "type" : "object",
        "properties" : {
          "faults" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/FaultRepresentation"
            }
          }
        }
      },
      "FaultsRequest" : {
        "type" : "object",
        "properties" : {
          "failureModeIndicator" : {
            "type" : "integer",
            "format" : "int32"
          },
          "interval" : {
            "$ref" : "#/components/schemas/IntervalRepresentation"
          },
          "machineIds" : {
            "type" : "array",
            "items" : {
              "type" : "integer",
              "format" : "int32"
            }
          },
          "sourceAddress" : {
            "type" : "integer",
            "format" : "int32"
          },
          "suspectParameterNumber" : {
            "type" : "integer",
            "format" : "int32"
          }
        },
        "required" : [ "interval" ]
      },
      "FaultsRequestRepresentation" : {
        "type" : "object",
        "description" : "Faults Request",
        "properties" : {
          "canFaultsRequest" : {
            "$ref" : "#/components/schemas/FaultsRequest"
          }
        },
        "required" : [ "canFaultsRequest" ]
      },
      "FaultsResponseRepresentation" : {
        "type" : "object",
        "properties" : {
          "canFaults" : {
            "$ref" : "#/components/schemas/FaultsRepresentation"
          }
        }
      },
      "IntervalRepresentation" : {
        "type" : "object",
        "properties" : {
          "from" : {
            "type" : "string",
            "format" : "date-time"
          },
          "to" : {
            "type" : "string",
            "format" : "date-time"
          }
        },
        "required" : [ "from", "to" ]
      },
      "SimulatedFaultRepresentation" : {
        "type" : "object",
        "properties" : {
          "critical" : {
            "type" : "boolean",
            "description" : "If true the fault will have a severity level corresponding to a critical fault (e.g. 80)"
          },
          "description" : {
            "type" : "string"
          },
          "descriptionId" : {
            "type" : "string",
            "description" : "Identifies the fault in the same way as faults are identified when looking up fault descriptions"
          }
        }
      },
      "SimulatedFaultSummaryRepresentation" : {
        "type" : "object",
        "properties" : {
          "numberOfActiveSimulatedFaults" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "SimulatedFaultsRepresentation" : {
        "type" : "object",
        "properties" : {
          "machineId" : {
            "type" : "string",
            "format" : "uuid",
            "description" : "Machine (Asset) Id"
          },
          "simulatedFaults" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/SimulatedFaultRepresentation"
            }
          }
        }
      },
      "UnitActiveFaultsListRepresentation" : {
        "type" : "object",
        "properties" : {
          "list" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/UnitActiveFaultsRepresentation"
            }
          }
        }
      },
      "UnitActiveFaultsRepresentation" : {
        "type" : "object",
        "properties" : {
          "description" : {
            "type" : "string"
          },
          "fmi" : {
            "type" : "integer",
            "format" : "int32"
          },
          "name" : {
            "type" : "string"
          },
          "occurrenceCount" : {
            "type" : "integer",
            "format" : "int32"
          },
          "spn" : {
            "type" : "integer",
            "format" : "int32"
          },
          "time" : {
            "type" : "string",
            "format" : "date-time"
          }
        }
      },
      "UnitActiveFaultsRequest" : {
        "type" : "object",
        "description" : "Unit Active Faults Request",
        "properties" : {
          "from" : {
            "type" : "string",
            "format" : "date-time"
          },
          "id" : {
            "type" : "integer",
            "format" : "int32"
          },
          "to" : {
            "type" : "string",
            "format" : "date-time"
          }
        },
        "required" : [ "from", "id", "to" ]
      },
      "Violation" : {
        "type" : "object",
        "properties" : {
          "field" : {
            "type" : "string"
          },
          "message" : {
            "type" : "string"
          }
        }
      }
    },
    "securitySchemes" : {
      "authorizationBearer" : {
        "type" : "http",
        "scheme" : "bearer",
        "bearerFormat" : "JWT"
      }
    }
  }
}