APIConfiguration API

Configuration API

Three endpoints are available under /api/configuration/. They manage compilation configuration defaults, validation, and layer resolution.

Configuration API

Three endpoints are available under /api/configuration/. They manage compilation configuration defaults, validation, and layer resolution.


GET /api/configuration/defaults

Returns the system defaults and hard limits for all compilations. No authentication required (anonymous tier).

Request

GET /api/configuration/defaults

Response

{
  "success": true,
  "defaults": {
    "compilation": { ... },
    "validation": { ... }
  },
  "limits": {
    "maxSources": 20,
    "maxExclusions": 1000
  },
  "supportedSourceTypes": ["adblock", "hosts"]
}
StatusMeaning
200Defaults returned successfully
429Rate limit exceeded (anonymous tier)

POST /api/configuration/validate

Validates a configuration object against the Zod ConfigurationSchema. Requires a Cloudflare Turnstile token when TURNSTILE_SECRET_KEY is configured.

Request

POST /api/configuration/validate
Content-Type: application/json

{
  "configuration": {
    "name": "My Filter List",
    "sources": [
      { "source": "https://example.com/filters.txt" }
    ]
  },
  "turnstileToken": "<optional-turnstile-token>"
}

Response — valid config

{
  "success": true,
  "valid": true,
  "configuration": { ... }
}

Response — invalid config

{
  "success": false,
  "valid": false,
  "errors": [
    { "path": "sources.0.source", "message": "Invalid URL" }
  ]
}
StatusMeaning
200Validation complete (check valid field)
400Malformed request body
403Turnstile verification failed
429Rate limit exceeded

POST /api/configuration/resolve

Merges one or more configuration layers and returns the effective IConfiguration. Useful for previewing the result of a config + environment overlay before submitting a compile job.

Request

POST /api/configuration/resolve
Content-Type: application/json

{
  "config": {
    "name": "Base Config",
    "sources": [
      { "source": "https://example.com/filters.txt" }
    ]
  },
  "override": {
    "transformations": ["Deduplicate", "RemoveEmptyLines"]
  },
  "applyEnvOverrides": true,
  "turnstileToken": "<optional-turnstile-token>"
}

Response

{
  "success": true,
  "resolved": {
    "name": "Base Config",
    "sources": [...],
    "transformations": ["Deduplicate", "RemoveEmptyLines"],
    ...
  }
}
StatusMeaning
200Resolved configuration returned
400Malformed or invalid configuration
403Turnstile verification failed
429Rate limit exceeded