Skip to main content

Alerts - Update Status

Endpoint

/i/alert/status

Overview

Bulk updates enabled status for one or more alerts.

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions

Requires alerts Update permission.

Request Parameters

ParameterTypeRequiredDescription
statusJSON String (Object)YesJSON-stringified map of alertID -> enabledBoolean.
app_idStringConditionalRequired for non-global-admin users during update validation.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

status Object Structure

Decoded example:

{
"65f0cbf8bca6b8e8fbf7f901": true,
"65f0cbf8bca6b8e8fbf7f902": false
}

Examples

Enable and disable alerts in one request

/i/alert/status?
app_id=6991c75b024cb89cdc04efd2&
api_key=YOUR_API_KEY&
status={
"65f0cbf8bca6b8e8fbf7f901":true,
"65f0cbf8bca6b8e8fbf7f902":false
}

Response

Success Response

true

Response Fields

FieldTypeDescription
(root value)Booleantrue after batch update promise resolves.

Error Responses

  • 400
{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}
  • 401
{
"result": "No app_id provided"
}
  • 401
{
"result": "User does not exist"
}
  • 401
{
"result": "User does not have right"
}
  • 500
{
"result": "Failed to change alert statusMongoServerError: write conflict"
}

Behavior

Behavior Modes

ModeTriggerProcessing PathResponse Shape
Bulk updateValid status JSON mapBuilds per-alert updates and applies enabled value using findAndModify operations.Raw boolean true
Parse failureInvalid JSON in statusStops before DB writes.Wrapped error message

Impact on Other Data

  • Invalidates alerts cache so status changes are used by alert processor.
  • For non-global-admin users, updates are scoped to alerts with createdBy=current_user.

Limitations

  • Endpoint returns true even if some IDs do not match any alert (no per-ID status is returned).
  • Invalid alert IDs can fail ObjectId conversion during processing.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersAuthentication and permission checksReads member account and access rights for update validation.
countly.appsApp validation/context loadingValidates app_id for non-global-admin update access.
countly.alertsAlert rule persistenceUpdates enabled field on matching alerts.