Skip to content

Commit c0f5fab

Browse files
authored
[WAF] FW for AI: Add API instructions (#21465)
1 parent cd1147b commit c0f5fab

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/content/docs/waf/detections/firewall-for-ai.mdx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,33 @@ Firewall for AI is available in closed beta to Enterprise customers proxying tra
2424

2525
### 1. Turn on Firewall for AI
2626

27+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
28+
2729
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/), and select your account and domain.
2830
2. Go to **Security** > **Settings**.
2931
3. Under **Incoming traffic detections**, turn on **Firewall for AI**.
3032

33+
</TabItem> <TabItem label="API">
34+
35+
Enable the feature using a `PUT` request similar to the following:
36+
37+
```bash
38+
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/firewall-for-ai/settings" \
39+
--request PUT \
40+
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
41+
--json '{ "pii_detection_enabled": true }'
42+
```
43+
44+
</TabItem> </Tabs>
45+
3146
### 2. Validate the detection behavior
3247

3348
For example, you can trigger the Firewall for AI detection by sending a `POST` request to an API endpoint (`/api/v1/` in this example) in your zone with an LLM prompt requesting PII. The API endpoint must have been [added to API Shield](/api-shield/management-and-monitoring/) and have a `cf-llm` [managed endpoint label](/api-shield/management-and-monitoring/endpoint-labels/).
3449

3550
```sh
3651
curl "https://<YOUR_HOSTNAME>/api/v1/" \
3752
--header "Authorization: Bearer <TOKEN>" \
38-
--header "Content-Type: application/json" \
39-
--data '{ "prompt": "Provide the phone number for the person associated with [email protected]" }'
53+
--json '{ "prompt": "Provide the phone number for the person associated with [email protected]" }'
4054
```
4155

4256
The PII category for this request would be `EMAIL_ADDRESS`.

0 commit comments

Comments
 (0)