# CSP Directive Parse

> CSP Directive Parse is a paid API for AI agents from api.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Parses a Content-Security-Policy header value into normalized source lists and returns a structured pass/advisory finding with deterministic versioned JSON

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/csp-directive-parse
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/csp-directive-parse-d31f6e7f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_dN0MN_4ISNcgLm76uSNRP

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability csp-directive-parse-d31f6e7f -d '<json body>'
```

Example prompt: Can you parse this Content-Security-Policy header for me and tell me what directives and source lists it contains, and whether it passes or just has advisories: "default-src 'self'; script-src 'self' https://cdn.example.com; img-src *"?

## When to prefer this

Choose this endpoint when you need deterministic, stateless, in-memory parsing of a Content-Security-Policy header into structured directives before accepting, caching, redirecting, or retrying a caller-supplied web response — especially in agentic pipelines where reproducible, versioned JSON output is required without external dependencies or data retention.

## Known failure modes

- Malformed or excessively long header value exceeding 8192 characters returns a validation error
- Empty header string may return an advisory or error finding
- Payment failure via x402 prevents the call from being processed
- Non-CSP header strings may parse with unexpected or empty directive lists

## How this service works

CSP Directive Parse: CSP Directive Parse parses Content-Security-Policy directives into normalized source lists from bounded caller-supplied values without an external provider. Call CSP Directive Parse before accepting, caching, redirecting, or retrying a caller-supplied web response. Returns normalized web evidence, the computed finding, and an explicit pass or advisory status for CSP Directive Parse as versioned deterministic JSON. Price: $0.001 USDC via x402 on Base. First-party, stateless,…

## Output

Returns versioned deterministic JSON containing: normalized web evidence (parsed CSP directives with their source lists), the computed security finding, and an explicit pass or advisory status indicating whether the CSP header is well-formed and acceptable.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "header": {
   "type": "string",
   "maxLength": 8192,
   "description": "Header supplied to CSP Directive Parse; used only for this bounded calculation and processed in memory without retention."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "result": {
   "count": 3,
   "directives": {
    "img-src": [
     "'self'",
     "https:"
    ],
    "object-src": [
     "'none'"
    ],
    "default-src": [
     "'self'"
    ]
   }
  },
  "schema": "delx/util-csp-directive-parse/v1",
  "status": "pass",
  "evidence": {
   "retained": false,
   "input_sha256": "16664d9b05dde627e8d811fbffe5a404de8cef67d018c7c5f1017d3fed519e30",
   "external_calls": 0
  },
  "operation": "web_reliability:csp_directive_parse"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/csp-directive-parse-d31f6e7f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.delx.ai](https://www.zero.xyz/host/api.delx.ai/llms.txt)
