> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api-docs.botbye.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api-docs.botbye.com/_mcp/server.

# declined events count

GET {base_url}/api/v1/{account_id}/projects/{project_id}/overviews/declined_events/count

# Get Declined Requests Count

Retrieves detailed metrics about declined requests for a specific project, including counts and trend analysis. This endpoint helps you understand the volume and patterns of blocked traffic, including custom rule violations and bot detection.

## Endpoint

```
GET {base_url}/api/v1/{account_id}/projects/{project_id}/overviews/declined_requests/count
```

## Authentication

Requires API key authentication:
```
Authorization: Bearer {api_key}
```

## Path Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `account_id` | string | Yes | Your unique BotBye account identifier |
| `project_id` | string | Yes | The project identifier for which to retrieve declined request metrics |

## Query Parameters

This endpoint supports time-based filtering parameters to specify the date range for analysis:

- **Time period filters** - Specify start/end dates for the analysis period
- See [Pagination query parameters](https://botbye.com/docs/api#query-parameters) for additional options

## Response Structure

The response returns an object containing declined request metrics and trends:

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Unique identifier combining `projectId`, `day`, and `hour` (format: `projectId_day_hour`) |
| `projectId` | string | The project identifier |
| `customerId` | null | Always null for project-level data |
| `bannedReqCount` | integer | Number of requests declined by custom rules during this period |
| `bannedReqTrend` | float | Percentage change in declined requests compared to previous period (negative = decrease, positive = increase) |
| `botReqCount` | integer | Number of requests identified as bot traffic during this period |
| `botReqTrend` | float | Percentage change in bot requests compared to previous period |

## Example Response

```json
{
  "id": "185071d5-d4fe-4bea-93df-19d0bd8c2d0d_2024-08-17_0",
  "projectId": "185071d5-d4fe-4bea-93df-19d0bd8c2d0d",
  "customerId": null,
  "bannedReqCount": 56298,
  "bannedReqTrend": -63.75,
  "botReqCount": 0,
  "botReqTrend": 0
}
```

## Use Cases

- **Security Monitoring**: Track the volume of blocked malicious requests
- **Trend Analysis**: Identify increases or decreases in attack activity
- **Rule Effectiveness**: Measure how many requests your custom rules are blocking
- **Bot Detection Metrics**: Monitor automated bot traffic separately from rule-based blocks
- **Alert Configuration**: Set up alerts when declined request trends spike
- **Security Reporting**: Generate reports showing protection effectiveness over time

## Understanding Trends

The trend values indicate percentage changes compared to the previous equivalent time period:

- **Negative trend** (e.g., `-63.75`): Declined requests decreased by 63.75%
- **Positive trend** (e.g., `+45.20`): Declined requests increased by 45.20%
- **Zero trend** (`0`): No change from previous period

## Important Notes

- Trends are calculated by comparing to the equivalent previous time period
- A decrease in `bannedReqCount` trend may indicate reduced attack activity or rule adjustments
- `botReqCount` specifically tracks automated bot traffic detected by BotBye's bot detection algorithms
- `bannedReqCount` includes requests blocked by your custom security rules
- The `customerId` field is always `null` for project-level aggregations

Reference: https://api-docs.botbye.com/bot-bye-api/protection/overview/declined-events-count

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/{account_id}/projects/{project_id}/overviews/declined_events/count:
    get:
      operationId: declined-events-count
      summary: declined events count
      description: >-
        # Get Declined Requests Count


        Retrieves detailed metrics about declined requests for a specific
        project, including counts and trend analysis. This endpoint helps you
        understand the volume and patterns of blocked traffic, including custom
        rule violations and bot detection.


        ## Endpoint


        ```

        GET
        {base_url}/api/v1/{account_id}/projects/{project_id}/overviews/declined_requests/count

        ```


        ## Authentication


        Requires API key authentication:

        ```

        Authorization: Bearer {api_key}

        ```


        ## Path Parameters


        | Parameter | Type | Required | Description |

        |-----------|------|----------|-------------|

        | `account_id` | string | Yes | Your unique BotBye account identifier |

        | `project_id` | string | Yes | The project identifier for which to
        retrieve declined request metrics |


        ## Query Parameters


        This endpoint supports time-based filtering parameters to specify the
        date range for analysis:


        - **Time period filters** - Specify start/end dates for the analysis
        period

        - See [Pagination query
        parameters](https://botbye.com/docs/api#query-parameters) for additional
        options


        ## Response Structure


        The response returns an object containing declined request metrics and
        trends:


        | Field | Type | Description |

        |-------|------|-------------|

        | `id` | string | Unique identifier combining `projectId`, `day`, and
        `hour` (format: `projectId_day_hour`) |

        | `projectId` | string | The project identifier |

        | `customerId` | null | Always null for project-level data |

        | `bannedReqCount` | integer | Number of requests declined by custom
        rules during this period |

        | `bannedReqTrend` | float | Percentage change in declined requests
        compared to previous period (negative = decrease, positive = increase) |

        | `botReqCount` | integer | Number of requests identified as bot traffic
        during this period |

        | `botReqTrend` | float | Percentage change in bot requests compared to
        previous period |


        ## Example Response


        ```json

        {
          "id": "185071d5-d4fe-4bea-93df-19d0bd8c2d0d_2024-08-17_0",
          "projectId": "185071d5-d4fe-4bea-93df-19d0bd8c2d0d",
          "customerId": null,
          "bannedReqCount": 56298,
          "bannedReqTrend": -63.75,
          "botReqCount": 0,
          "botReqTrend": 0
        }

        ```


        ## Use Cases


        - **Security Monitoring**: Track the volume of blocked malicious
        requests

        - **Trend Analysis**: Identify increases or decreases in attack activity

        - **Rule Effectiveness**: Measure how many requests your custom rules
        are blocking

        - **Bot Detection Metrics**: Monitor automated bot traffic separately
        from rule-based blocks

        - **Alert Configuration**: Set up alerts when declined request trends
        spike

        - **Security Reporting**: Generate reports showing protection
        effectiveness over time


        ## Understanding Trends


        The trend values indicate percentage changes compared to the previous
        equivalent time period:


        - **Negative trend** (e.g., `-63.75`): Declined requests decreased by
        63.75%

        - **Positive trend** (e.g., `+45.20`): Declined requests increased by
        45.20%

        - **Zero trend** (`0`): No change from previous period


        ## Important Notes


        - Trends are calculated by comparing to the equivalent previous time
        period

        - A decrease in `bannedReqCount` trend may indicate reduced attack
        activity or rule adjustments

        - `botReqCount` specifically tracks automated bot traffic detected by
        BotBye's bot detection algorithms

        - `bannedReqCount` includes requests blocked by your custom security
        rules

        - The `customerId` field is always `null` for project-level aggregations
      tags:
        - subpackage_overview
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: string
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: interval
          in: query
          description: >-
            (Optional) Defines the interval for the overview. The interval is
            used in conjunction with intervalType to determine the specific time
            span of the overview. The default value is 1, meaning the current
            day (or month if interval_type = month).
          required: false
          schema:
            type: integer
        - name: interval_type
          in: query
          description: >-
            (Optional)  Specifies the type of interval for the overview. This
            can be HOUR, DAY, MONTH. The default value is DAY, meaning the
            overview will cover a single day.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Overview_declinedEventsCount_Response_200'
        '400':
          description: fail
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: >-
                    #/components/schemas/ApiV1AccountIdProjectsProjectIdOverviewsDeclinedEventsCountGetResponsesContentApplicationJsonSchemaItems
servers:
  - url: '{base_url}'
    description: '{base_url}'
components:
  schemas:
    Overview_declinedEventsCount_Response_200:
      type: object
      properties:
        id:
          type: string
        projectId:
          type: string
          format: uuid
        customerId:
          description: Any type
        bannedReqCount:
          type: integer
        bannedReqTrend:
          type: number
          format: double
        botReqCount:
          type: integer
        botReqTrend:
          type: integer
      required:
        - id
        - projectId
        - bannedReqCount
        - bannedReqTrend
        - botReqCount
        - botReqTrend
      title: Overview_declinedEventsCount_Response_200
    ApiV1AccountIdProjectsProjectIdOverviewsDeclinedEventsCountGetResponsesContentApplicationJsonSchemaItemsContext:
      type: object
      properties:
        param:
          type: string
        type:
          type: string
      title: >-
        ApiV1AccountIdProjectsProjectIdOverviewsDeclinedEventsCountGetResponsesContentApplicationJsonSchemaItemsContext
    ApiV1AccountIdProjectsProjectIdOverviewsDeclinedEventsCountGetResponsesContentApplicationJsonSchemaItems:
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        type:
          type: string
        context:
          $ref: >-
            #/components/schemas/ApiV1AccountIdProjectsProjectIdOverviewsDeclinedEventsCountGetResponsesContentApplicationJsonSchemaItemsContext
      required:
        - message
        - code
        - type
      title: >-
        ApiV1AccountIdProjectsProjectIdOverviewsDeclinedEventsCountGetResponsesContentApplicationJsonSchemaItems

```

## Examples



**Response**

```json
{
  "id": "185071d5-d4fe-4bea-93df-19d0bd8c2d0d_2024-08-17_0",
  "projectId": "185071d5-d4fe-4bea-93df-19d0bd8c2d0d",
  "bannedReqCount": 56298,
  "bannedReqTrend": -63.75,
  "botReqCount": 0,
  "botReqTrend": 0
}
```

**SDK Code**

```python Overview_declinedEventsCount_example
import requests

url = "https://{base_url}/api/v1/account_id/projects/project_id/overviews/declined_events/count"

querystring = {"interval":"1","interval_type":"DAY"}

response = requests.get(url, params=querystring)

print(response.json())
```

```javascript Overview_declinedEventsCount_example
const url = 'https://{base_url}/api/v1/account_id/projects/project_id/overviews/declined_events/count?interval=1&interval_type=DAY';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Overview_declinedEventsCount_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://{base_url}/api/v1/account_id/projects/project_id/overviews/declined_events/count?interval=1&interval_type=DAY"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Overview_declinedEventsCount_example
require 'uri'
require 'net/http'

url = URI("https://{base_url}/api/v1/account_id/projects/project_id/overviews/declined_events/count?interval=1&interval_type=DAY")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java Overview_declinedEventsCount_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://{base_url}/api/v1/account_id/projects/project_id/overviews/declined_events/count?interval=1&interval_type=DAY")
  .asString();
```

```php Overview_declinedEventsCount_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://{base_url}/api/v1/account_id/projects/project_id/overviews/declined_events/count?interval=1&interval_type=DAY');

echo $response->getBody();
```

```csharp Overview_declinedEventsCount_example
using RestSharp;

var client = new RestClient("https://{base_url}/api/v1/account_id/projects/project_id/overviews/declined_events/count?interval=1&interval_type=DAY");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift Overview_declinedEventsCount_example
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://{base_url}/api/v1/account_id/projects/project_id/overviews/declined_events/count?interval=1&interval_type=DAY")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```