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

# Scan PDF

> Scan a PDF for security threats including injection attacks and policy violations



## OpenAPI

````yaml POST /guardrails/scan-pdf
openapi: 3.0.0
info:
  title: Enkrypt AI APIs
  version: 2.0.0
servers:
  - url: https://api.enkryptai.com
security:
  - apiKeyAuth: []
tags:
  - name: Guardrails
  - name: Code of Conduct
  - name: Endpoints
  - name: Redteam
    description: >-
      Red Team API: submit red-team / threat-modeling / playground / eval runs,
      then poll run status, records, results and compliance. Also two-phase
      threat modeling (categories + data), dataset retrieval, model health,
      findings and risk mitigation. The previous task-based Red Team API is
      under **Archived**.
  - name: Deployments
  - name: AI Proxy
  - name: Leaderboard
  - name: Archived
  - name: MCP Hub
    description: >-
      MCP Hub vulnerability scanning APIs. Submitting scans (the POST endpoints)
      is open to all authenticated callers. The scan **retrieval** APIs — Get
      Scan Job Status, Get Complete Scan Results, List Scans, and Get MCP Hub
      Scan Statistics (the GET endpoints) — are an **enterprise data-license
      feature**: they require your organization to have MCP Hub API access
      enabled by Enkrypt, otherwise they return `403`. Contact us at
      support@enkryptai.com to enable access.
  - name: MCP Registry Servers
  - name: MCP Gateways
  - name: MCP Playground
  - name: Skill Scanner
    description: >-
      Skill Scanner APIs: submit an agent skill (a directory inside a git
      repository) for security scanning, then read the verdict, the risk level
      and the full report. Scanning is asynchronous — a scan takes roughly 30–90
      seconds, so `POST /skill-hub/scan` returns a `scan_id` you poll.


      You see your organization's scans and nobody else's. The identity comes
      from your API key, never from your request — sending `user_email` is a
      `400`.


      For an organization or project API key, scans are filed under the
      **organization**, so every member sees every scan the organization has
      run, whichever project or member submitted it. For an individual account
      it is simply your own scans. Either way List Skill Scans needs no
      parameter to say who you are.
  - name: Compliance
    description: >-
      Compliance APIs: connect a ChatGPT Enterprise workspace, then keep reading
      its compliance logs and scanning every message through one of your saved
      guardrails.


      Every endpoint here — reads as well as writes — requires the **governance
      officer** role on the project your API key belongs to. The organization
      owner is **not** exempt: an owner who has not been granted the role gets
      `403` like anyone else. An individual (non-organization) account cannot
      hold the role at all, so compliance is an organization-only feature today.


      A scan is addressed by name in the `X-Enkrypt-Scan` header, within the
      project its API key belongs to. Message text is never stored: Get
      Compliance Message fetches it live from the provider, and only while the
      provider still holds it.
paths:
  /guardrails/scan-pdf:
    post:
      tags:
        - Guardrails
      summary: >-
        Scan a PDF for security threats including injection attacks and policy
        violations.
      description: >-
        Analyzes the provided base64-encoded PDF file and returns details about
        any detected threats on a per-page basis, including which detectors were
        triggered.
      operationId: scanPdf
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScanPdfRequestBody'
      responses:
        '200':
          description: Scan results for the provided PDF.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScanPdfResponseBody'
              examples:
                success:
                  value:
                    summary:
                      policy_violation: 0
                      injection_attack: 0
                    details:
                      total_pages: 1
                      pages_with_detections: 0
                      detections: []
components:
  schemas:
    ScanPdfRequestBody:
      title: ScanPdfRequestBody
      type: object
      properties:
        file:
          type: string
          description: Base64-encoded PDF file content.
        detectors:
          $ref: '#/components/schemas/GuardrailsDetectorsObject'
        user_metadata:
          $ref: '#/components/schemas/UserMetadata'
      required:
        - file
    ScanPdfResponseBody:
      title: ScanPdfResponseBody
      type: object
      required:
        - summary
        - details
      properties:
        summary:
          type: object
          description: Summary counts of detections by detector type.
          additionalProperties:
            type: integer
        details:
          type: object
          description: Detailed scan results including page-level information.
          properties:
            total_pages:
              type: integer
              description: Total number of pages in the PDF.
            pages_with_detections:
              type: integer
              description: Number of pages that had detections.
            detections:
              type: array
              description: List of detections found in the PDF.
              items:
                additionalProperties: true
                type: object
        user_metadata:
          $ref: '#/components/schemas/UserMetadata'
    GuardrailsDetectorsObject:
      title: GuardrailsDetectorsObject
      type: object
      properties:
        topic_detector:
          type: object
          title: TopicDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            topic:
              type: array
              title: Topic
              items:
                type: string
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        nsfw:
          type: object
          title: NSFWDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        toxicity:
          type: object
          title: ToxicityDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        pii:
          type: object
          title: PIIDetector
          required:
            - enabled
            - entities
          properties:
            enabled:
              type: boolean
              title: Enabled
            entities:
              type: array
              title: Entities
              items:
                type: string
                enum:
                  - pii
                  - secrets
                  - ip_address
                  - url
        injection_attack:
          type: object
          title: InjectionAttackDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            need_explanation:
              type: boolean
              title: Need Explanation
              default: false
              description: >-
                When true, a confirmed attack also returns a one-sentence
                `explanation` in `details.injection_attack`. Costs an extra LLM
                call and never changes the verdict. Defaults to false for this
                detector (policy_violation defaults to true). On credit-metered
                accounts this doubles the detector's cost — see
                /resources/credits.
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        keyword_detector:
          type: object
          title: KeywordDetector
          required:
            - enabled
            - banned_keywords
          properties:
            enabled:
              type: boolean
              title: Enabled
            banned_keywords:
              type: array
              title: Banned Keywords
              items:
                type: string
        system_prompt:
          type: object
          title: SystemPromptDetector
          required:
            - enabled
            - index
          properties:
            enabled:
              type: boolean
              title: Enabled
              example: false
            index:
              type: string
              title: Index
              enum:
                - system
              description: Index
              example: system
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        copyright_ip:
          type: object
          title: CopyrightIPDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
              example: false
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        policy_violation:
          type: object
          title: PolicyAdherenceDetector
          description: >-
            Config for the policy_violation detector. Provide EITHER the
            structured `rules` array (preferred, the Policy Wizard's `enabled`
            rule objects) OR `policy_text`/`coc_policy_name` (legacy). If
            `rules` is present it takes precedence, and the response's
            details.policy_violation gains a `violated_rules` array; if `rules`
            is absent, behavior is unchanged (no `violated_rules`).
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            rules:
              type: array
              title: Rules
              description: >-
                NEW — the structured rule set to enforce (the Policy Wizard's
                `enabled` rule objects). Takes precedence over
                policy_text/coc_policy_name when both are given.
              items:
                $ref: '#/components/schemas/Rule'
            policy_text:
              type: string
              title: Policy Text
              description: >-
                Optional policy text to use if not using coc_policy_name or
                rules
            coc_policy_name:
              type: string
              title: COC Policy Name
              description: >-
                The name of the saved COC policy to use instead of using
                policy_text
            need_explanation:
              type: boolean
              title: Need Explanation
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        bias:
          type: object
          title: BiasDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
        sponge_attack:
          type: object
          title: SpongeAttackDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
              example: false
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
    UserMetadata:
      type: object
      description: >-
        Optional arbitrary metadata object echoed back in the response. Limits:
        at most 16 top-level keys, key names up to 64 characters, nesting depth
        up to 3, total serialized size up to 4 KB. When provided and valid, this
        object is also echoed as a top-level `user_metadata` key on error
        responses (4xx/5xx) of endpoints that accept it; invalid or oversized
        metadata is never echoed, including on the 422 response it causes.
      additionalProperties: true
      maxProperties: 16
      example:
        request_id: abc-123
        source: mobile-app
    Rule:
      title: Rule
      type: object
      properties:
        id:
          title: Id
          type: string
          example: priv-1
        display_text:
          title: Display Text
          type: string
          example: No individualized investment advice
        text:
          title: Text
          type: string
          example: The assistant must not provide individualized investment advice.
        risk_category:
          title: Risk Category
          type: string
          example: legal_ip_liability
          enum:
            - security_fraud
            - safety_harm
            - privacy_data_protection
            - brand_reputation_trust
            - bias_fairness_ethical
            - legal_ip_liability
            - product_misuse_abuse
            - performance_reliability_quality
        applicability:
          title: Applicability
          type: string
          example: assistant
          enum:
            - assistant
            - user
            - user_assistant
        severity:
          title: Severity
          type: string
          example: medium
          enum:
            - critical
            - high
            - medium
            - low
        frameworks:
          title: Frameworks
          type: array
          items:
            type: string
            enum:
              - hipaa
              - finra
              - gdpr
              - ccpa
              - owasp_llm_2025
              - nist_ai_rmf
              - eu_ai_act
              - iso_42001
        mappings:
          title: Mappings
          type: array
          items:
            type: object
            properties:
              framework:
                type: string
              clause:
                type: string
        source:
          title: Source
          type: string
          example: document
          enum:
            - document
            - catalog
            - document/catalog
            - user
        suggested:
          title: Suggested
          type: boolean
          example: false
      required:
        - id
        - text
        - risk_category
        - applicability
        - severity
        - source
        - suggested
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: apikey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.