serp·base API Documentation

OCR: PDF document

Text from a PDF — up to 10 pages per request.

$20.00 / 1,000 POST /v1/query x402 · USDC on Base

Overview

Single endpoint, predictable JSON. Send POST /v1/query with the tool field set to ocr_pdf.

curl -X POST https://api.serp-base.com/v1/query \
  -H "Content-Type: application/json" \
  -d '{"tool": "ocr_pdf"}'

Parameters

FieldTypeRequiredDescriptionExample
Fields: pdf (base64), pages — see the request example below. Send tool plus these fields.

Code examples

cURL

curl -X POST https://api.serp-base.com/v1/query \
  -H "Content-Type: application/json" \
  -d '{"tool": "ocr_pdf"}'

Python

import requests

r = requests.post("https://api.serp-base.com/v1/query", json={
  "tool": "ocr_pdf"
})
print(r.json()["data"])

JavaScript

const r = await fetch('https://api.serp-base.com/v1/query', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "tool": "ocr_pdf"
})
});
const { data } = await r.json();

PHP

$ch = curl_init('https://api.serp-base.com/v1/query');
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
  CURLOPT_POSTFIELDS => '{"tool": "ocr_pdf"}',
  CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);

Response

{
  "ok": true,
  "data": {}
}

Payment

Pay per request with USDC on Base via the x402 protocol. Gas is paid by the facilitator — you only need USDC in your wallet.

No payment is taken when a service fails. We run the work first and settle afterwards.

Errors

CodeMeaningAction
402Payment requiredSign the payment and retry with X-PAYMENT
400Bad parametersCheck required fields above
422Data could not be producedNothing charged — retry later
429Rate limitedBack off and retry
503Tool temporarily unavailableRetry later — nothing charged

Related tools

OCR: text from document

Proxy routing

Requests to the target site never leave from our infrastructure address. Each call is routed through a proxy: your own if you set one, a proxy you buy from us, or our system proxy which is included and needs no setup. Set your own once with POST /v1/proxy/own, or buy a dedicated IPv4 by country and period via POST /v1/proxy/buy. See Proxies.

Pay-per-request data APIs. Built for agents and developers.