Skip to main content

Attachment scanning

Check files sent with a model request before they reach the provider. The gateway extracts document text, reads text in images and scanned PDFs with OCR, and identifies image risks such as payment cards or ID documents. Your enabled data risks decide what to monitor, remove or block.

Attachment scanning is off by default. Turning it on does not change what the selected model can accept: the file format must still be supported by that model.

Check the files
Detected type
Size, count and PDF pages
Read and inspect
Document text and OCR
Enabled Image Risks
Apply your rules
Monitor
Strip or block
Record the outcome
Scan status
Findings and action
QuilrAI

Three kinds of protection​

ProtectionWhat it checksExample
Document textText extracted from PDFs, documents, spreadsheets, presentations and text files, using your request-side data risks and custom detections.Find an API key in a spreadsheet or personal data in a PDF.
Read text in images (OCR)Text visible in an attached image or scanned PDF page, using the same enabled text detections.Find a card number in a screenshot or a scanned invoice.
Image RisksThe visual content of an attached image, using the image types you enable.Identify a payment-card photo even when its text is difficult to read.

OCR and image classification answer different questions. An invoice containing a card number can trigger a text detection without being a Payment Card Image. A photo of a payment card can trigger that image type. Enable the protections your use case needs.

Where to configure it​

Go toQuilrAI consoleSettingsAI GatewayLLM Gatewayyour appConfigureAttachments

The app's Attachments section has Scan attachments, Allowed files and limits, Scanning, and Images and OCR. Changes apply after Save settings. Select the data types and their actions in the app's Security Guardrails section; attachment text uses the enabled request-side detections.

When the Policy Engine is on, configure the Attachments card under Govern > Policy Engine > LLM Gateway. The Data & Adversarial Risks card selects the text and image data types and their actions. Changes join the shared draft and apply after you publish a revision. A saved app switch does not override the published policy.

Image classification needs both controls

Turn on attachment scanning and Classify images, then enable at least one Image Risks type in Security Guardrails, or select that image data type in a Policy Engine detection rule. Classify images on its own does not check every image type.

Allowed files and limits​

File types are detected from their content, rather than trusting the file name. Each type can be Allow, Strip or Block. Allow lets the file proceed to the enabled scans; it does not exempt it from data-risk rules.

ControlDefaultWhat it means
Scan attachmentsOffEnables the attachment controls.
File typesAllow every typeSeparate actions for Images, PDFs, Documents, Spreadsheets, Presentations, Text, CSV & code, Audio, Video, Archives and Other.
Max file size (MB)20Maximum size of one file.
Max attachments per request (MB)50Maximum combined attachment size in a request.
Max new files per request20Counts new attachments, rather than files resent from earlier turns.
Max PDF pages200Maximum pages in one PDF.
When a size, count or page limit is brokenBlockMonitor the violation, remove the affected attachment, or reject the request.

Files resent in conversation history still count toward size limits and remain subject to type and page checks. Their content can still be scanned.

Content the gateway can read​

File groupSupported content
PDFsText PDFs and, with OCR on, scanned pages.
Office documentsDOCX, DOC, XLSX, XLS, PPTX and PPT.
OpenDocumentODT, ODS and ODP.
Other text documentsRTF, HTML, EML, plain text, CSV, JSON and code files. EML includes message headers and text parts; documents nested inside an email are not fully extracted.
Raster imagesPNG, JPEG, WebP, GIF, BMP and TIFF for OCR; animated GIFs use the first frame. Icon and cursor assets are skipped; small avatars may also be skipped.
SVGText elements can be extracted. SVGs are not checked by image classification.

Audio, video, archives and unknown binary formats are not content-scanned. Their file-type controls still let you allow, remove or block them. Allowing a type does not make its content readable.

Document text and OCR​

Extract document text is on by default once scanning is enabled. The extracted text is checked with the request's enabled text data types, including applicable custom detections.

Read text in images (OCR)Behavior
OffDoes not read image text or scanned PDF pages. Document text extraction can still run.
Images and pages without text (default)Reads attached images and PDF pages without a text layer. Other PDF pages use their existing text.
Every pageAlso reads PDF pages that already have a text layer. This can take longer.

OCR reads up to 20 pages per file, separately from the configurable Max PDF pages limit. Across a request, up to 50,000 extracted characters are sent to text detection. If work cannot finish or text remains beyond the scan limit, the scan is reported as incomplete; findings from the part that was scanned still apply.

OCR scripts​

OCR scripts defaults to Every script. Choose Only these to limit the writing systems read:

Supported writing systems
Latin; Chinese & Japanese; Korean; Cyrillic; Arabic; Devanagari; Tamil; Telugu; Thai; Greek

These are writing systems, rather than a guarantee for every language or image. Bengali OCR is not supported. Text in an unsupported or excluded script, unreadable text, or text made too small by resizing can result in a partial scan.

Image Risks​

Classify images checks the visual content of raster images attached to requests. It is on by default within the attachment settings, but runs only while attachment scanning is on and an image type is enabled. Image Risks is off by default.

Image typeWhat it identifies
Nudity or Sexual ImageImages with nudity or sexual content.
Weapons ImageImages depicting weapons.
Human Face ImageImages depicting a human face.
ID Document ImageImages depicting identity documents.
Payment Card ImageImages depicting payment cards.
Code or Terminal ScreenshotScreenshots of code or terminal content.
Medical ImageImages depicting medical content.

Each image type can use its own action or inherit the Image Risks category action. Start with Monitor to review findings before choosing Strip or Block. Classification describes visible content; it does not verify a person's identity, authenticate a document, or make a medical diagnosis.

Image classification applies to attached raster images. It does not inspect images embedded inside a PDF or Office document. OCR can still read scanned PDF pages. Image quality, cropping and small content can affect what is detected.

Quick configurations​

GoalAttachments controlsData-risk controls
Review sensitive text in uploadsScan attachments on; Extract document text on; OCR set to Images and pages without textEnable the required request-side text data types; action Monitor.
Stop payment-card imagesScan attachments on; Classify images onEnable Payment Card Image; action Block.
Remove ID-document images while allowing the rest of a requestScan attachments on; Classify images onEnable ID Document Image; action Strip.
Restrict uploads to permitted file kindsScan attachments on; set unwanted File types to Strip or BlockNo image finding is required for a file-type restriction.

The same choices can be scoped to people, groups or applications on the Policy Engine cards. Publish the draft before testing live traffic.

Actions and unreadable files​

ActionEffect
MonitorKeeps the attachment and records the outcome.
StripRemoves the attachment and tells the model it was removed, while the rest of the request can continue.
BlockRejects the whole request before it reaches the provider.

Redact and Partial redact findings in an attachment currently remove the entire attachment. The gateway does not rewrite a PDF or Office file, obscure pixels in an image, or replace a document with redacted extracted text. Where the client format cannot safely represent a removed attachment, a Strip decision becomes Block.

Two additional controls handle content the gateway cannot read:

ControlDefaultApplies to
Encrypted, unreadable, remote or file-ID attachmentsMonitorPassword-protected or unparseable files, unsupported content, remote URLs and provider file references.
Macro-enabled documentsMonitorOffice files containing macros or embedded objects.

The gateway does not fetch remote URLs or download files from a provider's file store. Send file content with the request to have it scanned. Choosing Block for unreadable attachments can reject those references instead.

An incomplete scan is not a clean result

Timeouts, scanner failures and unfinished scans fail open: the missing scan alone does not remove a file or reject a request. This behavior is separate from the action for an unreadable file. Findings in content that was successfully scanned can still trigger their configured action.

Coverage and availability​

Scanning applies to request attachments, including requests that ask for a streaming response, on Chat Completions, OpenAI Responses, Anthropic Messages, Gemini generateContent, Bedrock Converse and supported InvokeModel bodies. It also applies to supported attachments sent through SDK Mode. The gateway inspects the incoming client format before any format translation.

It does not scan files generated in a model's response. Enabling scanning also does not fetch files held remotely, inspect audio or video content, or add guardrails to the separate endpoint-family routes.

On no-GPU deployments, document text extraction remains available; OCR and image classification are unavailable. A requested scan that cannot run is reported as incomplete and fails open. This differs from an image intentionally left unscanned because its protection is switched off.

Review scan outcomes​

The gateway's Insights > Attachments view shows file kinds and sizes, scan outcomes, data found in attachment text, Image labels, and Why attachments were skipped. Filter the period and applications, then select a chart or app to review the related requests.

Request details show each attachment's scan status and the resulting action. Check for incomplete or skipped scans as well as detections; a successful model response alone does not establish that the attachment was scanned.