{"openapi":"3.1.0","info":{"title":"SecureSpells Partner API","description":"## Introduction\n\nThe **SecureSpells Partner API** lets agencies, consultancies, and platforms automate **runtime privacy & compliance audits** of customer websites. Audits use **headless browser execution** (consent simulations, network interception, tracker evidence) — not static HTML keyword scans — so you can offer legal-grade artifacts and recurring monitoring to your clients.\n\n## Authentication\n\nSend exactly one partner credential per request:\n\n- **`X-API-Key`** — Preferred for server-to-server integrations.\n- **Public keys** (`spk_test_*`, `spk_live_*`) identify the integration and may be scope-limited; they are safe to embed in backends only (never in mobile or browser clients).\n- **Secret keys** (`ssk_test_*`, `ssk_live_*`) authenticate as the partner and carry your full API privileges for the matching environment. **Store secrets in a vault; rotate if leaked.**\n\nSession cookie authentication is supported for dashboard tooling but **machine integrations should use `X-API-Key` with a secret key.**\n\n## Environments\n\n| Environment | Keys | Credits |\n|-------------|------|---------|\n| **`test`** | `*_test_*` keys (or session test flows) | **Does not consume** prepaid partner credits; uses the provisioned sandbox domain slot. |\n| **`live`** | `*_live_*` keys | **Consumes credits** and allocates **30-day domain slots** for production client domains. |\n\nThe **`environment`** field on `POST /audits` must match the key’s environment when a key is present, or the API returns `400`.\n\n## Webhooks\n\nAudits are **asynchronous**. A successful `POST /audits` returns **`202 Accepted`** with a `job_id`. Your worker processes the site; you should **not rely on synchronous HTTP** for the final report.\n\n- Register **test** and **live** HTTPS endpoints; configure the `callback_url` on the audit request (and/or your default webhook) to receive signed **`audit.*` events** (`audit.created`, `audit.started`, `audit.completed`, `audit.failed`).\n- Poll **`GET /audits/{job_id}`** or **`GET /audits/{job_id}/results`** only as a backstop; webhooks are the primary completion channel.\n\n## Rate limiting & domain slots\n\n- **Standard rate limits** apply on partner endpoints (especially read-heavy routes) to protect platform stability. Excessive traffic returns **HTTP 429**.\n- **30-day domain slot**: one credit typically monitors **one client domain** for **30 days** on the live path; rescan and cooldown rules depend on your **base subscription** tier.\n- **Rescan cooldown**: `POST /domains/{domain_slot_id}/rescan` may return **429** with `next_rescan_available_at` until the cooldown window elapses.\n\nFor human workflows (billing, key management), use the **Partner Dashboard** — those routes are omitted from this document.","version":"1.0.0"},"paths":{"/api/v1/partner/audits":{"post":{"tags":["Partner"],"summary":"Submit a new audit","description":"**Primary integration entry-point** — queue a headless compliance audit for a customer URL.\n\nLive submissions require an **active partner**, billable **credits**, and (per product policy) a configured **live webhook**;\ntest submissions use the sandbox slot and never burn credits. Environment on the key and body must align or the API rejects fast with `400`.\n\nIdempotent replays may be requested with `Idempotency-Key` when enabled for your account.","operationId":"submit_partner_audit_api_v1_partner_audits_post","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerSubmitAuditRequest"}}}},"responses":{"202":{"description":"Asynchronous accept payload — includes `job_id`, `domain_slot_id`, and a relative `results_url`. Processing finishes out-of-band; subscribe to webhooks or poll `GET /audits/{job_id}/results`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerSubmitAuditResponse"}}}},"400":{"description":"Bad request — invalid URL, environment mismatch between key and body, missing business prerequisite (for example credits or agency setup), or malformed JSON."},"401":{"description":"Unauthorized — missing or invalid credentials. Send a valid partner secret key (`ssk_test_*` / `ssk_live_*`) in the `X-API-Key` header, or authenticate via session cookie for dashboard integrations."},"403":{"description":"Partner not active, API key missing `audit:submit` scope, live prerequisites (credits, webhook) not met, or sandbox provisioning incomplete."},"422":{"description":"Validation error — request body or query parameters failed schema validation (see response body for field-level errors)."},"429":{"description":"Too many requests — partner rate limit on read-heavy endpoints, or rescan / domain cooldown is still active (retry after `next_rescan_available_at` when provided)."},"500":{"description":"Internal provisioning error (for example sandbox slot missing) — retry after support."},"503":{"description":"Service unavailable — scan dispatch (queueing) temporarily failed. No credit was charged for this attempt (or any prior deduction was refunded). Retry the request."}}}},"/api/v1/partner/audits/{job_id}":{"get":{"tags":["Partner"],"summary":"Get audit status","description":"**Polling helper** — returns processing stage for a previously accepted `job_id`.\n\nSandbox jobs resolve quickly to `PENDING`/`COMPLETED`, while live jobs mirror worker states (`QUEUED`, `PROCESSING`, …).\nPrefer webhooks for production orchestration; use this route for backfill UI or recovery tooling.","operationId":"get_partner_audit_status_api_v1_partner_audits__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Condensed state machine view — URL, submitted/completed timestamps, relative `results_url`, and a coarse `status` token suitable for dashboards.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerAuditStatusResponse"}}}},"400":{"description":"Bad request — invalid URL, environment mismatch between key and body, missing business prerequisite (for example credits or agency setup), or malformed JSON."},"401":{"description":"Unauthorized — missing or invalid credentials. Send a valid partner secret key (`ssk_test_*` / `ssk_live_*`) in the `X-API-Key` header, or authenticate via session cookie for dashboard integrations."},"403":{"description":"Forbidden — partner account not active, API key lacks required scope, environment mismatch for this audit, or export feature not enabled on the base plan."},"422":{"description":"Validation error — request body or query parameters failed schema validation (see response body for field-level errors)."},"429":{"description":"Too many requests — partner rate limit on read-heavy endpoints, or rescan / domain cooldown is still active (retry after `next_rescan_available_at` when provided)."},"404":{"description":"Not found — unknown job id, domain slot id, or resource not visible to this partner."}}}},"/api/v1/partner/audits/{job_id}/events":{"get":{"tags":["Partner"],"summary":"List webhook events for an audit","description":"**Operations & support** — inspect every webhook emission we attempted for a given audit.\n\nUseful when reconciling client dashboards against SecureSpells delivery logs or proving SLA compliance.\nRequires the same environment-scoped credential used to submit the audit.","operationId":"get_partner_audit_events_api_v1_partner_audits__job_id__events_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Chronological `PartnerWebhookEvent` rows for the audit — shows delivery state per webhook event (`pending`, `delivered`, `failed`) for debugging or support replay.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerAuditEventsResponse"}}}},"400":{"description":"Bad request — invalid URL, environment mismatch between key and body, missing business prerequisite (for example credits or agency setup), or malformed JSON."},"401":{"description":"Unauthorized — missing or invalid credentials. Send a valid partner secret key (`ssk_test_*` / `ssk_live_*`) in the `X-API-Key` header, or authenticate via session cookie for dashboard integrations."},"403":{"description":"Forbidden — partner account not active, API key lacks required scope, environment mismatch for this audit, or export feature not enabled on the base plan."},"422":{"description":"Validation error — request body or query parameters failed schema validation (see response body for field-level errors)."},"429":{"description":"Too many requests — partner rate limit on read-heavy endpoints, or rescan / domain cooldown is still active (retry after `next_rescan_available_at` when provided)."},"404":{"description":"Not found — unknown job id, domain slot id, or resource not visible to this partner."}}}},"/api/v1/partner/audits/{job_id}/results":{"get":{"tags":["Partner"],"summary":"Get audit results JSON","description":"**Payload retrieval** — download the full runtime report once workers persist results.\n\nReturns **`202 Accepted`** with a concise message while the audit is still running — treat it as a signal to backoff or rely on your webhook consumer.\nSandbox jobs return a deterministic demo dataset suitable for integration tests.","operationId":"get_partner_audit_results_api_v1_partner_audits__job_id__results_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Structured compliance report JSON (`report` root) when processing is complete; includes legal disclaimers and optional white-label branding flags per plan.","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid URL, environment mismatch between key and body, missing business prerequisite (for example credits or agency setup), or malformed JSON."},"401":{"description":"Unauthorized — missing or invalid credentials. Send a valid partner secret key (`ssk_test_*` / `ssk_live_*`) in the `X-API-Key` header, or authenticate via session cookie for dashboard integrations."},"403":{"description":"Forbidden — partner account not active, API key lacks required scope, environment mismatch for this audit, or export feature not enabled on the base plan."},"422":{"description":"Validation error — request body or query parameters failed schema validation (see response body for field-level errors)."},"429":{"description":"Too many requests — partner rate limit on read-heavy endpoints, or rescan / domain cooldown is still active (retry after `next_rescan_available_at` when provided)."},"404":{"description":"Not found — unknown job id, domain slot id, or resource not visible to this partner."},"202":{"description":"Accepted — audit is still running or the result payload is not persisted yet. Poll this endpoint or wait for the webhook delivery on `callback_url`."}}}},"/api/v1/partner/audits/{audit_id}/export/html":{"get":{"tags":["Partner"],"summary":"Download standalone HTML report","description":"**White-label experience** — streams a self-contained HTML bundle with the hydrated report for embedding in your CRM or client portal.\n\nProvide `rescan_url` when you want the template’s call-to-action to deep-link into your own automation.\nRequires the same environment key used for the originating audit.","operationId":"get_partner_audit_export_html_api_v1_partner_audits__audit_id__export_html_get","parameters":[{"name":"audit_id","in":"path","required":true,"schema":{"type":"string","title":"Audit Id"}},{"name":"rescan_url","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Partner URL for rescan (injected into actions.rescan_url)","title":"Rescan Url"},"description":"Partner URL for rescan (injected into actions.rescan_url)"}],"responses":{"200":{"description":"`text/html` document embedding the JSON report for client iframe / portal hosting. Contains optional `actions.pdf_download_url` (signed) and injected `rescan_url` query passthrough.","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid URL, environment mismatch between key and body, missing business prerequisite (for example credits or agency setup), or malformed JSON."},"401":{"description":"Unauthorized — missing or invalid credentials. Send a valid partner secret key (`ssk_test_*` / `ssk_live_*`) in the `X-API-Key` header, or authenticate via session cookie for dashboard integrations."},"403":{"description":"Forbidden — partner account not active, API key lacks required scope, environment mismatch for this audit, or export feature not enabled on the base plan."},"422":{"description":"Validation error — request body or query parameters failed schema validation (see response body for field-level errors)."},"429":{"description":"Too many requests — partner rate limit on read-heavy endpoints, or rescan / domain cooldown is still active (retry after `next_rescan_available_at` when provided)."},"404":{"description":"Not found — unknown job id, domain slot id, or resource not visible to this partner."},"202":{"description":"Accepted — audit is still running or the result payload is not persisted yet. Poll this endpoint or wait for the webhook delivery on `callback_url`."},"503":{"description":"Service unavailable — report HTML template or export subsystem temporarily unavailable."}}}},"/api/v1/partner/audits/{audit_id}/pdf":{"post":{"tags":["Partner"],"summary":"Generate one-time PDF download","description":"**Branded deliverable** — materializes a print-ready PDF and stages it behind a signed download URL.\n\nSandbox audits always succeed with co-branded demo output. Live audits always get at least a\nSecureSpells-branded PDF (credits are pre-funded); white-label needs the agency plan's\n`pdf_whitelabel` feature plus a brand name and logo.\nRate limits apply — bursts should be smoothed or scheduled.","operationId":"post_partner_audit_pdf_api_v1_partner_audits__audit_id__pdf_post","parameters":[{"name":"audit_id","in":"path","required":true,"schema":{"type":"string","title":"Audit Id"}}],"responses":{"200":{"description":"JSON containing `download_url` (short-lived, single-use) and `expires_in_seconds` (900). Redirect the end customer’s browser to `download_url` or proxy the bytes from your edge.","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid URL, environment mismatch between key and body, missing business prerequisite (for example credits or agency setup), or malformed JSON."},"401":{"description":"Unauthorized — missing or invalid credentials. Send a valid partner secret key (`ssk_test_*` / `ssk_live_*`) in the `X-API-Key` header, or authenticate via session cookie for dashboard integrations."},"403":{"description":"`ENVIRONMENT_MISMATCH`: the API key's environment (test/live) does not match the audit's. Live audits never 403 for plan reasons: Partner API credits always include at least a SecureSpells-branded PDF."},"422":{"description":"Validation error — request body or query parameters failed schema validation (see response body for field-level errors)."},"429":{"description":"Too many requests — partner rate limit on read-heavy endpoints, or rescan / domain cooldown is still active (retry after `next_rescan_available_at` when provided)."},"404":{"description":"Not found — unknown job id, domain slot id, or resource not visible to this partner."},"202":{"description":"Accepted — audit is still running or the result payload is not persisted yet. Poll this endpoint or wait for the webhook delivery on `callback_url`."}}}},"/api/v1/partner/domains":{"get":{"tags":["Partner"],"summary":"List domain slots","description":"**Portfolio view** — enumerate every domain slot your integration currently owns (live + sandbox).\n\nUse this to drive billing reconciliation UI, monitoring dashboards, or to discover `domain_slot_id` values for rescans.\nEmpty result sets simply mean no agency linkage yet — not an error.\n\n**API key:** Same context as ``GET /partner/domains/{domain_slot_id}/audits`` — ``partner_api_key`` is\nthe resolved ``PartnerApiKey`` row when ``X-API-Key`` was used, else ``None`` (dashboard session).\nWhen a key is present, ``latest_job_id`` is derived from usage rows **filtered to that key's environment**\n(test vs live), for every slot on the page.","operationId":"list_partner_domains_api_v1_partner_domains_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}],"description":"Domain contains this text (case-insensitive).","title":"Q"},"description":"Domain contains this text (case-insensitive)."},{"name":"environment","in":"query","required":false,"schema":{"anyOf":[{"enum":["test","live"],"type":"string"},{"type":"null"}],"description":"`live` (addon_partner) or `test` (partner_sandbox).","title":"Environment"},"description":"`live` (addon_partner) or `test` (partner_sandbox)."},{"name":"risk_level","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"enum":["Clean","Minor","Moderate","Elevated","Severe"],"type":"string"}},{"type":"null"}],"description":"Repeatable. Overall risk band of the slot.","title":"Risk Level"},"description":"Repeatable. Overall risk band of the slot."},{"name":"expiry","in":"query","required":false,"schema":{"anyOf":[{"enum":["active","expiring_soon","expired"],"type":"string"},{"type":"null"}],"description":"`expired` = the row's `is_expired`; `expiring_soon` = window ends within the next 3 UTC calendar days; `active` = the rest of the live slots. Sandbox slots match none.","title":"Expiry"},"description":"`expired` = the row's `is_expired`; `expiring_soon` = window ends within the next 3 UTC calendar days; `active` = the rest of the live slots. Sandbox slots match none."},{"name":"metadata_key","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"description":"With `metadata_value`.","title":"Metadata Key"},"description":"With `metadata_value`."},{"name":"metadata_value","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}],"description":"Exact match on the `metadata` you sent with any audit of the slot.","title":"Metadata Value"},"description":"Exact match on the `metadata` you sent with any audit of the slot."},{"name":"sort","in":"query","required":false,"schema":{"enum":["created","domain","risk","expires"],"type":"string","default":"created","title":"Sort"}},{"name":"order","in":"query","required":false,"schema":{"anyOf":[{"enum":["asc","desc"],"type":"string"},{"type":"null"}],"description":"Default `desc` for `created`, `asc` for the other sorts.","title":"Order"},"description":"Default `desc` for `created`, `asc` for the other sorts."}],"responses":{"200":{"description":"Paged `addon_partner` and `partner_sandbox` slots with latest risk snapshot, billing window metadata, and `next_rescan_available_at` hints aligned with rescan cooldown rules.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerDomainsListResponse"}}}},"400":{"description":"Bad request — invalid URL, environment mismatch between key and body, missing business prerequisite (for example credits or agency setup), or malformed JSON."},"401":{"description":"Unauthorized — missing or invalid credentials. Send a valid partner secret key (`ssk_test_*` / `ssk_live_*`) in the `X-API-Key` header, or authenticate via session cookie for dashboard integrations."},"403":{"description":"Forbidden — partner account not active, API key lacks required scope, environment mismatch for this audit, or export feature not enabled on the base plan."},"422":{"description":"Validation error — request body or query parameters failed schema validation (see response body for field-level errors)."},"429":{"description":"Too many requests — partner rate limit on read-heavy endpoints, or rescan / domain cooldown is still active (retry after `next_rescan_available_at` when provided)."}}}},"/api/v1/partner/domains/{domain_slot_id}/rescan":{"post":{"tags":["Partner"],"summary":"Rescan an existing domain slot","description":"**Slot-level automation** — trigger a fresh audit on an *existing* monitored domain without buying a new credit.\n\nCooldown rules differ: sandbox uses a short fixed window; live uses the base plan’s `rescan_cooldown_seconds` fixed when the slot was created, for the slot’s 30-day life.\nAttempts while another scan is `PENDING`/`PROCESSING` return **409 Conflict**; expired slots return **410 Gone**.","operationId":"rescan_partner_domain_api_v1_partner_domains__domain_slot_id__rescan_post","parameters":[{"name":"domain_slot_id","in":"path","required":true,"schema":{"type":"string","title":"Domain Slot Id"}}],"responses":{"200":{"description":"`PartnerSubmitAuditResponse` — new `job_id`, relative `results_url`, and `next_rescan_available_at` reflecting the cooldown window. No additional credit is debited for qualifying rescans.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerSubmitAuditResponse"}}}},"400":{"description":"Slot missing a bound domain, wrong allocation type, or URL could not be derived for rescan."},"401":{"description":"Unauthorized — missing or invalid credentials. Send a valid partner secret key (`ssk_test_*` / `ssk_live_*`) in the `X-API-Key` header, or authenticate via session cookie for dashboard integrations."},"403":{"description":"Forbidden — partner account not active, API key lacks required scope, environment mismatch for this audit, or export feature not enabled on the base plan."},"422":{"description":"Validation error — request body or query parameters failed schema validation (see response body for field-level errors)."},"429":{"description":"Too many requests — partner rate limit on read-heavy endpoints, or rescan / domain cooldown is still active (retry after `next_rescan_available_at` when provided)."},"404":{"description":"Not found — unknown job id, domain slot id, or resource not visible to this partner."},"410":{"description":"Gone — domain slot archived or 30-day billing window expired for this allocation."},"409":{"description":"Conflict — a scan is already running for this domain slot; wait for completion."},"503":{"description":"Service unavailable — scan dispatch (queueing) temporarily failed. No credit was charged for this attempt (or any prior deduction was refunded). Retry the request."}}}},"/api/v1/partner/domains/{domain_slot_id}/audits":{"get":{"tags":["Partner"],"summary":"List audits for one domain slot","description":"**Per-domain history** — fetch scan lineage for a specific `domain_slot_id` without pulling your entire tenant.\n\nIdeal for drill-down pages after `GET /domains`. Unknown ids return **404** to avoid leaking slot existence across partners.","operationId":"list_partner_domain_audits_api_v1_partner_domains__domain_slot_id__audits_get","parameters":[{"name":"domain_slot_id","in":"path","required":true,"schema":{"type":"string","title":"Domain Slot Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Reverse-chronological `PartnerAuditListItem` rows scoped to the slot — respects API key environment filters (test keys only see sandbox usage for that slot).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerAuditsListResponse"}}}},"400":{"description":"Bad request — invalid URL, environment mismatch between key and body, missing business prerequisite (for example credits or agency setup), or malformed JSON."},"401":{"description":"Unauthorized — missing or invalid credentials. Send a valid partner secret key (`ssk_test_*` / `ssk_live_*`) in the `X-API-Key` header, or authenticate via session cookie for dashboard integrations."},"403":{"description":"Forbidden — partner account not active, API key lacks required scope, environment mismatch for this audit, or export feature not enabled on the base plan."},"422":{"description":"Validation error — request body or query parameters failed schema validation (see response body for field-level errors)."},"429":{"description":"Too many requests — partner rate limit on read-heavy endpoints, or rescan / domain cooldown is still active (retry after `next_rescan_available_at` when provided)."},"404":{"description":"Not found — unknown job id, domain slot id, or resource not visible to this partner."}}}}},"components":{"schemas":{"PartnerWebhookEventItem":{"properties":{"event_id":{"type":"string","title":"Event Id","description":"Stable id for idempotent processing on your side.","examples":["9c1b2a3d-4e5f-6789-abcd-ef0123456789"]},"webhook_id":{"type":"string","title":"Webhook Id","description":"Target endpoint row that received (or will receive) the delivery.","examples":["2ea2ef46-8c96-4b8e-9f99-001122334455"]},"event_type":{"type":"string","title":"Event Type","description":"SecureSpells event name (`audit.created`, `audit.completed`, …).","examples":["audit.completed"]},"delivery_status":{"type":"string","title":"Delivery Status","description":"Outbox disposition: `pending`, `delivered`, or `failed`.","examples":["delivered"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the event was recorded (UTC).","examples":["2026-03-24T14:29:00.000Z"]},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Delivered At","description":"When we observed a successful HTTP response from your endpoint, if any.","examples":["2026-03-24T14:29:02.000Z"]}},"type":"object","required":["event_id","webhook_id","event_type","delivery_status","created_at"],"title":"PartnerWebhookEventItem","description":"Single webhook event from the outbox (source of truth for delivery status)."},"PartnerSubmitAuditResponse":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"Correlation id for this run — use in GET status/results paths and webhooks.","examples":["a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"]},"status":{"type":"string","title":"Status","description":"Immediately after accept, typically `created` / `queued` — final state arrives via webhook.","examples":["created"]},"message":{"type":"string","title":"Message","description":"Human-readable confirmation for logs and quick diagnostics.","default":"Job created","examples":["Job created"]},"estimated_duration_seconds":{"type":"integer","title":"Estimated Duration Seconds","description":"Rough SLA hint for first useful webhook; actual time varies by page complexity.","default":90,"examples":[90]},"results_url":{"type":"string","title":"Results Url","description":"Relative API path to poll JSON results (`GET /api/v1/partner/audits/{job_id}/results`) once `audit.completed` fires.","examples":["/api/v1/partner/audits/a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6/results"]},"domain_slot_id":{"type":"string","title":"Domain Slot Id","description":"Domain slot backing this audit — ties billing, cooldown, and webhook `domainSlotId` together.","examples":["f47ac10b-58cc-4372-a567-0e02b2c3d479"]},"next_rescan_available_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Rescan Available At","description":"ISO 8601 UTC timestamp when a rescan is next allowed for this slot (cooldown). Omitted when not applicable.","examples":["2026-03-24T15:00:00.000Z"]}},"type":"object","required":["job_id","status","results_url","domain_slot_id"],"title":"PartnerSubmitAuditResponse","description":"`202 Accepted` body after queueing an audit (live or sandbox)."},"PartnerSubmitAuditRequest":{"properties":{"url":{"type":"string","title":"Url","description":"Full HTTPS (or HTTP for staging) URL of the page to audit. Must be reachable by SecureSpells workers; staging auth can be configured per product contract.","examples":["https://client-staging.agency.com/checkout"]},"device_type":{"type":"string","title":"Device Type","description":"Device profile hint for the headless browser (viewport emulation). Use `desktop` or `mobile` per your product mapping.","default":"desktop","examples":["desktop"]},"callback_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Callback Url","description":"Optional HTTPS endpoint for this audit’s webhook deliveries. If omitted, events go to your registered environment webhook. Must accept POST with signed payloads.","examples":["https://api.agency.com/v1/hooks/securespells"]},"environment":{"anyOf":[{"type":"string","enum":["test","live"]},{"type":"null"}],"title":"Environment","description":"`test` — sandbox lane (no credit burn, sandbox slot). `live` — production lane (credits + 30-day slots). When using an API key, must match the key’s environment.","examples":["live"]},"metadata":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Metadata","description":"Optional string key-value pairs echoed inside the webhook JSON envelope (correlation ids, CRM keys). Max 10 keys; keys ≤64 chars, values ≤512 chars; total JSON ≤2 KiB. Reserved keys (`jobId`, `event`, …) are rejected.","examples":[{"client_ref":"acme-corp-4492","env":"staging"}]}},"type":"object","required":["url"],"title":"PartnerSubmitAuditRequest","description":"Body for `POST /partner/audits` — target URL, optional callback, environment intent, metadata."},"PartnerAuditListItem":{"properties":{"usage_id":{"type":"string","title":"Usage Id","description":"Stable id for this usage row.","examples":["441e8500-f39c-52e5-b827-557766551100"]},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id","description":"Audit job id (sandbox or live) when allocated.","examples":["a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"]},"domain_slot_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain Slot Id","description":"Slot governing billing/cooldown for this URL.","examples":["f47ac10b-58cc-4372-a567-0e02b2c3d479"]},"url":{"type":"string","title":"Url","description":"Scanned URL.","examples":["https://client.agency.com/"]},"status":{"type":"string","title":"Status","description":"Partner API surfaces uppercase aggregates — e.g. `QUEUED`, `PROCESSING`, `COMPLETED`, `FAILED`, `REFUNDED`, `SANDBOX`, `EXPIRED`.","examples":["COMPLETED"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the partner submitted this audit (UTC).","examples":["2026-03-24T14:00:00.000Z"]},"risk_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Risk Score","description":"0–5 risk score when the audit completed.","examples":[2.4]},"risk_level":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Risk Level","description":"Overall risk band derived from score — `Clean`, `Minor`, `Moderate`, `Elevated`, `Severe`.","examples":["Moderate"]}},"type":"object","required":["usage_id","url","status","created_at"],"title":"PartnerAuditListItem","description":"Single row for GET /partner/audits list."},"PartnerDomainListItem":{"properties":{"domain_slot_id":{"type":"string","title":"Domain Slot Id","description":"Primary id — use in `.../domains/{id}/rescan`.","examples":["f47ac10b-58cc-4372-a567-0e02b2c3d479"]},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain","description":"Host-only normalized domain when allocated; null while slot is empty.","examples":["client.agency.com"]},"status":{"type":"string","title":"Status","description":"`active`, `empty`, or `archived` — mirrors lifecycle in portal exports.","examples":["active"]},"allocation_type":{"type":"string","title":"Allocation Type","description":"`addon_partner` (billable) vs `partner_sandbox` (demo slot).","examples":["addon_partner"]},"latest_job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Latest Job Id","description":"Most recent audit job tied to this slot.","examples":["a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"]},"latest_risk_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latest Risk Score","description":"Score from the latest completed audit, when present.","examples":[1.8]},"latest_risk_level":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Latest Risk Level","description":"Overall risk band for the latest audit.","examples":["Minor"]},"allocated_at":{"type":"string","format":"date-time","title":"Allocated At","description":"When the domain was bound to the slot (UTC).","examples":["2026-03-01T09:00:00.000Z"]},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At","description":"When the slot's 30-day monitoring window ends (UTC): 30 days from the first live scan. A rescan does not extend it. Set for every `addon_partner` slot, including archived ones (it may be in the past); null only for `partner_sandbox` (perpetual).","examples":["2026-03-31T09:00:00.000Z"]},"is_expired":{"type":"boolean","title":"Is Expired","description":"True when the 30-day window has ended and `POST /partner/domains/{id}/rescan` returns 410 Gone. Always false for `partner_sandbox`. Use this flag, not a date comparison, to decide whether a rescan is available. To keep the domain monitored, submit a new live audit (starts a new 30-day slot).","default":false,"examples":[false]},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Planned hard-deletion timestamp for archived slots (compliance retention).","examples":["2026-06-30T09:00:00.000Z"]},"next_rescan_available_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Rescan Available At","description":"ISO 8601 when rescan becomes allowed; null if you may rescan immediately. Same cooldown rules as `POST /partner/domains/{id}/rescan`.","examples":["2026-03-24T16:00:00.000Z"]}},"type":"object","required":["domain_slot_id","status","allocation_type","allocated_at"],"title":"PartnerDomainListItem","description":"Single domain slot for GET /partner/domains (partner-safe; no agency UI fields)."},"PartnerAuditStatusResponse":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"Same id returned from `POST /audits` or rescan.","examples":["a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"]},"status":{"type":"string","title":"Status","description":"Pipeline status — sandbox may show `PENDING`/`COMPLETED`; live aligns with worker states (`QUEUED`, `PROCESSING`, `COMPLETED`, …).","examples":["COMPLETED"]},"url":{"type":"string","title":"Url","description":"Normalized target URL that was audited.","examples":["https://client-staging.agency.com/checkout"]},"submitted_at":{"type":"string","format":"date-time","title":"Submitted At","description":"When the audit entered the SecureSpells queue (UTC).","examples":["2026-03-24T14:28:00.000Z"]},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At","description":"When processing finished; null while running.","examples":["2026-03-24T14:29:45.000Z"]},"results_url":{"type":"string","title":"Results Url","description":"Relative path to fetch the JSON report when ready.","examples":["/api/v1/partner/audits/a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6/results"]}},"type":"object","required":["job_id","status","url","submitted_at","results_url"],"title":"PartnerAuditStatusResponse","description":"High-level processing state for one audit job (sandbox or live)."},"PartnerAuditEventsResponse":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"Audit job id you passed to `GET .../events`.","examples":["a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"]},"usage_id":{"type":"string","title":"Usage Id","description":"Internal usage row — correlates billing and webhooks.","examples":["331e8400-e29b-41d4-a716-446655440000"]},"events":{"items":{"$ref":"#/components/schemas/PartnerWebhookEventItem"},"type":"array","title":"Events","description":"Chronological webhook attempts / lifecycle rows for this audit."}},"type":"object","required":["job_id","usage_id","events"],"title":"PartnerAuditEventsResponse","description":"Webhook event lifecycle for an audit — debug partner deliveries."},"PartnerDomainsListResponse":{"properties":{"pagination":{"$ref":"#/components/schemas/PartnerDomainsPagination","description":"Paging envelope — use `has_more` for infinite scroll."},"data":{"items":{"$ref":"#/components/schemas/PartnerDomainListItem"},"type":"array","title":"Data","description":"Slots visible to this partner (live + sandbox)."}},"type":"object","required":["pagination","data"],"title":"PartnerDomainsListResponse","description":"Paginated list of partner-visible domain slots."},"PartnerAuditsListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PartnerAuditListItem"},"type":"array","title":"Items","description":"Newest-first rows (per route defaults)."}},"type":"object","required":["items"],"title":"PartnerAuditsListResponse","description":"Paginated list of partner audit usage for Scan History."},"PartnerDomainsPagination":{"properties":{"limit":{"type":"integer","title":"Limit","description":"Requested page size.","examples":[50]},"offset":{"type":"integer","title":"Offset","description":"Rows skipped from the newest-first ordering.","examples":[0]},"total":{"type":"integer","title":"Total","description":"Total slots matching the filter.","examples":[12]},"has_more":{"type":"boolean","title":"Has More","description":"True if another page exists (`offset + limit < total`).","examples":[false]}},"type":"object","required":["limit","offset","total","has_more"],"title":"PartnerDomainsPagination","description":"Cursor-style page metadata for slot lists."}}},"tags":[{"name":"Partner","description":"Programmatic endpoints under **`/api/v1/partner`** — submit audits, poll results, export HTML/PDF, and manage domain slots.\n\n### Server\n\n`See the `servers` list in the downloaded OpenAPI document.`\n\nSend your partner **secret** key (`ssk_test_*` / `ssk_live_*`) in the **`X-API-Key`** header on authenticated routes. Public pricing is the only unauthenticated call in this spec.\n\n### Client libraries\n\nUse the **language tabs** in each operation’s code panel (Shell, Python, Node.js, …). For a generated SDK, import **`public-openapi.json`** into your toolchain.\n\n_Here and in the introduction: authentication, environments (test vs live), webhooks, and rate limits are described above._"}]}