Unified extraction

Text Extraction API

Send up to 10 publicly accessible file URLs in one request. The synchronous response returns extracted content for each file plus combined text and credit usage.

When a unified text extraction API is useful

Use this endpoint when an application receives several kinds of source material but needs one consistent text response. A knowledge base, search index, or content migration pipeline can send PDFs, office documents, images, audio, and video without maintaining a separate client for every format.

Choose plain text for search and analysis, or Markdown when headings and other readable structure help the next processing step. The response also reports each source separately, which makes it easier to trace extracted content back to the original file.

Request

Send a POST request to https://gettxt.ai/api/extract/. Authenticate with the x-api-key header. documentUris is required and accepts 1–10 directly accessible URLs.

{
  "documentUris": [
    "https://example.com/report.pdf"
  ],
  "outputFormat": "text"
}
documentUris (required)
One to ten public URLs. Supported file types can be mixed in one request.
outputFormat (optional)
Use text or markdown. Plain text is the default.
summarize and translate (optional)
Set summarize to true and/or provide a language code such as de or es for translate.

Examples

cURL

curl -X POST "https://gettxt.ai/api/extract/" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "documentUris": [
    "https://example.com/report.pdf"
  ],
  "outputFormat": "text"
}'

Python

import requests

response = requests.post(
    "https://gettxt.ai/api/extract/",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={
    "documentUris": [
        "https://example.com/report.pdf"
    ],
    "outputFormat": "text"
}
)
response.raise_for_status()
print(response.json()["documents"][0]["extractedText"])

Node.js

const response = await fetch("https://gettxt.ai/api/extract/", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY"
  },
  body: JSON.stringify({
  "documentUris": [
    "https://example.com/report.pdf"
  ],
  "outputFormat": "text"
})
});

if (!response.ok) throw new Error(`Extraction failed: ${response.status}`);
const result = await response.json();
console.log(result.documents[0].extractedText);

Synchronous response

Processing completes within the HTTP request. A successful JSON response includes combined content, credit totals, word counts, and a result for each submitted URL.

{
  "creditsUsed": 1,
  "creditsRemaining": 99,
  "totalWordCount": 500,
  "all_text": "Extracted content from all documents...",
  "documents": [
    {
      "documentUri": "https://example.com/report.pdf",
      "status": "succeeded",
      "wordCount": 500,
      "extractedText": "Extracted text content..."
    }
  ]
}

Errors

  • 400: Invalid, empty, inaccessible, oversized, or unsupported input.
  • 401: Missing or invalid API key.
  • 403: Insufficient credits or access denied.
  • 413: File exceeds the service limit.
  • 429: Too many requests; retry later.
  • 500/503/504: Processing, service, or timeout failure.

See the API documentation for the full request and error reference.

Supported formats

Documents

PDF, DOCX, XLSX, PPTX, HTML, EPUB

Images

JPG, JPEG, PNG, BMP, TIFF, HEIF

Audio

MP3, MPGA, M4A, WAV

Video

MP4, AVI, MKV, MOV, FLV, WMV, MPEG, 3GP, WEBM, MTS, M2TS, TS