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

# RTB bcat gate: enforce blocked content categories

> Fails any bid whose creative categories overlap with the request's bcat blocked list, enforcing the OpenRTB blocked-category contract on every response.

The bcat compliance gate enforces one of the most fundamental OpenRTB rules: if a publisher declares that certain content categories are blocked on their inventory, no bid in the response may carry a creative from those categories. The `bcat` field on the bid request is a publisher's explicit blocklist. Ignoring it exposes the exchange to brand safety incidents and breaches the supply-side contract.

## Usage

```typescript theme={null}
import { createEngine, gates } from "@pecta/core";

const engine = createEngine({
  gates: [
    gates.rtb.tmaxGuard({ bufferMs: 15 }),
    gates.rtb.bcatCompliance(),
    // ...
  ],
  timeout: 15,
});
```

## How it works

The gate reads the top-level `bcat` array from `ctx.input` (the bid request) and builds a set of blocked IAB category strings. It then iterates every bid in the response and checks each entry in `bid.cat[]` against that set. The first match causes an immediate failure.

```json theme={null}
{
  "name": "rtb.bcat-compliance",
  "passed": false,
  "reason": "blocked category in response: IAB25-2",
  "latency_ms": 1
}
```

## Skipping behaviour

The gate returns `passed: true, skipped: true` when:

* The request has no `bcat` field, or `bcat` is an empty array — there is nothing to enforce
* The response contains no bids — there is nothing to check

<Info>
  `bcat` contains IAB content category codes such as `IAB25` (non-standard content) or `IAB26` (illegal content). The values come from the publisher or SSP configuration and vary per auction. The gate performs exact string matching against whatever values are present in the request.
</Info>

## Example: blocked category in bid

A publisher blocks gambling and adult content:

```json theme={null}
{
  "bcat": ["IAB9-7", "IAB25-3"],
  "imp": [{ "id": "imp-001", "bidfloor": 1.00 }]
}
```

A bid response carries a creative tagged with one of the blocked categories:

```json theme={null}
{
  "seatbid": [
    {
      "bid": [
        {
          "id": "bid-1",
          "impid": "imp-001",
          "price": 1.20,
          "cat": ["IAB9-7"]
        }
      ]
    }
  ]
}
```

The gate finds `IAB9-7` in both the blocked set and the bid's `cat` array and returns `passed: false`.

## Options

<ParamField path="name" type="string" default="rtb.bcat-compliance">
  Override the gate's name in evaluation results and telemetry.
</ParamField>

<Warning>
  `bcat` matching is exact — `IAB9` and `IAB9-7` are treated as distinct values. If a publisher blocks `IAB9` but your bid carries `IAB9-7`, the gate will not catch it. Normalise category granularity to match what your publishers declare.
</Warning>
