Discover and secure your API endpoints (·续
Note
Place exception rules above (before) enforcement rules in your rule list. Cloudflare evaluates custom rules in order, and the first matching rule with a terminating action stops evaluation. For more information, refer to Rule execution order.
Configure Super Bot Fight Mode (Pro, Business)
Super Bot Fight Mode provides granular controls that apply across your domain, allowing you to apply different actions to different bot types.
Note
If you are upgrading from Bot Fight Mode to Super Bot Fight Mode, go to Security > Settings, filter by Bot traffic, and turn Bot fight mode off.
To configure Super Bot Fight Mode:
- In the Cloudflare dashboard, go to the Security Settings page. Go to Settings ↗
- Filter by Bot traffic.
- Go to Super Bot fight mode.
- Turn Super Bot fight mode on.
- Choose how your domain should respond to various types of traffic by selecting the associated edit icon:
- For more details on verified bots, refer to Verified Bots.
- For more details on supported file types, refer to Static resource protection.
- For more details on invisible code injection, refer to JavaScript detections.
- For more details on WordPress optimization, refer to Super Bot Fight Mode for WordPress.
With Super Bot Fight Mode, you can configure different actions for different bot types:
- Block or allow verified bots
- Configure a separate action (allow, block, or challenge) for Definitely automated traffic (bot score of 1)
- On Business plans and above: Configure a separate action for Likely automated traffic (bot score of 2-29)
Super Bot Fight Mode applies domain-wide and does not support path-specific rules. If you need to apply different bot thresholds to different API paths, you need a Bot Management subscription (Enterprise).
Bot score in custom rules (Enterprise)
With a Bot Management subscription, you can write custom rules using cf.bot_management.score to set path-specific thresholds. For example, block requests with a bot score below 30 on /api/auth paths while allowing all scores on other API paths. For more information, refer to Bot Management.
Detect leaked credentials on login endpoints
Application Security leaked credentials detection checks incoming requests for username and password combinations that appeared in known data breaches. Use this detection to rate limit or challenge requests containing compromised credentials on your authentication endpoints.
Note
Access to the cf.waf.credential_check.username_and_password_leaked field (User and Password Leaked) requires a Pro plan or above. If you are on a Free plan, use the cf.waf.credential_check.password_leaked field (Password Leaked) instead, which indicates whether the password detected in the request was previously leaked.
The following rate limiting rule limits requests that contain a previously leaked username and password combination to 5 per minute per IP:
| Setting | Value |
|---|---|
| Expression | cf.waf.credential_check.username_and_password_leaked |
| Counting characteristics | IP |
| Requests per period | 5 requests / 1 minute |
| Action | Block |
For the full expression including account takeover (ATO) detection IDs, refer to Example mitigation rules.
Sequence Analytics and sequence mitigation custom rules (Enterprise)
API Shield tracks the order of API endpoint requests over time, grouping important user journeys (sequences) across your API. Sequences with high precedence scores indicate requests that are likely to occur together in order. Anomalous sequences may indicate automated abuse, such as a bot that calls /auth, then /account, then /transfer in rapid succession. For more information, refer to Sequence Analytics.
Enterprise users with a Fraud Detection subscription can also create sequence mitigation custom rules to mitigate invalid sequences of API calls.
Monitor your API traffic
After deploying your security rules, review the results to identify false positives and tune your thresholds. False positives (legitimate clients being blocked) and false negatives (abuse getting through) both require adjustments.
Review Security Events for API paths
Security Events shows every request that your rules matched, including the action taken and the rule that triggered it. Filter by your API path prefix to see what Cloudflare is blocking and why.
- In the Cloudflare dashboard, go to the Analytics page. Go to Analytics ↗
- Select the Events tab.
- Add a filter for URI Path starts with
/api/. - Review the events. Look for legitimate clients that are being blocked (false positives). Common indicators of false positives:
- Requests from known partner IP addresses
- Requests with valid API keys or authorization headers
- Requests from monitoring services with known User-Agent strings
If you find false positives, update your custom rules to exclude the affected traffic. Refer to the exception rule procedure in an earlier section.
Tune rate limiting thresholds
Rate limiting thresholds that are too tight block legitimate clients. Thresholds that are too loose allow abuse. Review rate limiting events in Security Events to find the right balance.
- In the Cloudflare dashboard, go to the Analytics page. Go to Analytics ↗
- Select the Events tab.
- Filter by Action equals Block and Service equals Rate limiting.
- Check whether blocked requests come from legitimate clients or abusive traffic.
- If legitimate clients are being rate limited, edit the relevant rate limiting rule to increase the request threshold or widen the time period for the affected rule.
- If abusive traffic is getting through, lower the rule threshold or narrow the time period.
Security Analytics rate analysis requires an Enterprise plan
Enterprise customers can use the Request rate analysis tab in Security Analytics to visualize request rate distributions and the Log action to observe rule matches without taking action. On other plans, estimate thresholds based on your expected traffic patterns. Refer to Find an appropriate rate limit for the full methodology.
Set up notifications for security event spikes
Cloudflare Notifications can alert you when security event volume exceeds a threshold, indicating a potential attack or a misconfigured rule.
- In the Cloudflare dashboard, go to the Notifications page. Go to Notifications ↗
- Select Add.
- Filter by WAF and select Security Events Alert.
- Define a name for the notification and the delivery method (email, webhook, or PagerDuty).
- Next, configure the domains for which you want to receive notifications. You can also filter events by a targeted action (for example, Block or Skip).
- Select Create.
For the full list of available notification types, refer to Available notifications.
Advanced security events notifications (Enterprise)
Enterprise customers have access to the Advanced Security Events Alert notification type, which includes an additional filter for the app security services the alert should monitor.
Related resources
Application Security
- Custom rules — Create rules based on request attributes to block, challenge, or skip specific security features for targeted traffic
- Rate limiting rules — Define request rate thresholds per client and choose enforcement actions
- Rate limiting best practices — Common rate limiting patterns for credential stuffing, API protection, and GraphQL
- Rate limiting rule examples — Example rules with expressions for login pages, API keys, and complexity-based limiting
- Security features interoperability — How custom rules, rate limiting rules, Super Bot Fight Mode, and Managed Rules interact
- Leaked credentials detection — Detect requests containing credentials from known data breaches
- Security Events — Review matched requests and rule actions
Bots
- Bot Fight Mode — Automatic challenge for requests matching known bot patterns (Free plan)
- Super Bot Fight Mode — Granular bot controls including verified bot allowlisting (Pro, Business, Enterprise)
- Bot Management — Bot score, detection IDs, and custom rule templates (Enterprise)
- Bot Management variables — Fields available in rule expressions for bot detection (Enterprise)
SSL/TLS
- Get started with SSL/TLS — Edge certificates, encryption modes, and HTTPS enforcement
- Always Use HTTPS — Redirect all HTTP requests to HTTPS
- Minimum TLS Version — Reject connections using older TLS protocols
API Shield (Enterprise)
- API Shield overview — Discovery, schema validation, JWT validation, and sequence analytics for API security
- Get started with API Shield — Onboarding flow from session identifiers through schema validation
- API Discovery — Automatic endpoint discovery from traffic analysis
- Schema validation — Validate incoming requests against your OpenAPI schema
- JWT validation — Verify JSON Web Tokens at the edge
- Sequence Analytics — Track and analyze API request sequences
- Volumetric Abuse Detection — Per-session, per-endpoint adaptive rate limiting
- Authentication Posture — helps users identify authentication misconfigurations for APIs and alerts of their presence
- BOLA vulnerability detection — Detect endpoints at risk of Broken Object Level Authorization (BOLA) attacks
- Vulnerability Scanner — Test your API endpoints for common vulnerabilities
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/use-cases/solutions/discover-secure-api-endpoints/#page","headline":"Discover and secure your API endpoints (Free, Pro, and Business)","description":"Block API abuse, restrict unauthorized access, and monitor endpoint traffic using layered Cloudflare security features.","url":"https://developers.cloudflare.com/use-cases/solutions/discover-secure-api-endpoints/","inLanguage":"en","image":"https://developers.cloudflare.com/use-cases/solutions/discover-secure-api-endpoints/og.png?v=c9ebba8f904a3105","dateModified":"2026-08-03","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["REST API","Security"]}
description: Configure SSL/TLS encryption from edge to origin, redirect HTTP to HTTPS, and harden your HTTPS setup with HSTS and minimum TLS versions. title: Enforce HTTPS and encrypt all traffic (Free, Pro, and Business) image: https://developers.cloudflare.com/use-cases/solutions/encrypt-all-keep-site-secure/og.png?v=46949290e9a93ea3
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/use-cases/llms.txt
Use this file to discover all available pages before exploring further.
Docs