Skip to content

API Reference

CSD has a dedicated API at /api/shape/csd/ for managing domains, scripts, mitigation, and monitoring. CSD can also be enabled on HTTP Load Balancers via the load balancer configuration API.

All API calls require an API token. Generate one in the XC Console under Administration → Credentials → API Credentials.

Set up your environment variables as described in API Automation — Environment Setup:

Terminal window
set -a && source .env && set +a

All cURL examples use the xTOKENx placeholder format. Substitute with your environment variables or use the interactive form at the top of the page. For example, xXCSH_API_TOKENx corresponds to $XCSH_API_TOKEN.

Terminal window
-H "Authorization: APIToken xXCSH_API_TOKENx"
  • POST and PUT return the created or replaced resource when defined by the endpoint schema.
  • DELETE returns an object response; an empty \{\} on HTTP 200 is a normal success response for standard configuration deletes.

List endpoints (for example, /origin_pools) return an items collection. Individual GET endpoints (for example, /origin_pools/\{name\}) return the selected resource with its full configuration. Use the response shape documented for the exact endpoint rather than assuming list and individual responses are interchangeable.

A protected-domain object has two distinct identifiers:

  • metadata.name is the DNS-label resource name used by individual GET and DELETE paths. The reference deployment uses client-side-defense.
  • spec.protected_domain is the registrable domain monitored by CSD. The reference deployment uses f5-sales-demo.com, which covers client-side-defense.f5-sales-demo.com.

Do not place the FQDN in the path unless it is also the object’s actual metadata.name.

Base path: /api/shape/csd/namespaces/\{namespace\}/

OperationMethodPath
Enable CSDPOST/api/shape/csd/namespaces/system/init
Get StatusGET/api/shape/csd/namespaces/\{namespace\}/status
Get JS ConfigurationGET/api/shape/csd/namespaces/\{namespace\}/js_configuration
Test JSPOST/api/shape/csd/namespaces/\{namespace\}/testjs
Update DomainsPOST/api/shape/csd/namespaces/\{namespace\}/update_domains
Get SummaryGET/api/shape/csd/namespaces/\{namespace\}/summary
Bulk Delete DomainsDELETE/api/shape/csd/namespaces/\{namespace\}/domains
Create ReportPOST/api/shape/csd/namespaces/\{namespace\}/reports
List Report HistoryGET/api/shape/csd/namespaces/\{namespace\}/reports-history
Download ReportGET/api/shape/csd/namespaces/\{namespace\}/reports/metadata/\{job_id\}/download
OperationMethodPath
ListGET/api/shape/csd/namespaces/\{namespace\}/protected_domains
GetGET/api/shape/csd/namespaces/\{namespace\}/protected_domains/\{name\}
CreatePOST/api/shape/csd/namespaces/\{namespace\}/protected_domains
DeleteDELETE/api/shape/csd/namespaces/\{namespace\}/protected_domains/\{name\}
OperationMethodPath
List DetectedGET/api/shape/csd/namespaces/\{namespace\}/detected_domains
List Detected (POST)POST/api/shape/csd/namespaces/\{namespace\}/detectedDomains
Get DetailsGET/api/shape/csd/namespaces/\{namespace\}/domain_details
OperationMethodPath
ListGET/api/shape/csd/namespaces/\{namespace\}/allowed_domains
GetGET/api/shape/csd/namespaces/\{namespace\}/allowed_domains/\{name\}
CreatePOST/api/shape/csd/namespaces/\{namespace\}/allowed_domains
DeleteDELETE/api/shape/csd/namespaces/\{namespace\}/allowed_domains/\{name\}
OperationMethodPath
ListGET/api/shape/csd/namespaces/\{namespace\}/mitigated_domains
GetGET/api/shape/csd/namespaces/\{namespace\}/mitigated_domains/\{name\}
CreatePOST/api/shape/csd/namespaces/\{namespace\}/mitigated_domains
DeleteDELETE/api/shape/csd/namespaces/\{namespace\}/mitigated_domains/\{name\}
OperationMethodPath
List ScriptsPOST/api/shape/csd/namespaces/\{namespace\}/scripts
Get Scripts OverviewGET/api/shape/csd/namespaces/\{namespace\}/scripts/overview
List Scripts (GET)GET/api/shape/csd/namespaces/\{namespace\}/scripts
Get Script OverviewGET/api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/dashboard
List BehaviorsGET/api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/behaviors
List Network InteractionsGET/api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/networkInteractions
Update JustificationPOST/api/shape/csd/namespaces/\{namespace\}/scripts/\{script_id\}/justification
Delete JustificationDELETE/api/shape/csd/namespaces/\{namespace\}/script/justification/\{justification_id\}
Update Read StatusPOST/api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/readStatus
List Affected UsersPOST/api/shape/csd/namespaces/\{namespace\}/scripts/\{script_id\}/affectedUsers
Update Approval StatusPOST/api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/approval-status
List Inline ScriptsGET/api/shape/csd/namespaces/\{namespace\}/scripts/\{script_id\}/inline
OperationMethodPath
List Form FieldsGET/api/shape/csd/namespaces/\{namespace\}/formFields
List Form Fields (POST)POST/api/shape/csd/namespaces/\{namespace\}/formFields
Get Form FieldGET/api/shape/csd/namespaces/\{namespace\}/formFields/\{id\}
List by ScriptGET/api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/formFields
Update Field AnalysisPOST/api/shape/csd/namespaces/\{namespace\}/formFields/analysis

Initialize CSD for the tenant:

Terminal window
curl -s -X POST \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
-H "Content-Type: application/json" \
"xXCSH_API_URLx/api/shape/csd/namespaces/system/init"
Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/status" \
| jq .
Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/protected_domains" \
| jq .
Terminal window
curl -s -X POST \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
-H "Content-Type: application/json" \
-d '{
"metadata": {
"name": "client-side-defense",
"namespace": "xXCSH_NAMESPACEx"
},
"spec": {
"protected_domain": "f5-sales-demo.com"
}
}' \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/protected_domains" \
| jq .

Do not issue a standalone DELETE from this reference. Use the guarded Phase 4 API teardown, which:

  1. validates the session ledger against the normalized active XCSH_API_URL, tenant identity, namespace, and domain;
  2. derives the target only from the unique protected-domain entry marked created by the current session;
  3. requires explicit destructive approval before deletion; and
  4. deletes in reverse dependency order and verifies the exact protected domain returns 404.

A protected domain that is pre-existing, unknown, recorded by another session, or owned by Terraform is not a deletion target.

Query parameters: locations (filter by location), risk (filter by risk level).

Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/detected_domains" \
| jq .

Filter by high risk:

Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/detected_domains?risk=high" \
| jq .
Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/domain_details?name=suspicious.example.com" \
| jq .
Terminal window
curl -s -X POST \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
-H "Content-Type: application/json" \
-d '{}' \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/scripts" \
| jq .
Terminal window
SCRIPT_ID="your-script-id"
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/scripts/${SCRIPT_ID}/dashboard" \
| jq .
Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/scripts/${SCRIPT_ID}/behaviors" \
| jq .
Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/scripts/${SCRIPT_ID}/networkInteractions" \
| jq .
Terminal window
curl -sS -X POST \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
-H "Content-Type: application/json" \
-d '{
"metadata": {
"name": "suspicious-example-com",
"namespace": "xXCSH_NAMESPACEx"
},
"spec": {
"mitigated_domain": "suspicious.example.com"
}
}' \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/mitigated_domains" \
| jq .
Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/mitigated_domains" \
| jq .
Terminal window
curl -s -X DELETE \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/mitigated_domains/suspicious-example-com"
Terminal window
curl -sS -X POST \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
-H "Content-Type: application/json" \
-d '{
"metadata": {
"name": "cdn-example-com",
"namespace": "xXCSH_NAMESPACEx"
},
"spec": {
"allowed_domain": "cdn.example.com"
}
}' \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/allowed_domains" \
| jq .
Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/allowed_domains" \
| jq .
Terminal window
curl -s -X DELETE \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/allowed_domains/cdn-example-com"
Terminal window
curl -s \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/shape/csd/namespaces/xXCSH_NAMESPACEx/js_configuration" \
| jq .

CSD JavaScript injection can also be enabled directly on an HTTP Load Balancer via the configuration API at /api/config/namespaces/\{namespace\}/http_loadbalancers/\{name\}.

The reference architecture uses one unsuffixed load balancer named client-side-defense in namespace client-side-defense. It serves client-side-defense.f5-sales-demo.com with automatic HTTPS, HTTP-to-HTTPS redirect, a public default VIP, one origin-pool reference, and all-pages CSD insertion.

The AWS origin pool uses public_name.dns_name with the ALB hostname. The separate Azure alternate uses public_ip.ip.

The client_side_defense field within the load balancer spec controls injection:

{
"client_side_defense": {
"policy": {
"js_insert_all_pages": {}
}
}
}

The policy accepts one of:

FieldDescription
js_insert_all_pagesInject on all pages
js_insert_all_pages_exceptInject on all pages except exclusion rules
js_insertion_rulesInject only on pages matching rules
disable_js_insertDo not inject

To disable CSD on a load balancer, replace client_side_defense with disable_client_side_defense: \{\}.

Terminal window
curl -fsS \
-H "Authorization: APIToken xXCSH_API_TOKENx" \
"xXCSH_API_URLx/api/config/namespaces/xXCSH_NAMESPACEx/http_loadbalancers/xXCSH_LB_NAMEx" \
| jq -e '.spec.client_side_defense'

Use Phase 1 — Clean Load-Balancer PUT instead of issuing a standalone PUT from this reference. The guarded replacement:

  1. validates the ledger against the normalized active XCSH_API_URL, tenant identity, namespace, and domain;
  2. requires exactly one matching current-session http_loadbalancer entry with status: "created";
  3. builds a schema-valid replacement body containing only metadata and spec; and
  4. records the PUT outcome and verifies the settled configuration.

If the exact load balancer is not owned by the current API session, stop. Inspect Terraform-owned resources with GET and make their changes through Terraform state.

Domain and Path Matching for Exclusion Rules

Section titled “Domain and Path Matching for Exclusion Rules”

When using js_insert_all_pages_except or js_insertion_rules, each rule matches a domain and path combination.

Domain (choose one):

FieldExample
any_domain: \{\}All domains
domain.exact_value"app.example.com"
domain.suffix_value".example.com"
domain.regex_value".*\\.example\\.com"

Path (choose one):

FieldExample
path.path"/login"
path.prefix"/checkout"
path.regex"/user/[0-9]+"