Extract text
curl --request POST \
--url https://api.pdfbase.dev/v1/extract/text \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"pages": "<string>",
"format": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/extract/text"
payload = {
"source": {},
"pages": "<string>",
"format": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({source: {}, pages: '<string>', format: '<string>'})
};
fetch('https://api.pdfbase.dev/v1/extract/text', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pdfbase.dev/v1/extract/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
],
'pages' => '<string>',
'format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pdfbase.dev/v1/extract/text"
payload := strings.NewReader("{\n \"source\": {},\n \"pages\": \"<string>\",\n \"format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pdfbase.dev/v1/extract/text")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"pages\": \"<string>\",\n \"format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/extract/text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {},\n \"pages\": \"<string>\",\n \"format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyExtract
Extract text
Extract raw text content from a PDF without OCR.
POST
/
v1
/
extract
/
text
Extract text
curl --request POST \
--url https://api.pdfbase.dev/v1/extract/text \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"pages": "<string>",
"format": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/extract/text"
payload = {
"source": {},
"pages": "<string>",
"format": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({source: {}, pages: '<string>', format: '<string>'})
};
fetch('https://api.pdfbase.dev/v1/extract/text', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pdfbase.dev/v1/extract/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
],
'pages' => '<string>',
'format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pdfbase.dev/v1/extract/text"
payload := strings.NewReader("{\n \"source\": {},\n \"pages\": \"<string>\",\n \"format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pdfbase.dev/v1/extract/text")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"pages\": \"<string>\",\n \"format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/extract/text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {},\n \"pages\": \"<string>\",\n \"format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyPhase
Phase 2 — Text extraction (non-OCR). Uses embedded text layers.Request
object
required
The PDF to extract from. One of:
{ "pdf_id": "pdf_abc123" }{ "url": "https://example.com/doc.pdf" }{ "base64": "JVBERi0x..." }
string
default:"all"
Which pages to extract.
"all", "1-3", "1,3,5".string
default:"text"
Output format:
text— Plain text, pages separated by\n\n---\n\n.markdown— Best-effort markdown conversion (headings, lists, tables).structured— JSON with per-page text, bounding boxes, and reading order.
Response
text format
{
"id": "ext_abc123",
"object": "extraction",
"status": "completed",
"format": "text",
"pages_extracted": 5,
"content": "Page 1 content here...\n\n---\n\nPage 2 content here...",
"word_count": 2450,
"created_at": "2026-05-19T13:00:00Z"
}
structured format
{
"id": "ext_abc123",
"object": "extraction",
"status": "completed",
"format": "structured",
"pages": [
{
"page": 1,
"text": "Full page text...",
"blocks": [
{
"text": "Invoice #001",
"type": "heading",
"bbox": { "x": 50, "y": 50, "width": 200, "height": 30 }
}
]
}
]
}
This endpoint extracts text from the PDF’s text layer. For scanned documents or images, use the OCR endpoint.
Example
curl -X POST https://api.pdfbase.dev/v1/extract/text \
-H "Authorization: Bearer pk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"source": { "pdf_id": "pdf_report" },
"pages": "1-5",
"format": "markdown"
}'