Client-Side Protection

Client-Side Protection (CSP) provides visibility and control over third-party scripts running on your web pages. Monitor script behavior, manage authorization status, and configure security policies to protect against client-side attacks like Magecart and formjacking.

NOTE: The Client-Side Protection API is available to customers with the Client-Side Protection product enabled. Contact your Fastly account team for access.

Data model

namestringCSP directive name (e.g., script-src, style-src).
valuesarrayDirective values.
configobjectType-specific configuration.
typestringNotification type.
descriptionstringPage description.
idstringUnique page identifier.
notificationsarrayNotification configurations for this page.
pathsarrayURL paths to monitor.
website_idstringParent website ID.
directivesarray
authorization_statusstringScript authorization status.
authorized_hashstringHash of authorized script content.
current_hashstringCurrent script content hash.
justificationstringReason for authorization decision.
page_idstringParent page ID.
sourcestringScript source (inline or external URL).
urlsarrayURLs where this script was observed.
domainstringWebsite domain.
page_idsarrayIDs of pages associated with this website.

Endpoints

List websites

GET/client-side-protection/v1/websites

Create website

POST/client-side-protection/v1/websites

Get website

GET/client-side-protection/v1/websites/website_id

Delete website

DELETE/client-side-protection/v1/websites/website_id

Update website

PATCH/client-side-protection/v1/websites/website_id

List pages

GET/client-side-protection/v1/pages

Create page

POST/client-side-protection/v1/pages

Get page

GET/client-side-protection/v1/pages/page_id

Delete page

DELETE/client-side-protection/v1/pages/page_id

Update page

PATCH/client-side-protection/v1/pages/page_id

List scripts

GET/client-side-protection/v1/pages/page_id/scripts

Get script

GET/client-side-protection/v1/pages/page_id/scripts/script_id

Update script

PATCH/client-side-protection/v1/pages/page_id/scripts/script_id

List policies

GET/client-side-protection/v1/pages/page_id/policies

Create policy

POST/client-side-protection/v1/pages/page_id/policies

Get policy

GET/client-side-protection/v1/pages/page_id/policies/policy_id

Update policy

PATCH/client-side-protection/v1/pages/page_id/policies/policy_id

List policy reports

GET/client-side-protection/v1/pages/page_id/policies/policy_id/reports

List security headers

GET/client-side-protection/v1/pages/page_id/headers

List header events

GET/client-side-protection/v1/pages/page_id/events