Pick your framework.

Official SDKs and RAG-framework loaders — install, then extract, in under ten lines.

sdk-js

@txtfetch/sdk (JavaScript / TypeScript)

Zero runtime dependencies. Node ≥ 20. Dual ESM/CJS with .d.ts.

Install
npm install @txtfetch/sdk
Quickstart
import { Txtfetch } from "@txtfetch/sdk";

// apiKey defaults to process.env.TXTFETCH_KEY
const txtfetch = new Txtfetch();

const { extracted_text, metadata } = await txtfetch.extract({ file: "./whitepaper.pdf" });
console.log(extracted_text, metadata.chars);

const byUrl = await txtfetch.extract({ url: "https://example.com/report.docx" });
console.log(byUrl.extracted_text);

sdk-python

txtfetch (Python)

Python 3.9+. The only runtime dependency is httpx.

Install
pip install txtfetch
Quickstart
from txtfetch import Txtfetch

# api_key defaults to the TXTFETCH_KEY environment variable
client = Txtfetch(api_key="tf_live_...")

# Extract from a local file (path, bytes, or a file-like object all work)
result = client.extract(file="whitepaper.pdf")
print(result.extracted_text)
print(result.metadata.content_type, result.metadata.bytes, result.metadata.ocr)

# Extract from a URL — txtfetch fetches it server-side
result = client.extract(url="https://example.com/whitepaper.docx")

langchain-python

langchain-txtfetch

A LangChain document loader — a thin adapter over the Python SDK. Each file/URL becomes one Document, ready for a text splitter.

Install
pip install langchain-txtfetch
Quickstart
from langchain_text_splitters import RecursiveCharacterTextSplitter

from langchain_txtfetch import TxtfetchLoader

# api_key defaults to the TXTFETCH_KEY environment variable
loader = TxtfetchLoader(
    files=["whitepaper.pdf"],           # single path/URL or a list of them
    urls=["https://example.com/spec.docx"],
)

documents = loader.load()

splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
chunks = splitter.split_documents(documents)

langchain-js

@txtfetch/langchain

A LangChain.js document loader — a thin adapter over @txtfetch/sdk. Requires @langchain/core as a peer dependency.

Install
npm install @txtfetch/langchain @langchain/core
Quickstart
import { RecursiveCharacterTextSplitter } from "@langchain/textsplitters";
import { TxtfetchLoader } from "@txtfetch/langchain";

// apiKey defaults to the TXTFETCH_KEY environment variable
const loader = new TxtfetchLoader({
  files: ["whitepaper.pdf"], // a single path/URL or an array of them
  urls: ["https://example.com/spec.docx"],
});

const documents = await loader.load();

const splitter = new RecursiveCharacterTextSplitter({ chunkSize: 1000, chunkOverlap: 100 });
const chunks = await splitter.splitDocuments(documents);

llamaindex-python

llama-index-readers-txtfetch

A LlamaIndex reader — a thin adapter over the Python SDK. Each file/URL becomes one Document.

Install
pip install llama-index-readers-txtfetch
Quickstart
from llama_index.core import VectorStoreIndex
from llama_index.readers.txtfetch import TxtfetchReader

# api_key defaults to the TXTFETCH_KEY environment variable
reader = TxtfetchReader()

documents = reader.load_data(
    files=["whitepaper.pdf"],           # single path/URL or a list of them
    urls=["https://example.com/spec.docx"],
)

index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
print(query_engine.query("What is this document about?"))

next

Turn any of these loaders into a full ingestion pipeline in the chunk → embed → index recipe, or read the error reference for how each SDK's typed exceptions map to the wire format. Writing Go, Java, or C# — languages with no official SDK yet? See extract by language for the whole HTTP client in each.

Stop parsing. Start shipping.

Create an account and get an API key in minutes — the free Hobby plan needs no card.

Get started →