> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptguard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview Overlay

> Evaluate a candidate overlay in shadow against a traffic sample.



## OpenAPI

````yaml /api-reference/openapi-developer.json post /api/v1/overlays/preview
openapi: 3.1.0
info:
  title: PromptGuard Developer API
  description: >-
    Public API for developers to integrate PromptGuard security into their
    applications
  version: 1.0.0
servers:
  - url: https://api.promptguard.co
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/overlays/preview:
    post:
      tags:
        - overlays
      summary: Preview Overlay
      description: Evaluate a candidate overlay in shadow against a traffic sample.
      operationId: preview_overlay_api_v1_overlays_preview_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OverlayPreviewRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShadowReportOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    OverlayPreviewRequest:
      properties:
        delta:
          $ref: '#/components/schemas/OverlayDelta'
        sample:
          $ref: '#/components/schemas/SampleSource'
        max_examples:
          type: integer
          maximum: 50
          minimum: 1
          title: Max Examples
          default: 5
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
      type: object
      required:
        - delta
      title: OverlayPreviewRequest
    ShadowReportOut:
      properties:
        total:
          type: integer
          title: Total
        counts:
          additionalProperties:
            type: integer
          type: object
          title: Counts
        blocked_base:
          type: integer
          title: Blocked Base
        blocked_candidate:
          type: integer
          title: Blocked Candidate
        warnings:
          items:
            $ref: '#/components/schemas/OverlayWarningOut'
          type: array
          title: Warnings
        examples:
          additionalProperties:
            items:
              $ref: '#/components/schemas/DivergenceItemOut'
            type: array
          type: object
          title: Examples
      type: object
      required:
        - total
        - counts
        - blocked_base
        - blocked_candidate
        - warnings
        - examples
      title: ShadowReportOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OverlayDelta:
      properties:
        detection_levels:
          additionalProperties:
            type: string
            enum:
              - strict
              - moderate
              - permissive
          type: object
          title: Detection Levels
        toxicity_threshold:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Toxicity Threshold
        add_custom_patterns:
          items:
            type: string
          type: array
          title: Add Custom Patterns
        add_blocked_domains:
          items:
            type: string
          type: array
          title: Add Blocked Domains
        guardrails:
          additionalProperties:
            $ref: '#/components/schemas/GuardrailDelta'
          type: object
          title: Guardrails
      type: object
      title: OverlayDelta
      description: >-
        Additive deltas over a base policy config.


        Everything here is meant to *tighten*. Loosening ops (raising a
        threshold,

        dropping a detection level toward permissive, disabling a guardrail) are

        permitted to be expressed but are flagged as warnings in the diff.
    SampleSource:
      properties:
        kind:
          type: string
          enum:
            - corpus
            - inline
          title: Kind
          default: corpus
        limit:
          type: integer
          maximum: 2000
          minimum: 1
          title: Limit
          default: 100
        texts:
          items:
            type: string
          type: array
          title: Texts
      type: object
      title: SampleSource
      description: >-
        Where the shadow traffic sample comes from.


        ``corpus`` reuses the curated Shadow eval corpus (offline,
        deterministic);

        ``inline`` lets the caller pass their own recent-traffic prompts.
    OverlayWarningOut:
      properties:
        kind:
          type: string
          title: Kind
        field:
          type: string
          title: Field
        message:
          type: string
          title: Message
        severity:
          type: string
          enum:
            - warning
            - critical
          title: Severity
      type: object
      required:
        - kind
        - field
        - message
        - severity
      title: OverlayWarningOut
    DivergenceItemOut:
      properties:
        text_preview:
          type: string
          title: Text Preview
        category:
          type: string
          title: Category
        base_decision:
          type: string
          title: Base Decision
        base_confidence:
          type: number
          title: Base Confidence
        candidate_decision:
          type: string
          title: Candidate Decision
        candidate_confidence:
          type: number
          title: Candidate Confidence
        divergence:
          type: string
          title: Divergence
      type: object
      required:
        - text_preview
        - category
        - base_decision
        - base_confidence
        - candidate_decision
        - candidate_confidence
        - divergence
      title: DivergenceItemOut
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    GuardrailDelta:
      properties:
        enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enabled
        level:
          anyOf:
            - type: string
              enum:
                - strict
                - moderate
                - permissive
            - type: 'null'
          title: Level
        threshold:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Threshold
      type: object
      title: GuardrailDelta
      description: >-
        Per-guardrail override the overlay wants to apply.


        Matches the ``guardrails`` override shape PolicyEngine already reads:

        ``{enabled, level, threshold}``. ``enabled=False`` disables a detector
        and

        is only ever a *loosening* op (surfaced as a critical warning).
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        PromptGuard API key for developer endpoints. Keys start with pg_live_
        and are created in the dashboard.

````