/extract/text/pdf-fileUploads a PDF file and extracts text from it. You can optionally limit extraction to a page range and a coordinate bounding box, and control whether paragraphs are preserved in the extracted text.
upload file: extracted data
**Method:** POST
**Apiosk URL:** https://gateway.apiosk.com/apyhub-extractor-pdf-text/extract/text/pdf-file
**Request content type:** multipart/form-data
**Response content type:** application/json
What it does
Uploads a PDF file and extracts text from it. You can optionally limit extraction to a page range and a coordinate bounding box, and control whether paragraphs are preserved in the extracted text.
Request Body
| Parameter | Type | Mandatory | Description |
| --------- | ---- | --------- | ----------- |
| file | String | Yes | PDF file (.pdf). Binary upload. |
| end_page | Integer | No | Last page to extract. 0 means all pages. Default: 0. |
| start_page | Integer | No | First page to extract. Default: 1. |
| ending_x_coordinate | Integer | No | Ending X coordinate for extraction bounds. Minimum 0, maximum 100. Default: 0. |
| ending_y_coordinate | Integer | No | Ending Y coordinate for extraction bounds. Minimum 0, maximum 100. Default: 0. |
| preserve_paragraphs | ENUM | No | Whether to preserve paragraphs in the extracted text. Allowed values: true, false. Default: false. |
| starting_x_coordinate | Integer | No | Starting X coordinate for extraction bounds. Minimum 0, maximum 100. Default: 0. |
| starting_y_coordinate | Integer | No | Starting Y coordinate for extraction bounds. Minimum 0, maximum 100. Default: 0. |
Response
Returns a JSON object with a data string field containing the extracted text from the PDF.
| Parameter | Type | Mandatory | Description |
| --------- | ---- | --------- | ----------- |
| data | String | Yes | Extracted text content from the uploaded PDF file. |
Quickstart
Upload a PDF file to extract its text.
bash
curl -X POST "https://gateway.apiosk.com/apyhub-extractor-pdf-text/extract/text/pdf-file" \
-H "PAYMENT-SIGNATURE: $PAYMENT_SIGNATURE" \
-F "file=@/path/to/document.pdf"
What you'll get back
Returns a JSON object with a data string field containing the extracted PDF text.
json
{
"data": "Chapter 1. Sample PDF text content extracted from the document."
}
Payment and authentication
Do not send an apy-token. Apiosk injects the APYHub credential server-side. The first unpaid request returns HTTP 402 Payment Required with a PAYMENT-REQUIRED header. Sign an accepted USDC payment and retry the same request with the proof in PAYMENT-SIGNATURE (or use an Apiosk/x402-aware agent client that performs this exchange automatically).
The $PAYMENT_SIGNATURE placeholder in the example is the signed proof obtained from that initial 402 response.
Source
Parameter definitions and limits were synchronized from [APYHub's official documentation](https://apyhub.com/apyhub/service/extract-text-from-pdf) on 2026-07-18.
Pay per request through Apiosk using x402. Do not send an apy-token; the gateway injects the selected APYHub key server-side.
{
"properties": {
"end_page": {
"default": 0,
"description": "Last page (0 = all pages).",
"minimum": 0,
"type": "integer"
},
"ending_x_coordinate": {
"default": 0,
"maximum": 100,
"minimum": 0,
"type": "integer"
},
"ending_y_coordinate": {
"default": 0,
"maximum": 100,
"minimum": 0,
"type": "integer"
},
"file": {
"description": "PDF file (.pdf).",
"format": "binary",
"type": "string"
},
"preserve_paragraphs": {
"default": "false",
"enum": [
"true",
"false"
],
"type": "string"
},
"start_page": {
"default": 1,
"minimum": 1,
"type": "integer"
},
"starting_x_coordinate": {
"default": 0,
"maximum": 100,
"minimum": 0,
"type": "integer"
},
"starting_y_coordinate": {
"default": 0,
"maximum": 100,
"minimum": 0,
"type": "integer"
}
},
"required": [
"file"
],
"type": "object"
}{
"properties": {
"data": {
"example": "Chapter 1. Sample PDF text content extracted from the document.",
"type": "string"
}
},
"required": [
"data"
],
"type": "object"
}{
"properties": {
"PAYMENT-SIGNATURE": {
"description": "Signed x402 v2 payment proof. Obtain the payment requirements from the initial HTTP 402 response.",
"type": "string"
}
},
"required": [],
"type": "object"
}{
"end_page": 0,
"ending_x_coordinate": 0,
"ending_y_coordinate": 0,
"file": "@/path/to/document.pdf",
"preserve_paragraphs": "false",
"start_page": 1,
"starting_x_coordinate": 0,
"starting_y_coordinate": 0
}{
"data": "Chapter 1. Sample PDF text content extracted from the document."
}