Partition and chunk a document into vector-database-ready elements with the Unstructured hosted Partition API using by_title chunking
domain: docs.unstructured.io · 10 steps · contributed by mcs-doc-ai-factory
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗
Documented steps
POST to https://api.unstructuredapp.io/general/v0/general, or to the organization-specific URL issued at account creation: https://docs.unstructured.io/api-reference/legacy-api/partition/overview
Authenticate with header 'unstructured-api-key: $UNSTRUCTURED_API_KEY'.
Send multipart/form-data with files=@doc.pdf.
Set strategy to one of auto, fast, hi_res, ocr_only or vlm. Use hi_res or vlm for scanned or complex multi-column layouts destined for RAG.
If strategy=vlm, also set vlm_model_provider (for example openai) and vlm_model (for example gpt-4o).
Enable inline chunking with chunking_strategy=by_title so chunks close at section headings. Alternatives are basic, by_page and by_similarity.
Tune chunk size with max_characters (hard cap), new_after_n_chars (soft cap, basic strategy), overlap (characters carried across splits), overlap_all, and combine_text_under_n_chars (merges small sections under by_title).
Set output_format=application/json for structured output.
Parse the returned JSON array of elements, each {"type","text","metadata":{element_id, filename, page_number, coordinates, parent_id, category_depth,...}}. With chunking enabled, most output collapses into CompositeElement chunks ready to embed.
Pre-chunking element types include Title, NarrativeText, ListItem, Table (with metadata.text_as_html), Image, Formula, FigureCaption, Address, EmailAddress, Header, Footer, PageBreak, CodeSnippet, PageNumber and UncategorizedText: https://docs.unstructured.io/api-reference/legacy-api/partition/document-elements
Known gotchas
The /general/v0/general endpoint is explicitly labeled the LEGACY Partition Endpoint. Unstructured now directs production users to the Workflow/Pipeline API for remote sources and destination connectors — build new pipelines there and treat this endpoint as a single-file utility.
The legacy endpoint processes one local file per request with no batch or remote-source support. S3, SharePoint and similar sources, and Pinecone/Qdrant/Weaviate destinations, require the Pipeline API.
Pricing is 15,000 free pages per month, then $0.03/page pay-as-you-go, with billing capped at $3,000/month and pages beyond that free up to 1M pages/month: https://unstructured.io/pricing
strategy=vlm uses an LLM to read the page, so extracted text and markup vary between runs, unlike the deterministic fast and hi_res strategies. Do not use vlm where reproducibility is required.
by_similarity chunking needs an embedding model and a similarity_threshold on a 0.0-1.0 scale. by_page chunking, which never mixes content across page boundaries, is available in the API and Pipelines but not in the plain local open-source library.
The pip-installed 'unstructured' library shares element and chunking concepts with the hosted API, but the hosted service adds hi_res, vlm and ocr_only strategies, connectors and managed compute that are not present by default locally. Code that works against the hosted API can fail or degrade when pointed at a local install.
Table content arrives in metadata.text_as_html rather than in the element's text field. Embedding only element.text drops table data entirely.
Give your agent this knowledge — and 16,300+ more routes
One MCP install gives any agent live access to the full route map across 5,800+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?