Tools

PDF to chunks API

Submit any PDF. Get back structured text chunks with page numbers, ready for RAG pipelines and search indexing.

Try it below:

FILEDrop a file or click to upload

Production-ready

Private by design

Security-first

Scalable

Production-ready

Private by design

Security-first

Scalable

Production-ready

Private by design

Security-first

Scalable

Split PDFs into searchable text chunks

Upload a PDF or submit a URL, get structured text chunks back.

{
  "items": [
    {
      "sequence": 1,
      "pageNumber": 1,
      "text": "The dominant sequence transduction models are based on complex recurrent or convolutional neural networks that include an encoder and a decoder. The best performing models also connect the encoder and decoder through an attention mechanism."
    },
    {
      "sequence": 2,
      "pageNumber": 1,
      "text": "We propose a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely. Experiments on two machine translation tasks show these models to be superior in quality while being more parallelizable and requiring significantly less time to train."
    },
    {
      "sequence": 3,
      "pageNumber": 2,
      "text": "Recurrent models typically factor computation along the symbol positions of the input and output sequences. Aligning the positions to steps in computation time, they generate a sequence of hidden states ht, as a function of the previous hidden state ht-1 and the input for position t."
    },
    {
      "sequence": 4,
      "pageNumber": 2,
      "text": "The Transformer follows this overall architecture using stacked self-attention and point-wise, fully connected layers for both the encoder and decoder, shown in the left and right halves of Figure 1, respectively."
    },
    {
      "sequence": 5,
      "pageNumber": 3,
      "text": "An attention function can be described as mapping a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors. The output is computed as a weighted sum of the values, where the weight assigned to each value is computed by a compatibility function of the query with the corresponding key."
    }
  ],
  "total": 42,
  "start": 1,
  "end": 5
}

What is Exabase's PDF to chunks API?

Submit a PDF to the Exabase Extract API and get the text content back as structured chunks. Each chunk has a sequence number, the extracted text, and the page number it came from. The chunks are sized for retrieval and search, not dumped as a single text blob.

This is the same POST /v2/extract endpoint used for all content types. Submit the PDF, poll for completion (or use a webhook), then fetch the chunks from GET /v2/extract/{jobId}/chunks. The API handles text extraction, chunking, and page mapping. No PDF parsing library on your end, no chunking logic to write, no page boundary detection.

What you get back

Each chunk carries three fields: sequence (its position in the document), text (the extracted content), and pageNumber (the page it came from). The extraction response also includes the total chunkCount, so you know how many chunks to page through. Alongside the chunks, the job response includes document metadata (page count, author, title, creation date), a CDN-hosted thumbnail, and a rendered PDF. The API reference has the complete response schema.

One multi-modal API

The same POST /v2/extract endpoint handles every content type Exabase supports. For PDFs, it returns text chunks with page numbers. For audio and video, chunks carry timestamps instead of page numbers. For images, it runs OCR and returns the text as chunks. For web pages, it renders JavaScript and extracts the content as chunks.

The submission flow is identical across all types: one endpoint, one SDK method, one webhook configuration. You learn the pattern once and use it for everything. The Extract docs cover each content type in detail.

What you can build with it

The chunks are the right shape for retrieval-augmented generation. Feed them into your RAG pipeline and cite the page number when your agent uses a chunk. Build a document Q&A system where users ask questions and get answers grounded in specific pages of specific documents. Index a library of PDFs and make every paragraph searchable.

Store the chunks as Resources in a Base and they become searchable through Deep Search at the paragraph level. Workers can re-extract updated documents on a schedule, keeping your search index current without manual work.

Beyond chunking

The Extract API returns more than text chunks. You get document metadata, a CDN-hosted thumbnail, a rendered PDF, and (for invoices, contracts, and resumes) structured field extraction. Store the output as a Resource and it's searchable through Deep Search immediately. The Submitting Jobs guide at https://exabase.io/docs/developer-guide/extraction/submitting-jobs walks through the full flow.

How do I use it?

  1. Get your API key

Free, no credit card:

Sign up at exabase.io and copy your API key from the dashboard.

  1. Submit a PDF

Using the SDK (Node.js):

import { Exabase } from "@exabase/sdk";
import { createReadStream } from "fs";

const api = new Exabase({
  apiKey: process.env.EXABASE_API_KEY,
});

const job = await api.extract.createFromFile({
  file: createReadStream("./research-paper.pdf"),
  name: "Attention Is All You Need",
});

console.log(job.id);    // extraction job id
console.log(job.state); // "pending"k";
import { createReadStream } from "fs";

const api = new Exabase({
  apiKey: process.env.EXABASE_API_KEY,
});

const job = await api.extract.createFromFile({
  file: createReadStream("./report.pdf"),
  name: "Q1 Report",
});

console.log(job.id);    // extraction job id
console.log(job.state); // "pending"
  1. Get the chunks

Poll the job until state reaches completed, then fetch the chunks.

const result = await api.extract.get({ jobId: job.id });

if (result.state === "completed") {
  console.log(result.extraction?.common?.chunkCount); // e.g. 42

  const chunks = await api.extract.getChunks({
    jobId: job.id,
    start: 1,
    end: 20,
  });

  for (const chunk of chunks.items) {
    console.log(chunk.sequence, chunk.pageNumber, chunk.text);
  }
}

One API call to extract. One call to fetch chunks. No PDF library, no chunking logic.

What you get back

Extraction job

Field

Type

Description

state

string

completed or failed

kind

string

document

[...].mimeType

string

application/pdf

[...].size

number

File size in bytes

[...].thumbnail

string

CDN-hosted thumbnail URL

[...].chunkCount

number

Number of text chunks

[...].pages

number

Page count

[...].author

string

Document author

[...].title

string

Document title

[...].pdfRender.url

string

CDN-hosted rendered PDF URL

Text chunks

Field

Type

Description

sequence

number

Chunk position in the document

text

string

Extracted text content

pageNumber

number

Source page number

Chunks are paginated. Pass start and end to GET /v2/extract/{jobId}/chunks to page through them.

API quick reference

Endpoint

Method

Description

/v2/extract

POST

Submit extraction job

/v2/extract

GET

List extraction jobs

/v2/extract/{jobId}

GET

Poll for result

/v2/extract/{jobId}/chunks

GET

Fetch text chunks

/v2/extract-settings

PUT

Configure webhook

Auth: X-Api-Key header on all requests.

File retention: Stored files are retained for 1 day from job creation. Download or copy anything you need before they expire.

Need file extraction or full page content?

Exabase offers a full set of tools to extract content from any media, document or website.

All your data extraction needs in one place.

Why Exabase

Use cases

FAQs

What is Exabase?

Exabase is infrastructure for AI agents. It gives your agents memory, versioned file storage, AI deep search, and context automation through a set of APIs. Store what your agent learns, search inside any content type, and keep knowledge bases current automatically. Built for production use. Give your agent precise context and cut your token spend by up to 81%.

Who uses Exabase?

Developers and teams building AI agents, copilots, and RAG applications. If your agent needs to remember things between sessions, store and retrieve files, search across documents and media, or stay up to date without manual maintenance, Exabase handles that infrastructure so you can focus on your product.

How are chunks sized?

The API handles chunk sizing automatically. Chunks are sized for retrieval and search, not raw page splits. The exact size depends on the document content and structure.

Do chunks respect page boundaries?

Each chunk includes a pageNumber field indicating which page the text came from. Chunks generally respect structural boundaries in the document rather than splitting mid-sentence.

Does it handle scanned PDFs?

Yes. OCR is built in. Submit a scanned PDF the same way you'd submit a digital one. The API detects the content type and processes accordingly.

Can I control the chunk size?

The API uses automatic chunk sizing optimised for retrieval use cases. Custom chunk sizes are not currently configurable.

How do I page through chunks?

Use the start and end query parameters on GET /v2/extract/{jobId}/chunks. The chunkCount field on the extraction response tells you the total.

Can I submit a URL instead of uploading a file?

Yes. Pass a url field in the JSON request body pointing to a publicly accessible PDF. Exabase fetches and processes it.

Do I have to poll for results?

No. You can configure a webhook URL and Exabase will POST the full result to your server when processing completes. The webhooks guide covers setup.

What happens if extraction fails?

The job state moves to failed. You can call the reprocess endpoint to retry without re-uploading the original file.

How long are files retained?

Stored files are retained for 1 day from job creation, then permanently deleted. Download or copy anything you need before the retention window expires.

How is this different from the PDF to JSON tool?

The PDF to JSON page covers the full extraction response: metadata, thumbnails, document properties, and structured data. PDF to Chunks focuses specifically on the text chunk output for RAG and search use cases. Same underlying API, different emphasis.

Can I chunk content types other than PDFs?

Yes. The same POST /v2/extract endpoint returns chunks for images (OCR text), audio (transcript with timestamps), video (transcript with timestamps), and web pages. See the Audio to JSON, Video to JSON, Image to JSON, and Website to JSON tool pages.

Is there an SDK?

Yes. The @exabase/sdk package for Node.js/TypeScript handles file streaming, job polling, and chunk retrieval. Install with npm install @exabase/sdk.

Deciding?

Ask your favourite AI about Exabase:

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.