---
title: "PDF Text Extraction"
method: POST
path: "/pdf"
tags: ["Extraction"]
---

# PDF Text Extraction

`POST /pdf`

## Request

- Base URL: `https://api.weblens.dev`
- URL: `https://api.weblens.dev/pdf`
- Auth: API key in header `Payment-Signature`

Extract text and metadata from PDF documents. Supports page-specific extraction and returns structured content. Price: $0.004.

## Request body

- object
  - `url` string, uri, required: The URL to process
  - `pages` number[]: Page numbers to extract (omit for every page)

## Response `200`

Text and metadata out of a PDF, page by page.

- object
  - `url` string
  - `metadata` object: PDF metadata
  - `pages` unknown[]: Array of pages with content
    - unknown
  - `fullText` string: All pages concatenated
  - `extractedAt` string
  - `requestId` string

## Other responses

- `400`: The body failed validation
- `402`: Payment required — x402 v2 protocol. Parse the PAYMENT-REQUIRED response header (base64-encoded JSON), sign the payment with your wallet, then retry the request with the Payment-Signature request header.

---

[API](https://skmtc.dev/weblens/apis/weblens-api.md) · [All operations](https://skmtc.dev/weblens/apis/weblens-api/llms.txt) · [OpenAPI document](https://skmtc.dev/weblens/apis/weblens-api/revisions/63a7e81b6921?raw)
