OCR extraction
curl --request POST \
--url https://api.pdfbase.dev/v1/extract/ocr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"pages": "<string>",
"language": "<string>",
"format": "<string>",
"dpi": 123
}
'import requests
url = "https://api.pdfbase.dev/v1/extract/ocr"
payload = {
"source": {},
"pages": "<string>",
"language": "<string>",
"format": "<string>",
"dpi": 123
}
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>',
language: '<string>',
format: '<string>',
dpi: 123
})
};
fetch('https://api.pdfbase.dev/v1/extract/ocr', 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/ocr",
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>',
'language' => '<string>',
'format' => '<string>',
'dpi' => 123
]),
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/ocr"
payload := strings.NewReader("{\n \"source\": {},\n \"pages\": \"<string>\",\n \"language\": \"<string>\",\n \"format\": \"<string>\",\n \"dpi\": 123\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/ocr")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"pages\": \"<string>\",\n \"language\": \"<string>\",\n \"format\": \"<string>\",\n \"dpi\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/extract/ocr")
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 \"language\": \"<string>\",\n \"format\": \"<string>\",\n \"dpi\": 123\n}"
response = http.request(request)
puts response.read_body{
"confidence": 123
}Extract
OCR extraction
Extract text from scanned documents and images using OCR.
POST
/
v1
/
extract
/
ocr
OCR extraction
curl --request POST \
--url https://api.pdfbase.dev/v1/extract/ocr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"pages": "<string>",
"language": "<string>",
"format": "<string>",
"dpi": 123
}
'import requests
url = "https://api.pdfbase.dev/v1/extract/ocr"
payload = {
"source": {},
"pages": "<string>",
"language": "<string>",
"format": "<string>",
"dpi": 123
}
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>',
language: '<string>',
format: '<string>',
dpi: 123
})
};
fetch('https://api.pdfbase.dev/v1/extract/ocr', 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/ocr",
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>',
'language' => '<string>',
'format' => '<string>',
'dpi' => 123
]),
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/ocr"
payload := strings.NewReader("{\n \"source\": {},\n \"pages\": \"<string>\",\n \"language\": \"<string>\",\n \"format\": \"<string>\",\n \"dpi\": 123\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/ocr")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"pages\": \"<string>\",\n \"language\": \"<string>\",\n \"format\": \"<string>\",\n \"dpi\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/extract/ocr")
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 \"language\": \"<string>\",\n \"format\": \"<string>\",\n \"dpi\": 123\n}"
response = http.request(request)
puts response.read_body{
"confidence": 123
}Phase
Phase 3 — Ships only if $1K+ MRR. Requires Tesseract infrastructure.Request
object
required
The PDF to OCR. Same source options as other endpoints.
string
default:"all"
Pages to process. OCR is computationally expensive — scope to needed pages.
string
default:"eng"
OCR language. Supports Tesseract language codes:
eng, fra, deu, spa, por, ita, jpn, kor, chi_sim, chi_tra, hin, ara.string
default:"text"
text, markdown, or structured. Same as text extraction.integer
default:"300"
Resolution for page-to-image conversion before OCR. Higher = more accurate, slower. Range: 150-600.
Response
Same shape as text extraction, with additional OCR-specific fields:{
"id": "ext_ocr1",
"object": "extraction",
"status": "completed",
"format": "text",
"method": "ocr",
"language": "eng",
"pages_extracted": 3,
"content": "Extracted text from scanned document...",
"confidence": 0.94,
"created_at": "2026-05-19T13:05:00Z"
}
number
Average OCR confidence score across all pages. Range: 0.0 to 1.0. Below 0.7 indicates poor scan quality.
Example
curl -X POST https://api.pdfbase.dev/v1/extract/ocr \
-H "Authorization: Bearer pk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"source": { "url": "https://example.com/scanned-contract.pdf" },
"language": "eng",
"dpi": 300,
"format": "structured"
}'