Document Processing
Pull text out of images and PDFs with OCR, run it through the same moderation checks as your text content, and turn long documents into short, readable summaries. Two dedicated endpoints, each metered on its own quota.
OCR images and PDFs into machine-readable text.
Extracted text is checked for spam, toxicity, and language.
Condense long documents into a concise summary.
Text Extraction (OCR)
Send one or more file URLs and receive the recognized text. Unless you opt out, the extracted text is also moderated using your project's text settings, so a single call both reads and screens the document.
Endpoint
POST https://api.discuse.com/api/v2/ocrRequest
{
"file_urls": [
"https://example.com/scanned-id.jpg",
"https://example.com/contract.pdf"
]
}Skip Moderation
Set moderate to false to extract text only, without running content checks.
{
"file_urls": ["https://example.com/receipt.png"],
"moderate": false
}Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_urls | string[] | Yes | Image or PDF URLs to OCR (max 5 per request) |
moderate | boolean | No | Run text checks on the extracted text. Defaults to true. |
Response
{
"text": "ACME Terms of Service\nEffective 1 January 2026 ...",
"has_text": true,
"num_files": 2,
"has_violations": false,
"results": {
"hits": false,
"sentiment": {
"hit": false,
"toxic": 0.02,
"profanity": 0.01,
"threat": 0.00,
"insult": 0.01
},
"spam_finder": {
"is_spam": false,
"confidence": 0.04
},
"language": {
"detected": "en",
"confidence": 0.99
}
}
}Spam Detected in Document
{
"text": "buy now!!! free crypto giveaway, dm me ...",
"has_text": true,
"num_files": 1,
"has_violations": true,
"results": {
"hits": true,
"spam_finder": {
"is_spam": true,
"confidence": 0.93
}
}
}Response Fields
| Field | Type | Description |
|---|---|---|
text | string | Concatenated text recognized across all files |
has_text | boolean | True if any non-empty text was recognized |
num_files | number | Number of files successfully OCR'd (each counts as one extraction against quota) |
has_violations | boolean | True if moderation flagged the extracted text |
results | object | Moderation result (sentiment, spam, language). Omitted when moderate is false or no text was found. |
Summarization
Generate a concise summary of a document. Provide raw text directly, or supply file_urls and the documents are OCR'd before summarizing.
Endpoint
POST https://api.discuse.com/api/v2/summarizeSummarize a File
{
"file_urls": ["https://example.com/quarterly-report.pdf"]
}Summarize Raw Text
{
"text": "The board convened on 14 March to review ... (long document text)"
}Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Conditional | Raw document text. Required if no file_urls are given. |
file_urls | string[] | Conditional | Document URLs to OCR then summarize (max 5). Required if no text is given. |
Response
{
"summary": "The quarterly report covers revenue growth of 18% YoY, driven by enterprise renewals. Operating costs rose 6% on headcount, leaving margin broadly flat. The board approved a buyback and flagged FX exposure as the key downside risk."
}Try It Free (No API Key)
Both capabilities have public demo endpoints you can call without an API key. They are rate limited per IP, and PDF uploads are capped at 20 pages.
Demo OCR
curl -X POST https://api.discuse.com/api/v2/demo/ocr \
-H "Content-Type: application/json" \
-d '{ "file_url": "https://example.com/sample.pdf" }'Demo Summarization
curl -X POST https://api.discuse.com/api/v2/demo/summarize \
-H "Content-Type: application/json" \
-d '{ "file_url": "https://example.com/sample.pdf" }'Demo Limits
| Limit | Value |
|---|---|
| PDF pages | 20 max |
| Files per request | 2 max |
| Rate limit | 10 requests / minute per IP |
For higher limits, multi-file batches, and usage tracking, use the authenticated /api/v2/ocr and /api/v2/summarize endpoints with an API key.
Authentication: both endpoints require your API key in the X-API-Key header. File URLs must be publicly accessible; the API fetches each one directly.
Limitations
| Limit | Value |
|---|---|
| Max files per request | 5 |
| Supported file types | JPG, PNG, WebP, PDF |
| OCR metering | One extraction per file |
| Summary metering | One summary per request |
Moderate Plain Text Too
Already have the text? Send it straight to the text analysis endpoint for sentiment, spam, and language checks.
Text Analysis Docs