---
title: "Extract Document Pages"
method: POST
path: "/documents/pages"
tags: ["Documents"]
---

# Extract Document Pages

`POST /documents/pages`

Extract specific pages from a document (PDF, PowerPoint, or Word) as base64-encoded images or URLs.
When output_format="url", pages that fail URL generation fall back to base64 data URIs (mixed output possible).

## Headers

- `authorization` string, nullable

## Request body

- DocumentPagesRequest — Request model for extracting pages from a document
  - `document_id` string, required — ID of the document to extract pages from
  - `start_page` integer, required — Starting page number (1-indexed)
  - `end_page` integer, required — Ending page number (1-indexed)
  - `output_format` 'base64' | 'url', nullable — How to return page images: base64 (default) or url

## Response `200`

Successful Response

- DocumentPagesResponse — Response for document pages extraction endpoint
  - `document_id` string, required
  - `pages` string[], required
  - `start_page` integer, required
  - `end_page` integer, required
  - `total_pages` integer, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/morphik-org/apis/fastapi.md) · [All operations](https://skmtc.net/morphik-org/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/morphik-org/fastapi/versions/2d9291c3821d/schema)
