{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/squirrelscan-com/json-schema/squirrelscan-com-create-audit-run-request-schema.json",
  "title": "CreateAuditRunRequest",
  "description": "The top-level fields are `url`, `trigger`, `mode`, `model`, `config`, `websiteId` and `auditId`. An API-key request carrying any other top-level field is a 400 `VALIDATION_ERROR` naming it (nothing is started or charged); it is never silently dropped.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/squirrelscan-com-openapi.json#/components/schemas/CreateAuditRunRequest",
  "type": "object",
  "required": [
    "url"
  ],
  "properties": {
    "url": {
      "type": "string",
      "format": "uri",
      "description": "Site URL to audit."
    },
    "trigger": {
      "type": "string",
      "enum": [
        "api"
      ],
      "default": "api",
      "description": "Run origin. Optional for an API key, which gets `api` (it dispatches the cloud crawler) whether it sends it or not. A signed-in session must send it: omitting it is a 400. (`cli`/`github`/`scheduled` are internal-origin values that skip cloud dispatch and are not accepted here.)"
    },
    "mode": {
      "allOf": [
        {
          "$ref": "#/$defs/AuditRunMode"
        }
      ],
      "default": "audit"
    },
    "model": {
      "type": "string"
    },
    "config": {
      "description": "Optional run config: an object (preferred) or the same object as a JSON-encoded string (the older form, still accepted). A string that is not valid JSON, a value that is not an object, a key outside `CreateAuditRunConfig`, or a wrongly typed or invalid value is a 400 `VALIDATION_ERROR` (nothing is started or charged); it is never silently ignored. The config a run reports back in `GET /v1/agent-runs/{id}` can be sent again: the keys the server writes into it (listed in `CreateAuditRunConfig`) are accepted and dropped, and the run's own values are used instead. A completed run's config can also hold keys written during the run (timings, billing, failure detail); those are not accepted.",
      "oneOf": [
        {
          "$ref": "#/$defs/CreateAuditRunConfig"
        },
        {
          "type": "string",
          "description": "The config object, JSON-encoded."
        }
      ]
    },
    "websiteId": {
      "type": "string"
    },
    "auditId": {
      "type": "string"
    }
  },
  "$defs": {
    "AuditRunMode": {
      "type": "string",
      "enum": [
        "audit",
        "audit-fix",
        "recommend"
      ]
    },
    "CreateAuditRunConfig": {
      "type": "object",
      "description": "The `config` of a create-run request. Unknown keys are refused. Also accepted and dropped, because the server writes them into a run's config and a caller may echo it back: `maxCredits`, `renderMode`, `maxDepth`, `respectRobots`, `pageLimitNotice`, `creditClamp`, `levelLimitNotice`, `auditLevel`, `ruleSelection`, `crawlScope`, `crawlPolicy`, `containerPlanId`, `containerClassName`, `dispatchSite`, `source`, `internal`.",
      "properties": {
        "coverageMode": {
          "type": "string",
          "enum": [
            "quick",
            "surface",
            "full"
          ],
          "description": "Crawl depth for this run (held to what the plan may crawl)."
        },
        "maxPages": {
          "type": "integer",
          "minimum": 1,
          "description": "Pages to audit. `1` audits just the entry URL. Above the plan ceiling the run is clamped and the response carries a `notice`."
        },
        "disabledRulePatterns": {
          "type": "array",
          "maxItems": 50,
          "items": {
            "type": "string",
            "maxLength": 100,
            "pattern": "^[A-Za-z0-9_./*-]+$"
          },
          "description": "Rules that do NOT run, added to the website's own disable list. The same patterns, matching, limits and errors as `enabledRulePatterns` (a category, a category glob or an exact rule id; an unknown category or a pattern that matches no rule is a 400 listing it in `error.patterns`). May be empty. **Disable wins:** a rule named here does not run even when `enabledRulePatterns` selects it, as in a lint config. Caution: `ai/*` is an alias of the whole `ax` category and switches off every `ax` rule; name the three legacy `ai/` rule ids exactly (`ai/llm-parsability`, `ai/page-type-match`, `ai/site-metadata`)."
        },
        "enabledRulePatterns": {
          "type": "array",
          "minItems": 1,
          "maxItems": 50,
          "items": {
            "type": "string",
            "maxLength": 100,
            "pattern": "^[A-Za-z0-9_./*-]+$"
          },
          "description": "Run ONLY the rules these patterns select (an include filter). A pattern is a category (`ax`), a category glob (`ax/*`) or an exact rule id (`core/robots-meta`): the same patterns, with the same meaning, as the CLI's `--rule-include` (list them with `GET /v1/rules`). At most 50 patterns of at most 100 characters; letters, digits and `-_./*` only (no commas, spaces, regular expressions or control characters). A pattern that matches no rule, an unknown category, or a selection that `disabledRulePatterns` (or the website's disable list) leaves with no rule is a 400 `VALIDATION_ERROR` whose `error.patterns` lists the offenders: it never starts an empty run. `ax` includes the three rules that kept the legacy `ai/` id prefix (`ai/llm-parsability`, `ai/page-type-match`, `ai/site-metadata`): they are the cloud-backed ones, slower and credit-metered, so a caller that wants the plain robots, llms.txt and agent-signal rules disables those three by exact id. Opt-in rules (`gaps/*`) are not selectable here. The report covers only the selected rules (`includeFilter` on `GET /v1/agent-runs/{id}/report` says so); its overall score is not comparable to a full audit's. Price is unchanged."
        },
        "externalLinksEnabled": {
          "type": "boolean",
          "description": "Check external links for this run (each distinct link the cloud verifies costs 1 credit). Overrides the website's setting; a run with no website follows the default, which is on."
        },
        "render": {
          "type": "boolean",
          "description": "Browser-render the pages the crawl fetches. `false` fetches every page over plain HTTP, with no per-page headless browser; `true` renders every page, held to what the plan may render. Omit it to follow the website's setting (a run with no website renders). Same meaning as `render` on the MCP `run_audit`. Price is unchanged."
        },
        "ephemeral": {
          "type": "boolean",
          "description": "One-shot check, with the exact semantics of `ephemeral` on the MCP `run_audit`: when the run creates the website, that website is exempt from the plan's website cap, is hidden from website listings, and is ARCHIVED automatically once the run finishes. The RUN and its report are NOT purged (a purge is planned, not shipped): `GET /v1/agent-runs/{id}` and `/report` keep working and the run stays in `GET /v1/agent-runs`. At most 5 one-shot websites may be live per organization (429 `EPHEMERAL_LIMIT`), and the credit check happens before the hidden website is created. Ignored when the organization already tracks the domain, or `websiteId` is sent (the run goes against that website, nothing is deleted); the response then carries `ephemeral: false` and an `ephemeralIgnoredReason`. Cannot be combined with `auditId`."
        },
        "editorSummary": {
          "type": "boolean",
          "description": "Build the editor's summary, an LLM-written overview of the whole report that adds about 30 seconds to a run. Omit it for the default: skipped on a run with `enabledRulePatterns` (a filtered run), built on every other run. `true` builds it on a filtered run; `false` skips it on any run. A skipped summary is absent from the report (`editorSummary` is not set) and the run timeline records the step as skipped. Has no effect on price: the summary carries no credit charge, built or skipped."
        }
      }
    }
  }
}