---
updatedAt: 2026-05-04T21:43:38.000Z
agentTools:
  projectIndex: https://docs.toqua.ai/llms.txt
---

# Update threshold configurations for a ship

Update all threshold configurations for a ship by IMO number.

This endpoint replaces all existing threshold configurations with the provided list:
- **Removes** thresholds that are no longer in the list
- **Updates** existing thresholds where the type matches
- **Adds** new thresholds for types that didn't exist

Each threshold configuration includes:
- **type**: The type of threshold (e.g., ME_LOAD_UPPER, AUX_CONSUMPTION_UPPER)
- **value**: The configured threshold value
- **duration_in_days**: Minimum duration for a violation to be triggered
- **data_source_preference_strategy**: The data source preference for comparison

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Toqua API",
    "contact": {
      "name": "Toqua",
      "url": "https://toqua.ai/",
      "email": "admin@toqua.ai"
    },
    "version": "0.26"
  },
  "servers": [
    {
      "url": "https://api.toqua.ai",
      "description": "Toqua API"
    }
  ],
  "paths": {
    "/performance/{imo_number}/thresholds": {
      "put": {
        "tags": [
          "Performance"
        ],
        "summary": "Update threshold configurations for a ship",
        "description": "Update all threshold configurations for a ship by IMO number.\n\nThis endpoint replaces all existing threshold configurations with the provided list:\n- **Removes** thresholds that are no longer in the list\n- **Updates** existing thresholds where the type matches\n- **Adds** new thresholds for types that didn't exist\n\nEach threshold configuration includes:\n- **type**: The type of threshold (e.g., ME_LOAD_UPPER, AUX_CONSUMPTION_UPPER)\n- **value**: The configured threshold value\n- **duration_in_days**: Minimum duration for a violation to be triggered\n- **data_source_preference_strategy**: The data source preference for comparison",
        "operationId": "update_threshold_configurations",
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "imo_number",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Imo Number"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateThresholdConfigurationsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetThresholdConfigurationsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "501": {
            "description": "Not Implemented"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DataSourcePreferenceStrategy": {
        "type": "string",
        "enum": [
          "prefer_sensor",
          "prefer_noon_report",
          "only_sensor",
          "only_noon_report"
        ],
        "title": "DataSourcePreferenceStrategy"
      },
      "GetThresholdConfigurationsResponse": {
        "properties": {
          "imo_number": {
            "type": "string",
            "title": "IMO Number",
            "description": "The IMO number of the ship.",
            "examples": [
              "1234567"
            ]
          },
          "thresholds": {
            "items": {
              "$ref": "#/components/schemas/ThresholdConfigurationSchema"
            },
            "type": "array",
            "title": "Thresholds",
            "description": "List of threshold configurations for the ship."
          }
        },
        "type": "object",
        "required": [
          "imo_number",
          "thresholds"
        ],
        "title": "GetThresholdConfigurationsResponse",
        "description": "Response containing all threshold configurations for a ship."
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ThresholdConfigurationSchema": {
        "properties": {
          "type": {
            "$ref": "#/components/schemas/ThresholdType",
            "title": "Threshold Type",
            "description": "The type of threshold.",
            "examples": [
              "me_load_lower"
            ]
          },
          "enabled": {
            "type": "boolean",
            "title": "Enabled",
            "description": "Whether this threshold alert is active. Disabled thresholds preserve their configuration but are not evaluated.",
            "default": true,
            "examples": [
              true
            ]
          },
          "value": {
            "type": "number",
            "title": "Threshold Value",
            "description": "The configured threshold value.",
            "examples": [
              0.5
            ]
          },
          "duration_in_days": {
            "type": "integer",
            "title": "Duration in Days",
            "description": "The minimum duration in days for a violation to be triggered.",
            "examples": [
              3
            ]
          },
          "data_source_preference_strategy": {
            "$ref": "#/components/schemas/DataSourcePreferenceStrategy",
            "title": "Data Source Preference Strategy",
            "description": "The strategy for selecting the data source to compare against.",
            "examples": [
              "prefer_sensor"
            ]
          }
        },
        "type": "object",
        "required": [
          "type",
          "value",
          "duration_in_days",
          "data_source_preference_strategy"
        ],
        "title": "ThresholdConfigurationSchema",
        "description": "A threshold configuration for a ship."
      },
      "ThresholdType": {
        "type": "string",
        "enum": [
          "me_load_lower",
          "me_load_upper",
          "me_sfoc_upper",
          "aux_consumption_upper",
          "aux_consumption_lower",
          "aux_sfoc_upper",
          "aux_sfoc_lower",
          "boiler_consumption_upper",
          "cyl_oil_consumption_upper",
          "cyl_oil_consumption_lower",
          "sys_oil_consumption_upper",
          "aux_count_upper"
        ],
        "title": "ThresholdType"
      },
      "UpdateThresholdConfigurationsRequest": {
        "properties": {
          "thresholds": {
            "items": {
              "$ref": "#/components/schemas/ThresholdConfigurationSchema"
            },
            "type": "array",
            "title": "Thresholds",
            "description": "List of threshold configurations to set for the ship. This list replaces all existing thresholds."
          }
        },
        "type": "object",
        "required": [
          "thresholds"
        ],
        "title": "UpdateThresholdConfigurationsRequest",
        "description": "Request to update threshold configurations for a ship."
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "externalDocs": {
    "description": "API Documentation",
    "url": "https://docs.toqua.ai"
  }
}
```