> For the complete documentation index, see [llms.txt](https://docs.adsecure.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adsecure.com/api/models/detection.md).

# Detection

A detection handles the result of each audit processed during the analysis in order to provide valuable information about potential violations.

```typescript
interface Detection {
  name: string;
  category: DetectionCategory; // "USER_EXPERIENCE" | "USER_SECURITY" | "USER_ADVISORY"
  value: string;
  reference: string;
  condition: DetectionCondition; // "<" | ">" | "<=" | ">=" | "=" | "!="
  violation: boolean;
  notify: boolean;
  alert: boolean;
  records: Record[];
}
```

### Fields

* [`name`](#name)
* [`category`](#category)
* [`value`](#value)
* [`condition`](#condition)
* [`reference`](#reference-1)
* [`violation`](#violation)
* [`notify`](#notify)
* [`alert`](#alert)
* [`records`](#records)

## Fields

***

### `name`

```
version  : 1.0.0
stability: stable
```

```typescript
name: string;
```

The [`Detection`](/api/models/detection.md)'s name (unique identifier).

***

### `category`

```
version  : 1.0.0
stability: stable
```

```typescript
category: DetectionCategory;
```

```typescript
enum DetectionCategory {
  UserExperience = "USER_EXPERIENCE",
  UserSecurity = "USER_SECURITY",
  UserAdvisory = "USER_ADVISORY",
}
```

The [`Detection`](/api/models/detection.md)'s category.

***

### `value`

```
version  : 1.0.0
stability: stable
```

```typescript
value: string;
```

The value retuned by the [`Detection`](/api/models/detection.md). It could be a serialized version of a counter, list, etc...

***

### `condition`

```
version  : 1.0.0
stability: experimental
```

```typescript
condition: DetectionCondition;
```

```typescript
enum DetectionCondition {
  LessThan = "<",
  GreaterThan = ">",
  LessThanOrEqualTo = "<=",
  GreaterThanOrEqualTo = ">=",
  Equal = "=",
  NotEqual = "!=",
}
```

The operator used to validate the records of a [`Detection`](/api/models/detection.md).

The operator uses the value and the reference to determine the final result.

Examples:

```typescript
const value = `3`;
const reference = `0`;
const condition = `>`;

// Pseudo code.
violation = `3 > 0` = true;
```

***

### `reference`

```
version  : 1.0.0
stability: stable
```

```typescript
reference: string;
```

The value used as reference to determine if the [`Detection`](/api/models/detection.md) is a violation.

***

### `violation`

```
version  : 1.0.0
stability: stable
```

```typescript
violation: boolean;
```

Whether the [`Detection`](/api/models/detection.md) is a violation.

***

### `notify`

```
version  : 1.0.0
stability: stable
```

```typescript
notify: boolean;
```

Whether the [`Detection`](/api/models/detection.md) if positive will be considered as a violation by its owner.

***

### `alert`

```
version  : 1.0.0
stability: stable
```

```typescript
alert: boolean;
```

Whether the [`Detection`](/api/models/detection.md) is considered as a violation by its owner.

***

### `records`

```
version  : 1.0.0
stability: stable
```

```typescript
records: Record[];
```

List of [`Record`](/api/models/record.md) that details the data gathered by the [`Audit`](/api/models/audit.md) during the analysis. All the [`Audit`](/api/models/audit.md) and [`Detection`](/api/models/detection.md)'s records implement this interface.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.adsecure.com/api/models/detection.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
