> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runpulse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tables

> Extract tables from a previously completed extraction. Processes the
extraction's document content and returns structured table data.

Requires the `tables_endpoint` feature flag to be enabled for your
organization.

Set `async: true` to return immediately with a `tables_id` for
polling via `GET /job/{tables_id}`.

To extract tables from many extractions at once, see
[Batch Tables](api:POST/batch/tables) or the
[Batch Processing guide](/batch).

## Overview

> [!NOTE]
>
> **Pipeline Step 2 (terminal)** — Tables requires a prior [extraction](https://docs.runpulse.com/api-reference/endpoint/extract.md). This is a terminal step — no further pipeline steps can be chained after it.

Extract structured tables from a saved extraction using Pulse's semantic and table-structure algorithms. The `/tables` endpoint detects and reconstructs tables from your document, handling:

* **Span tables** — cells that merge across rows or columns (e.g., "Year Ended December 31" spanning three columns)
* **Multi-level header hierarchies** — nested spans like period → segment → line item
* **Cross-page tables** — tables that continue across page breaks, automatically merged with row-continuity tracking

This is particularly valuable for financial documents (10-Ks, 10-Qs, proxy statements) where span tables encode hierarchy visually rather than explicitly, causing most extraction tools to silently misalign values with the wrong columns.

> [!NOTE]
>
> This endpoint operates on **saved extractions** (created via `/extract` with storage enabled, which is the default).

> [!NOTE]
>
> To extract tables from many extractions at once, use [Batch Tables](https://docs.runpulse.com/api-reference/endpoint/batch-overview.md#batch-tables).

### Async Mode

Set `async: true` to return immediately with a job ID for polling. See [Polling for Results](https://docs.runpulse.com/api-reference/endpoint/poll.md) for details.

```json theme={null}
{
  "extraction_id": "abc123-def456",
  "async": true
}
```

***

## Request

### Request Body

| Field | Type | Required | Description |
| - | - | - | - |
| `extraction_id` | string (uuid) | Yes | ID of the saved extraction to process |
| `tables_config` | object | No | Configuration options for table processing |
| `async` | boolean | No | If `true`, returns immediately with a `tables_id` for [polling](https://docs.runpulse.com/api-reference/endpoint/poll.md). Default: `false`. |

### Tables Config (`tables_config`)

| Field | Type | Default | Description |
| - | - | - | - |
| `merge` | boolean | `false` | Merge tables that continue across pages into a single table |
| `table_format` | string | `"html"` | Output format for table content. Use `"html"` for an HTML `<table>` string or `"json"` for structured headers and rows. |
| `charts_to_tables` | boolean | `false` | Convert figures and charts into tables using LLM processing. Resulting tables have `from_chart: true` in the response. |

***

## Response

### Synchronous Response (200)

| Field | Type | Description |
| - | - | - |
| `tables_id` | string (uuid) | Unique identifier for this tables result |
| `tables_output` | object | Contains the extracted tables |
| `tables_output.tables` | array | List of extracted table objects |

Each table object:

| Field | Type | Description |
| - | - | - |
| `citations` | array of strings | Bounding box table IDs for the table (e.g., `["tbl-1"]` or `["tbl-1", "tbl-2"]` for merged tables) |
| `table_content` | string | The table content in HTML format |
| `from_chart` | boolean | Whether the table was derived from a chart/figure rather than a native table |

```json theme={null}
{
  "tables_id": "uuid-123",
  "tables_output": {
    "tables": [
      {
        "citations": ["tbl-1", "tbl-2"],
        "table_content": "<table data-bb-table-id=\"tbl-1\" data-merged-from=\"tbl-1,tbl-2\">...</table>",
        "from_chart": false
      }
    ]
  }
}
```

### Async Response (200)

| Field | Type | Description |
| - | - | - |
| `tables_id` | string (uuid) | Job ID for [polling](https://docs.runpulse.com/api-reference/endpoint/poll.md) |
| `status` | string | `"pending"` |
| `message` | string | Human-readable status message |

```json theme={null}
{
  "tables_id": "uuid-123",
  "status": "pending",
  "message": "Table processing started. Poll GET /job/{tables_id} for results."
}
```

***

## Example Usage

### Basic Table Extraction

```python Python theme={null}
from pulse import Pulse

client = Pulse(api_key="YOUR_API_KEY")

# Step 1: Extract the document
extract_result = client.extract(
    file=open("10k-filing.pdf", "rb")
)

# Step 2: Extract tables
tables_result = client.tables(
    extraction_id=extract_result.extraction_id
)

for table in tables_result.tables_output.tables:
    print(f"Citations: {table.citations}")
    print(f"From chart: {table.from_chart}")
    print(table.table_content)
```

```typescript TypeScript theme={null}
import { PulseClient } from "pulse-ts-sdk";
import * as fs from "fs";

const client = new PulseClient({
  apiKey: "YOUR_API_KEY",
});

// Step 1: Extract the document
const extractResult = await client.extract({
  file: fs.createReadStream("10k-filing.pdf"),
});

// Step 2: Extract tables
const tablesResult = await client.tables({
  extraction_id: extractResult.extraction_id,
});

for (const table of tablesResult.tables_output.tables) {
  console.log("Citations:", table.citations);
  console.log(table.table_content);
}
```

```bash curl theme={null}
# Step 1: Extract the document
curl -X POST https://api.runpulse.com/extract \
  -H "x-api-key: YOUR_API_KEY" \
  -F "file=@10k-filing.pdf"

# Response includes extraction_id: "abc123-..."

# Step 2: Extract tables
curl -X POST https://api.runpulse.com/tables \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "extraction_id": "abc123-..."
  }'
```

### With Cross-Page Table Merging

```python Python theme={null}
tables_result = client.tables(
    extraction_id=extract_result.extraction_id,
    tables_config={
        "merge": True,
        "table_format": "html"
    }
)
```

```bash curl theme={null}
curl -X POST https://api.runpulse.com/tables \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "extraction_id": "abc123-...",
    "tables_config": {
      "merge": true,
      "table_format": "html"
    }
  }'
```

### With Chart-to-Table Conversion

Convert figures and charts into structured tables using LLM processing. Chart-derived tables are marked with `from_chart: true` in the response.

```python Python theme={null}
tables_result = client.tables(
    extraction_id=extract_result.extraction_id,
    tables_config={
        "merge": True,
        "charts_to_tables": True
    }
)

for table in tables_result.tables_output.tables:
    if table.from_chart:
        print("Chart-derived table:")
    print(table.table_content)
```

```bash curl theme={null}
curl -X POST https://api.runpulse.com/tables \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "extraction_id": "abc123-...",
    "tables_config": {
      "merge": true,
      "charts_to_tables": true
    }
  }'
```

### Async Processing

```python theme={null}
# Start async table extraction
job = client.tables(
    extraction_id=extract_result.extraction_id,
    tables_config={"merge": True},
    async_=True
)

# Poll for results
result = client.jobs.get_job(job.tables_id)  # Repeat until status is "completed"
```

***

## Error Responses

| Status | Error | Description |
| - | - | - |
| 400 | Invalid request | Missing required fields or invalid configuration |
| 401 | Unauthorized | Invalid or missing API key |
| 404 | Extraction not found | The `extraction_id` doesn't exist or you don't have access |
| 429 | Rate limit exceeded | Too many requests |
| 500 | Processing error | Table processing failed |

***

## When to Use Tables vs. Basic Extraction

Basic extraction via `/extract` already returns tables in the markdown output. Use the `/tables` endpoint when you need:

* **Span-aware table parsing** — correct handling of merged cells, multi-level headers, and column/row spans
* **Cross-page table merging** — tables that continue across page breaks reconstructed into a single table
* **Financial document accuracy** — SEC filings, annual reports, and other documents where misaligned columns mean wrong data
* **Dedicated table output** — clean HTML tables with citation tracking, separated from the rest of the document content


## OpenAPI

````yaml api-reference/openapi.yml POST /tables
openapi: 3.1.0
info:
  title: Pulse API Structure
  version: 0.1.0
  description: >-
    Canonical contract for the Pulse extraction APIs. This specification is the
    single source of truth for shared request/response models that client and
    server packages consume.
servers:
  - url: https://api.runpulse.com
    description: Default Pulse API base URL
security:
  - ApiKey: []
paths:
  /tables:
    post:
      tags:
        - Tables
      summary: Extract tables from a saved extraction
      description: |-
        Extract tables from a previously completed extraction. Processes the
        extraction's document content and returns structured table data.

        Requires the `tables_endpoint` feature flag to be enabled for your
        organization.

        Set `async: true` to return immediately with a `tables_id` for
        polling via `GET /job/{tables_id}`.

        To extract tables from many extractions at once, see
        [Batch Tables](api:POST/batch/tables) or the
        [Batch Processing guide](/batch).
      operationId: extractTables
      parameters:
        - name: Pulse-Version
          in: header
          required: false
          description: The API version. These pages document version `1`.
          schema:
            type: string
            default: '1'
            enum:
              - '1'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TablesInput'
      responses:
        '200':
          description: |-
            Table extraction result (when async=false or omitted), or the job
            acknowledgement (when async=true). Both are served with status 200.
            When `force_url` was set, the result is the single-use download
            stub instead.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/TablesResponse'
                  - $ref: '#/components/schemas/TablesAcceptedResponse'
                  - $ref: '#/components/schemas/ExtractLargeResultResponse'
        '400':
          description: Invalid request parameters or configuration
        '401':
          description: Authentication failed or missing API key
        '403':
          description: Tables endpoint not enabled for your organization
        '404':
          description: Extraction not found or access denied
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal server error
        '503':
          description: >-
            The tables job could not be recorded; retry. If organization
            retention policy is unavailable, processing and charging have not
            started; retry after the seconds in Retry-After.
          headers:
            Retry-After:
              description: Seconds to wait before retrying a retention-policy refusal.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodedErrorResponse'
components:
  schemas:
    TablesInput:
      type: object
      description: Input for the `/tables` endpoint.
      required:
        - extraction_id
      properties:
        extraction_id:
          type: string
          format: uuid
          description: ID of a completed extraction to extract tables from.
        tables_config:
          description: >-
            Table extraction configuration. If omitted, defaults are used
            (`merge: false`, `table_format: "html"`).
          allOf:
            - $ref: '#/components/schemas/TablesConfig'
        async:
          type: boolean
          default: false
          description: >-
            When true, returns immediately with a job ID. Poll `GET
            /job/{tables_id}` for the result.
    TablesResponse:
      type: object
      description: Result of table extraction.
      required:
        - tables_id
        - tables_output
      properties:
        tables_id:
          type: string
          format: uuid
          description: >-
            Persisted tables version ID. Can be used to retrieve the tables
            result later.
        tables_output:
          type: object
          description: The extracted tables data.
          properties:
            tables:
              type: array
              description: >-
                Array of extracted table objects. Each table includes its
                content, citations, and whether it was derived from a chart.
              items:
                type: object
                properties:
                  table_content:
                    description: >-
                      The table content. When `table_format` is `html`
                      (default), this is an HTML string. When `json`, this is an
                      object with `headers` (array of column names) and `rows`
                      (array of objects keyed by header name).
                  citations:
                    type: array
                    description: >-
                      Bounding box table IDs indicating where this table was
                      found (e.g. "tbl-1"). Merged tables list all source IDs.
                    items:
                      type: string
                  from_chart:
                    type: boolean
                    description: >-
                      Whether this table was extracted from a chart or figure
                      rather than a native table.
        credits_used:
          type: number
          format: float
          nullable: true
          description: >-
            Number of credits consumed by this request. Only present when the
            organization has the credit billing system enabled.
    TablesAcceptedResponse:
      type: object
      description: >-
        Acknowledgement returned when a tables job is submitted for asynchronous
        processing (async=true). Served with status 200. Poll `GET
        /job/{tables_id}` to check status and retrieve results.
      required:
        - tables_id
        - status
        - message
      properties:
        tables_id:
          type: string
          format: uuid
          description: >-
            Identifier assigned to the asynchronous tables job. Poll `GET
            /job/{tables_id}` for progress and results.
        status:
          type: string
          enum:
            - pending
          description: Initial status reported by the server.
        message:
          type: string
          description: Human-readable description of the accepted job.
    ExtractLargeResultResponse:
      type: object
      description: >-
        Returned instead of the full extraction result for large results,
        including documents with 70 or more pages and spreadsheet extractions.
        The `url` field is a single-use download link; fetch it once to retrieve
        the complete `ExtractResultCore` payload. Subsequent requests to the
        same URL return 410 Gone.
      required:
        - is_url
        - url
      properties:
        is_url:
          type: boolean
          description: Always `true` for large document responses.
          enum:
            - true
        url:
          type: string
          description: >-
            Single-use URL to download the full extraction result.  After one
            successful download the resource is deleted and further requests
            return 410 Gone.
        extraction_id:
          type: string
          format: uuid
          description: Extraction identifier (when storage is enabled).
    CodedErrorResponse:
      type: object
      description: A machine-readable request failure.
      additionalProperties: false
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
    TablesConfig:
      type: object
      description: Configuration for table extraction.
      properties:
        merge:
          type: boolean
          default: false
          description: >-
            When true, adjacent tables that appear to be continuations of each
            other are merged into a single table.
        table_format:
          type: string
          default: html
          description: >-
            Output format for table content. `html` returns an HTML `<table>`
            string. `json` returns a structured object with `headers` (array of
            column names) and `rows` (array of objects keyed by header name).
          enum:
            - html
            - json
        charts_to_tables:
          type: boolean
          default: false
          description: >-
            Convert figures and charts into tables using LLM processing.
            Resulting tables have `from_chart: true` in the response.
    ErrorBody:
      type: object
      additionalProperties: false
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: >-
            Stable machine-readable error code, e.g. `REQ_002`. Safe to branch
            on.
        message:
          type: string
          description: Human-readable description of what went wrong.
        details:
          type: object
          additionalProperties: true
          description: >-
            Additional context for the error when available, such as the
            offending field. Absent when there is nothing to add.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      x-fern-header:
        name: apiKey
        env: PULSE_API_KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.