Smart Conversion
Extract text from any document
Smart text extraction that automatically detects the input format and uses the appropriate extraction method.
Supported Formats
- PDF: Native text extraction, falls back to OCR for scanned PDFs
- DOCX: Microsoft Word documents
- XLSX: Microsoft Excel (extracts cell contents)
- PPTX: Microsoft PowerPoint (extracts slide text)
- Images: PNG, JPEG, TIFF, BMP (uses OCR)
- HTML: Extracts visible text content
How It Works
- Detects file format from content (not just extension)
- Routes to appropriate extraction module
- For PDFs: tries native extraction first, falls back to OCR if no text found
- Returns extracted text with metadata about source format
Example Usage
import httpx
with open("document.pdf", "rb") as f:
response = httpx.post(
"https://api.filegraph.ai/any/to-text",
headers={"X-API-Key": "your-api-key"},
files={"file": f},
)
print(response.json()["text"])
post/any/to-text
Request
- Base URL: https://api.filegraph.ai (the document declares no server; this is the origin it was published from)
- URL: https://api.filegraph.ai/any/to-text
- Auth: API key in header X-API-Key
Query parameters
ocr_languagestring
ocr_fallbackboolean
Response
Text successfully extracted
Example response
{
"char_count": 892,
"format_detected": "pdf",
"metadata": {
"page_count": 3
},
"text": "This is the extracted text from the document...",
"used_ocr": false,
"word_count": 150
}Changes
No recorded changes to this operation across all 1 revision of this API.