CentralCSP
APIScans

Analyze a policy value

Reviews a Content-Security-Policy header value and reports what each directive does and where the policy is weak, such as an unsafe keyword or an overly broad source. Nothing is fetched or saved, so use it for a policy you are drafting. To grade the policy a site serves, run a scan instead.

Limited to 30 requests a minute for each person, after which it answers 429 with a Retry-After header.

Requires membership of the workspace.

POST
/v1/workspaces/{workspaceId}/csp/analyze

Authorization

headerAuthorizationBearer <JWT>

An OpenID Connect access token from signing in to CentralCSP, acting as the signed-in user.

Path Parameters

workspaceId*string

The workspace's id.

Request Body

application/json
  1. body
csp*string

The Content-Security-Policy header value to review.

Length1 <= length <= 65536
language?string

Language the findings are written in. en is English and fr is French.

Default"en"
Value in"en""fr"

Response Body

The policy analysis.

application/json
  1. response
[key: string]?any
Example Request
curl -X POST 'https://api.centralcsp.com/v1/workspaces/01936b7a-6f2e-7c31-9a4d-2f8e1c5b7d90/csp/analyze' \  -H 'Content-Type: application/json' \  -d '{  "csp": "default-src '\''self'\''; script-src '\''self'\'' '\''report-sample'\'' https://js.stripe.com"}'
Example Response
{}