---
title: "Extract tables from a PDF"
method: POST
path: "/v1/tools/pdf_extract_tables"
tags: ["Tools"]
---

# Extract tables from a PDF

`POST /v1/tools/pdf_extract_tables`

## Request

- Base URL: `http://127.0.0.1:7341`
- URL: `http://127.0.0.1:7341/v1/tools/pdf_extract_tables`
- Auth: HTTP bearer

Find the tables in a PDF (ruled, shaded and borderless, plus charts drawn as vectors, as tables of their values) and write them as Excel (.xlsx, one sheet per table), CSV, JSON or Markdown. The output name must end in the format's extension (.xlsx, .csv, .json, .md).

Same tool as the MCP server's pdf_extract_tables. Runs before responding; for long work, POST /v1/jobs instead.

## Request body

- PdfExtractTablesInput
  - `input` string, required: Path to a PDF inside an allowed folder (absolute, or relative to the first allowed folder).
  - `pages` string: Page numbers or ranges, such as "1, 3-5". Omit for every page.
  - `format` 'xlsx' | 'csv' | 'json' | 'markdown'
  - `output` string, required: Path for the new file, ending in .xlsx, .csv, .json or .md to match the format, inside an allowed folder. Must not exist yet.

## Response `200`

The result. Any new files are written inside the allowed folders.

- PdfExtractTablesResult
  - `output` string, required
  - `bytes` integer, required
  - `format` string, required
  - `tables` integer, required

## Other responses

- `400`: The body is not valid JSON.
- `401`: The bearer token is missing or wrong.
- `403`: The Host or Origin header is not allowed.
- `409`: The output file already exists. superPDF never overwrites; choose a new name.
- `413`: The body is larger than 1 MB.
- `415`: The body is not application/json.
- `422`: Invalid input (errors names each field), a path outside the allowed folders, or a document the tool could not process.
- `429`: Too many tool calls are running and waiting (4 at once, 2 of them LibreOffice conversions; 64 more wait their turn).
- `500`: Unexpected server failure.

---

[API](https://skmtc.dev/superpdf/apis/superpdf-local-api.md) · [All operations](https://skmtc.dev/superpdf/apis/superpdf-local-api/llms.txt) · [OpenAPI document](https://skmtc.dev/superpdf/apis/superpdf-local-api/revisions/53f71d44b156?raw)
