Common API calls (3)
Last updated May 5, 2026 The following sections contain example requests for common API calls. For a list of available API endpoints, refer to Endpoints.
Get Advanced TCP Protection status
This example obtains the current status of Advanced TCP Protection (enabled or disabled).
Requestbash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/tcp_protection_status \
--header "Authorization: Bearer <API_TOKEN>"
Example responsejson
{
"result": {
"enabled": false
},
"success": true,
"errors": [],
"messages": []
}
Enable Advanced TCP Protection
This example enables Advanced TCP Protection.
Requestbash
curl --request PATCH \
https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/tcp_protection_status \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"enabled": true
}'
Get existing prefixes
This example fetches all existing prefixes in Advanced TCP Protection.
Requestbash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/prefixes \
--header "Authorization: Bearer <API_TOKEN>"
{
"result": [
{
"prefix": "203.0.113/24",
"comment": "My prefix",
"excluded": false
}
],
"success": true,
"errors": [],
"messages": []
}
Add prefixes
This example POST request adds two prefixes. The second prefix excludes a subset of the first prefix from Advanced TCP Protection.
Requestbash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/prefixes/bulk \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '[
{
"prefix": "192.0.2.0/24",
"comment": "Game ranges",
"excluded": false
},
{
"prefix": "192.0.2.2/26",
"comment": "Range for a specific game",
"excluded": true
}
]'
{
"result": [
{
"id": "<PREFIX_1_ID>",
"prefix": "192.0.2.0/24",
"excluded": false,
"comment": "Game ranges",
"created_on": "<TIMESTAMP>",
"modified_on": "<TIMESTAMP>"
},
{
"id": "<PREFIX_2_ID>",
"prefix": "192.0.2.2/26",
"excluded": true,
"comment": "Range for a specific game",
"created_on": "<TIMESTAMP>",
"modified_on": "<TIMESTAMP>"
}
],
"success": true,
"errors": [],
"messages": []
}
Get all prefixes in allowlist
This example fetches all the prefixes in the allowlist.
Requestbash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/allowlist \
--header "Authorization: Bearer <API_TOKEN>"
{
"result": [
{
"id": "<ALLOWLIST_PREFIX_ID>",
"prefix": "192.0.2.127",
"comment": "Single IP address in allowlist",
"enabled": true,
"created_on": "<TIMESTAMP>",
"modified_on": "<TIMESTAMP>"
}
],
"success": true,
"errors": [],
"messages": []
}
Add a prefix to the allowlist
This example POST request adds a prefix to the allowlist of the account.
Requestbash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/allowlist \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"prefix": "203.0.113.0/26",
"comment": "Partner range",
"enabled": true
}'
{
"result": {
"id": "<ALLOWLIST_PREFIX_1_ID>",
"prefix": "203.0.113.0/26",
"comment": "Partner range",
"enabled": true,
"created_on": "<TIMESTAMP>",
"modified_on": "<TIMESTAMP>"
},
"success": true,
"errors": [],
"messages": []
}
Create a SYN flood rule
This example POST request creates a SYN flood rule with a regional scope (Western Europe) in monitoring mode.
Requestbash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"scope": "region",
"name": "WEUR",
"mode": "monitoring",
"rate_sensitivity": "medium",
"burst_sensitivity": "medium"
}'
{
"result": {
"id": "<SYN_FLOOD_RULE_ID>",
"scope": "region",
"name": "WEUR",
"mode": "monitoring",
"rate_sensitivity": "medium",
"burst_sensitivity": "medium",
"created_on": "<TIMESTAMP>",
"modified_on": "<TIMESTAMP>"
},
"success": true,
"errors": [],
"messages": []
}
Refer to JSON objects for more information on the fields in the JSON body.
Create an out-of-state TCP rule
This example POST request creates an out-of-state TCP rule in monitoring mode, with a regional scope, and with low rate and burst sensitivities.
Requestbash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"scope": "region",
"name": "WEUR",
"mode": "monitoring",
"rate_sensitivity": "low",
"burst_sensitivity": "low"
}'
{
"result": {
"id": "<OOS_TCP_RULE_ID>",
"scope": "region",
"name": "WEUR",
"mode": "monitoring",
"rate_sensitivity": "low",
"burst_sensitivity": "low",
"created_on": "<TIMESTAMP>",
"modified_on": "<TIMESTAMP>"
},
"success": true,
"errors": [],
"messages": []
}
Refer to JSON objects for more information on the fields in the JSON body.
Create a SYN flood filter
This example POST request creates a SYN flood filter, setting SYN flood protection to monitoring mode for a specific range of destination IP addresses.
Requestbash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"expression": "ip.dst in { 192.0.2.0/24 }",
"mode": "monitoring"
}'
{
"result": {
"id": "<SYN_FLOOD_FILTER_ID>",
"expression": "ip.dst in { 192.0.2.0/24 }",
"mode": "monitoring",
"created_on": "<TIMESTAMP>",
"modified_on": "<TIMESTAMP>"
},
"success": true,
"errors": [],
"messages": []
}
Refer to JSON objects for more information on the fields in the JSON body.
Create an out-of-state TCP filter
This example POST request creates an out-of-state TCP filter, disabling out-of-state TCP protection for a specific range of destination IP addresses and ports.
Requestbash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"expression": "ip.dst in { 203.0.113.0/24 } and tcp.dstport in { 8000..8081 }",
"mode": "disabled"
}'
{
"result": {
"id": "<OOS_TCP_FILTER_ID>",
"expression": "ip.dst in { 203.0.113.0/24 } and tcp.dstport in { 8000..8081 }",
"mode": "disabled",
"created_on": "<TIMESTAMP>",
"modified_on": "<TIMESTAMP>"
},
"success": true,
"errors": [],
"messages": []
}
Refer to JSON objects for more information on the fields in the JSON body.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ddos-protection/advanced-ddos-systems/api/tcp-protection/examples/#page","headline":"Common API calls","description":"Example API requests for managing Advanced TCP Protection prefixes, allowlists, and rules.","url":"https://developers.cloudflare.com/ddos-protection/advanced-ddos-systems/api/tcp-protection/examples/","inLanguage":"en","image":"https://developers.cloudflare.com/ddos-protection/advanced-ddos-systems/api/tcp-protection/examples/og.png?v=ed25b9329656ba65","dateModified":"2026-05-05","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"]}
description: JSON object structure for Advanced TCP Protection API requests and responses. title: JSON objects image: https://developers.cloudflare.com/ddos-protection/advanced-ddos-systems/api/tcp-protection/json-objects/og.png?v=ac75d61b21367c40
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/ddos-protection/llms.txt
Use this file to discover all available pages before exploring further.
Docs