---
updatedAt: 2026-05-27T10:18:53.000Z
agentTools:
  projectIndex: https://gethapn.readme.io/llms.txt
---

# Update a client alert configuration

Update a client alert configuration.


# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "description": "The Hapn API is an HTTP interface for managing devices, accounts, and cloud data.",
    "version": "1.0.0",
    "title": "Hapn API",
    "termsOfService": "https://gethapn.com/terms",
    "contact": {
      "name": "Dev",
      "email": "developer@gethapn.com",
      "url": "http://gethapn.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "servers": [
    {
      "url": "https://api.iotgps.io/v1",
      "description": "Prod"
    },
    {
      "url": "https://api-dev.iotgps.io/v1",
      "description": "Dev"
    }
  ],
  "paths": {
    "/client-alerts/configurations/{clientAlertConfigurationId}": {
      "put": {
        "summary": "Update a client alert configuration",
        "tags": [
          "Alerts"
        ],
        "parameters": [
          {
            "name": "clientAlertConfigurationId",
            "in": "path",
            "required": true,
            "description": "The client alert configuration id",
            "schema": {
              "type": "number"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateClientAlertConfigurationBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "True if the alert configuration was updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SuccessEmptyResponse"
                    }
                  ]
                },
                "examples": {
                  "example-1": {
                    "value": {
                      "success": true,
                      "message": "ok"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/UnschedulableAlert"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/ClientAlertConfigurationNotFound"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "update-client-alert-configuration",
        "description": "Update a client alert configuration.\n"
      }
    }
  },
  "components": {
    "schemas": {
      "AlertFilterDaysOfWeekProp": {
        "type": "string",
        "description": "A 7 digit binary number. Ex: 1111111. Each digit represents a day of week. 1 means enabled, 0 means not disabled. 1st digit represents Sunday, 2nd digit represents Monday and so on ending with 7th digit representing Saturday"
      },
      "AlertFilterStartTimeProp": {
        "type": "string",
        "description": "Start time of the time window. Format: HH:mm"
      },
      "AlertFilterEndTimeProp": {
        "type": "string",
        "description": "Start time of the time window. Format: HH:mm"
      },
      "AlertConfigFilterTimeSegment": {
        "description": "A time segment to apply specific filter conditions by time and day of the week",
        "type": "object",
        "x-examples": {
          "example-1": {
            "daysOfWeek": "1111111",
            "startTime": "00:00",
            "endTime": "23:59"
          }
        },
        "title": "",
        "properties": {
          "daysOfWeek": {
            "$ref": "#/components/schemas/AlertFilterDaysOfWeekProp"
          },
          "startTime": {
            "$ref": "#/components/schemas/AlertFilterStartTimeProp"
          },
          "endTime": {
            "$ref": "#/components/schemas/AlertFilterEndTimeProp"
          }
        }
      },
      "AlertConfigFilter": {
        "description": "A filter to apply specific conditions to the user alert settings",
        "type": "object",
        "x-examples": {
          "example-1": {
            "imeis": [
              "868239050345326"
            ],
            "timeSegmentsType": "custom",
            "timeSegments": [
              {
                "daysOfWeek": "1111111",
                "startTime": "00:00",
                "endTime": "23:59"
              }
            ]
          },
          "example-2": {
            "imeis": [
              "868239050345326"
            ],
            "timeSegmentsType": "afterHours"
          }
        },
        "title": "",
        "properties": {
          "imeis": {
            "type": "array",
            "description": "IMEI list of the devices to apply the filter. If no IMEI is provided, the filter will be applied to all devices.",
            "items": {
              "type": "string"
            }
          },
          "timeSegmentsType": {
            "type": "string",
            "nullable": true,
            "enum": [
              "always",
              "business",
              "afterHours",
              "custom",
              "weekdays",
              "weekends"
            ],
            "description": "Which schedule the alert follows.\n\nFor `business` and `afterHours` the schedule is DERIVED from the account's business hours and\n`timeSegments` is ignored on the way in: whatever you send is discarded and replaced with the\naccount's own hours (`business`) or the complement of them across the week (`afterHours`). The\nstored schedule is then kept current automatically — editing the account's business hours\nre-derives every alert configuration that uses one of these two values. An account with no\nbusiness hours configured falls back to 08:00-17:00 Monday to Friday.\n\nFor `always`, `custom`, `weekdays` and `weekends` the `timeSegments` you send ARE the schedule,\nstored as sent and never rewritten. `weekdays` and `weekends` are legacy values kept for older\nmobile clients; prefer `custom`.\n\nOmit the field to leave the alert unscoped. On update, omitting it keeps whatever is stored —\nsend `null` explicitly to clear it.\n"
          },
          "timeSegments": {
            "type": "array",
            "description": "The time windows in which the alert may fire, in the device's local time. Both ends are\nINCLUSIVE, so `08:00`-`17:00` includes the whole of minute 17:00. Ignored when\n`timeSegmentsType` is `business` or `afterHours` — see that field.\n",
            "items": {
              "$ref": "#/components/schemas/AlertConfigFilterTimeSegment"
            }
          }
        }
      },
      "UpdateClientAlertConfigurationBody": {
        "description": "The client alert configuration properties to update",
        "type": "object",
        "x-examples": {
          "example-1": {
            "name": "Speeding 50 km/h",
            "description": "Speeding 50 km/h",
            "status": "active",
            "readOnly": false,
            "alertValue": "50",
            "alertMetadata": "{\"speed\": \"50\"}",
            "filter": {
              "imei": "868239050345326",
              "timeSegments": [
                {
                  "daysOfWeek": "1111111",
                  "startTime": "00:00",
                  "endTime": "23:59"
                }
              ]
            }
          }
        },
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "deleted"
            ]
          },
          "readOnly": {
            "type": "boolean"
          },
          "alertValue": {
            "type": "string"
          },
          "alertMetadata": {
            "type": "string"
          },
          "filter": {
            "$ref": "#/components/schemas/AlertConfigFilter"
          }
        }
      },
      "SuccessEmptyResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message",
          "success"
        ],
        "x-examples": {
          "example-1": {
            "value": {
              "success": true,
              "message": "ok"
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "x-examples": {
          "example-1": {
            "value": {
              "success": false,
              "message": "Unauthorized"
            }
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "example-1": {
                "value": {
                  "success": false,
                  "message": "Unauthorized"
                }
              }
            }
          }
        }
      },
      "Error": {
        "description": "Server error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "example-1": {
                "value": {
                  "success": false,
                  "message": "Error"
                }
              }
            }
          }
        }
      },
      "ClientAlertConfigurationNotFound": {
        "description": "The specified resource was not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "example-1": {
                "value": {
                  "success": false,
                  "message": "Client alert configuration not found"
                }
              }
            }
          }
        }
      },
      "UnschedulableAlert": {
        "description": "The requested schedule leaves the alert no time in which it could ever fire. Returned when\n`filter.timeSegmentsType` is `afterHours` on an account whose business hours cover the entire week,\nso the complement is empty. Widen the account's business hours or pick a different schedule.\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "example-1": {
                "value": {
                  "success": false,
                  "message": "Business hours cover the entire week, so an \"Outside Business Hours\" alert has no time in which it could fire"
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://auth.usehapn.com/oauth2/token",
            "scopes": {}
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Alerts",
      "description": "Alerts configurations"
    }
  ],
  "security": [
    {
      "OAuth2": []
    }
  ]
}
```