← APIs / Extract Text from PDF API
Verified

Extract Text from PDF API

ApyHubby ApyHub · Developer Tools

Extract text from PDFs with the Extract Text from PDF API. Preserve paragraphs and formatting while automating content extraction.

dataapi
Price per request
$0.02
Base URL
https://gateway.apiosk.com/apyhub-extractor-pdf-text
Technical Specs
Auth MethodapiKey
Response FormatJSON
Endpoints2
Endpoints
MethodPathDescriptionCost
POST /extract/text/pdf-file 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.
$0.02 default
View details
POST /extract/text/pdf-url Extracts text from a PDF located at a remote URL and returns the extracted content as a string. You can optionally limit the extraction to a page range and define coordinate bounds for the extracted area.
$0.02 default
View details
Endpoint documentation
POST/extract/text/pdf-file
$0.02 default
Description

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.

Documentation

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.

Pricing
$0.02 default
Authentication

Pay per request through Apiosk using x402. Do not send an apy-token; the gateway injects the selected APYHub key server-side.

Request schema
{
  "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"
}
Response schema
{
  "properties": {
    "data": {
      "example": "Chapter 1. Sample PDF text content extracted from the document.",
      "type": "string"
    }
  },
  "required": [
    "data"
  ],
  "type": "object"
}
Headers
{
  "properties": {
    "PAYMENT-SIGNATURE": {
      "description": "Signed x402 v2 payment proof. Obtain the payment requirements from the initial HTTP 402 response.",
      "type": "string"
    }
  },
  "required": [],
  "type": "object"
}
Example request
{
  "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
}
Example response
{
  "data": "Chapter 1. Sample PDF text content extracted from the document."
}
POST/extract/text/pdf-url
$0.02 default
Description

Extracts text from a PDF located at a remote URL and returns the extracted content as a string. You can optionally limit the extraction to a page range and define coordinate bounds for the extracted area.

Documentation

submit url: extracted data

**Method:** POST
**Apiosk URL:** https://gateway.apiosk.com/apyhub-extractor-pdf-text/extract/text/pdf-url
**Request content type:** application/json
**Response content type:** application/json

What it does

Extracts text from a PDF located at a remote URL and returns the extracted content as a string. You can optionally limit the extraction to a page range and define coordinate bounds for the extracted area.

Request Body

| Parameter | Type | Mandatory | Description |
| --------- | ------ | --------- | ---------------------------------------------- |
| url | String | Yes | Remote PDF URL. Must be a valid URI. |
| end_page | Integer | No | Last page to extract from. Default: 0. Minimum: 0. |
| start_page | Integer | No | First page to extract from. Default: 1. Minimum: 1. |
| ending_x_coordinate | Integer | No | Ending X coordinate for text extraction bounds. Default: 0. Range: 0 to 100. |
| ending_y_coordinate | Integer | No | Ending Y coordinate for text extraction bounds. Default: 0. Range: 0 to 100. |
| preserve_paragraphs | Boolean | No | Preserves paragraph breaks in the extracted text. Default: false. |
| starting_x_coordinate | Integer | No | Starting X coordinate for text extraction bounds. Default: 0. Range: 0 to 100. |
| starting_y_coordinate | Integer | No | Starting Y coordinate for text extraction bounds. Default: 0. Range: 0 to 100. |

Response

Returns a JSON object with a data string field containing the extracted text. Success responses are represented as a JSON object shaped like { data: string }.

| Parameter | Type | Mandatory | Description |
| --------- | ------ | --------- | ---------------------------------------------- |
| data | String | Yes | Extracted text content from the PDF. |

Quickstart

Extract text from a PDF by sending its URL in a minimal JSON request.

bash
curl -X POST "https://gateway.apiosk.com/apyhub-extractor-pdf-text/extract/text/pdf-url" \
-H "PAYMENT-SIGNATURE: $PAYMENT_SIGNATURE" \
-H "Content-Type: application/json" \
-d '{"url":"https://assets.apyhub.com/samples/sample.pdf"}'

What you'll get back

Returns a JSON object with a data string field containing the extracted text from the PDF.

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.

Pricing
$0.02 default
Authentication

Pay per request through Apiosk using x402. Do not send an apy-token; the gateway injects the selected APYHub key server-side.

Request schema
{
  "properties": {
    "end_page": {
      "default": 0,
      "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"
    },
    "preserve_paragraphs": {
      "default": false,
      "type": "boolean"
    },
    "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"
    },
    "url": {
      "example": "https://assets.apyhub.com/samples/sample.pdf",
      "format": "uri",
      "type": "string"
    }
  },
  "required": [
    "url"
  ],
  "type": "object"
}
Response schema
{
  "properties": {
    "data": {
      "example": "Chapter 1. Sample PDF text content extracted from the document.",
      "type": "string"
    }
  },
  "required": [
    "data"
  ],
  "type": "object"
}
Headers
{
  "properties": {
    "PAYMENT-SIGNATURE": {
      "description": "Signed x402 v2 payment proof. Obtain the payment requirements from the initial HTTP 402 response.",
      "type": "string"
    }
  },
  "required": [],
  "type": "object"
}
Example request
{
  "end_page": 0,
  "ending_x_coordinate": 0,
  "ending_y_coordinate": 0,
  "preserve_paragraphs": false,
  "start_page": 1,
  "starting_x_coordinate": 0,
  "starting_y_coordinate": 0,
  "url": "https://assets.apyhub.com/samples/sample.pdf"
}
Example response
{
  "data": "Chapter 1. Sample PDF text content extracted from the document."
}