> ## Documentation Index
> Fetch the complete documentation index at: https://docs.godiligent.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Acknowledge Monitoring Alerts

> Acknowledge (mark as seen) one or all monitoring alerts.

## Overview

Acknowledge (mark as seen) one or all monitoring alerts for the authenticated customer.

## Request

* **Method**: `POST`
* **Path**: `/monitoring-alerts/acknowledge`
* **Body**: JSON object specifying either a single alert ID or all alerts

### Request Body

* `alert_id` (string, optional) - ID of the alert to acknowledge
* `all` (boolean, optional) - If true, acknowledges all alerts for the customer
* Exactly one of `alert_id` or `all` must be provided

### Example Request (single alert)

```json theme={null}
{
  "alert_id": "532ebbd3-269d-4c8f-b73b-2269eb83f1ae"
}
```

### Example Request (all alerts)

```json theme={null}
{
  "all": true
}
```

## Success Response

* **Status**: 200 OK

### Response Body (single alert)

```json theme={null}
{
  "success": true,
  "message": "Alert acknowledged",
  "unacknowledged_count": 5
}
```

### Response Body (all alerts)

```json theme={null}
{
  "success": true,
  "message": "7 alerts acknowledged",
  "unacknowledged_count": 0
}
```

## Error Handling

* **400 Bad Request**
  * Invalid request body or both `alert_id` and `all` provided
  * Example: `{ "error": "Either alert_id OR all must be provided, but not both" }`
* **404 Not Found**
  * Alert with specified ID was not found
  * Example: `{ "error": "Alert not found" }`
* **401 Unauthorized**
  * Missing or invalid customer authentication
* **500 Internal Server Error**
  * Unexpected server error

## Notes

* Only the owner (customer) may acknowledge their alerts
* Bulk acknowledgment returns the number of alerts updated


## OpenAPI

````yaml POST /monitoring-alerts/acknowledge
openapi: 3.0.1
info:
  version: 1.5.0
  title: Diligent
  description: >
    Download Postman collection
    [here](https://docs.godiligent.ai/files/postman_collection.json).
servers:
  - url: https://api.godiligent.ai
    description: Production
  - url: https://api.sandbox.godiligent.ai
    description: Sandbox
security:
  - xApiKey: []
tags:
  - name: CDD
    description: Customer Due Diligence
  - name: Company
    description: Company Information
  - name: Blocked Companies
    description: Manage blocked companies
  - name: Monitorings
    description: Website monitoring and alerts for changes and risks
  - name: Webhooks
    description: >

      ## How to Secure Webhook Deliveries

      To ensure that webhook payloads are securely transmitted and verified.
      This guide explains how to configure and validate

      webhook deliveries using a shared secret.


      ### How It Works


      When setting up a webhook, a secret is configured on both the sender (our
      system) and the receiver (your endpoint). Each

      webhook payload is signed using this secret, allowing the receiver to
      verify its authenticity.


      #### Step 1: Configuring Your Webhook Secret


      1. When creating a webhook in our system, specify a unique secret key.
      This secret should be a strong, randomly

      generated string.

      2. Store this secret securely on your server; it should never be exposed
      publicly.


      #### Step 2: Receiving Webhook Payloads


      When your server receives a webhook event, the request will include an
      `X-Signature` header containing a HMAC signature

      of the payload.


      Example header:


      ```

      X-Signature: sha256=abcdef1234567890...

      ```


      #### Step 3: Validating the Webhook Signature


      To verify the webhook payload:


      1. Retrieve the `X-Signature` value from the request headers.

      2. Compute the HMAC SHA-256 signature of the request payload using your
      webhook secret.

      3. Compare the computed signature with the one in the `X-Signature`
      header.

      4. If they match, the webhook is valid.


      #### (Python)


      ```python

      import hashlib

      import hmac

      import json


      def verify_webhook_signature(secret, payload, signature):
        computed_signature = hmac.new(secret.encode(), payload.encode(), hashlib.sha256).hexdigest()
        expected_signature = f"sha256={computed_signature}"
        return hmac.compare_digest(expected_signature, signature)

      # Example usage:

      secret = "your_webhook_secret"

      payload = json.dumps({"event": "example"})

      received_signature = "sha256=abcdef1234567890..."


      if verify_webhook_signature(secret, payload, received_signature):
        print("Valid webhook received!")
      else:
        print("Invalid webhook signature!")
      ```


      #### (JavaScript)


      ```javascript

      const crypto = require('crypto');


      function verifyWebhookSignature (secret, payload, signature) {

      const computedSignature = `sha256=${crypto.createHmac('sha256', secret)

      .update(payload)

      .digest('hex')}`;

      return crypto.timingSafeEqual(Buffer.from(computedSignature),
      Buffer.from(signature));

      }


      // Example usage:

      const secret = "your_webhook_secret";

      const payload = JSON.stringify({ event: "example" });

      const receivedSignature = "sha256=abcdef1234567890...";


      if (verifyWebhookSignature(secret, payload, receivedSignature)) {

      console.log("Valid webhook received!");

      } else {

      console.log("Invalid webhook signature!");

      }

      ```


      #### Security Considerations


      - Always use HTTPS to prevent interception of webhook payloads.

      - Reject webhook requests that fail signature validation.

      - Rotate secrets periodically to enhance security.


      By following this guide, you ensure that webhook deliveries are secure and
      trusted.
  - name: Instant Screening (experimental)
    description: Instant Website Screening API
  - name: Name Screening
    description: Name screening search, alert management and remediation
paths:
  /monitoring-alerts/acknowledge:
    post:
      tags:
        - Monitorings
      summary: Acknowledge (mark as seen) monitoring alerts
      description: >-
        Acknowledge (mark as seen) one or all monitoring alerts for the
        authenticated customer. Exactly one of alertId or all must be provided
        in the request body.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AcknowledgeAlertsRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AcknowledgeAlertsResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized
        '404':
          description: Alert not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
      security:
        - xApiKey: []
components:
  schemas:
    AcknowledgeAlertsRequest:
      type: object
      properties:
        alert_id:
          type: string
          description: ID of the alert to acknowledge
        all:
          type: boolean
          description: If true, acknowledge all alerts
      oneOf:
        - required:
            - alert_id
        - required:
            - all
      description: Either alert_id OR all must be provided, but not both
    AcknowledgeAlertsResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the operation succeeded
        message:
          type: string
          description: Success message
        unacknowledged_count:
          type: integer
          description: Number of unacknowledged alerts remaining
          nullable: true
    ValidationError:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
      required:
        - errors
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
    ValidationErrorItem:
      type: object
      properties:
        path:
          type: array
          items:
            type: string
          description: JSON path to the field with the error
        message:
          type: string
          description: Error message
        code:
          type: string
          description: Error code indicating the type of error
      required:
        - path
        - message
        - code
  securitySchemes:
    xApiKey:
      type: apiKey
      name: X-API-KEY
      in: header

````