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

# Scan File

> Extract text from an uploaded file, scan it, and (when redaction is
needed) rewrite the file in place so the bytes returned to the caller carry
placeholders instead of the original PII/secrets.

The desktop agent calls this for file/document blocks it finds in proxied
LLM requests, its own detection stack only sees plain message text, so
without this path nothing inside an uploaded spreadsheet/PDF is inspected.



## OpenAPI

````yaml /api-reference/openapi.json post /api/runtime-security/scan/file
openapi: 3.1.0
info:
  title: Blindsight API
  version: 0.1.0
  description: >-
    The full Blindsight REST surface, generated from the running application.
    Replace the server host with your own deployment.


    For the Runtime Security integration surface (scan, proxy, tool calls) see
    the Runtime Security spec, which is hand written and carries worked
    examples.
servers:
  - url: https://api.your-blindsight.com
    description: Your Blindsight deployment
security: []
paths:
  /api/runtime-security/scan/file:
    post:
      tags:
        - runtime-security
      summary: Scan File
      description: >-
        Extract text from an uploaded file, scan it, and (when redaction is

        needed) rewrite the file in place so the bytes returned to the caller
        carry

        placeholders instead of the original PII/secrets.


        The desktop agent calls this for file/document blocks it finds in
        proxied

        LLM requests, its own detection stack only sees plain message text, so

        without this path nothing inside an uploaded spreadsheet/PDF is
        inspected.
      operationId: scan_file_api_runtime_security_scan_file_post
      parameters:
        - name: X-Blindsight-App-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Blindsight-App-Id
        - name: X-Blindsight-App-Token
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Blindsight-App-Token
        - name: X-Blindsight-Component-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Blindsight-Component-Id
        - name: X-Blindsight-Workload-Platform
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Blindsight-Workload-Platform
        - name: X-Blindsight-Activity-Type
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Blindsight-Activity-Type
        - name: X-Blindsight-Device-Token
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Blindsight-Device-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScanFileRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScanFileResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ScanFileRequest:
      properties:
        data:
          type: string
          title: Data
          description: Base64-encoded file bytes to scan.
        filename:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Filename
        media_type:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Media Type
          description: MIME hint, e.g. application/pdf. Sniffed if absent.
        direction:
          type: string
          pattern: ^(input|output)$
          title: Direction
          default: input
        source_app:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Source App
        provider:
          anyOf:
            - type: string
              maxLength: 32
            - type: 'null'
          title: Provider
        model:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Model
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
      type: object
      required:
        - data
      title: ScanFileRequest
    ScanFileResponse:
      properties:
        uuid:
          type: string
          title: Uuid
        verdict:
          type: string
          title: Verdict
        injection:
          additionalProperties: true
          type: object
          title: Injection
        pii:
          additionalProperties: true
          type: object
          title: Pii
        redacted:
          type: boolean
          title: Redacted
        redacted_count:
          type: integer
          title: Redacted Count
        data:
          type: string
          title: Data
        media_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Media Type
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
        kind:
          type: string
          title: Kind
        extracted_chars:
          type: integer
          title: Extracted Chars
        blocked_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Blocked Reason
        latency_ms:
          type: integer
          title: Latency Ms
      type: object
      required:
        - uuid
        - verdict
        - injection
        - pii
        - redacted
        - redacted_count
        - data
        - kind
        - extracted_chars
        - latency_ms
      title: ScanFileResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````