curl --request POST \
--url https://api.spidra.io/api/parse/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"urls": [
"https://arxiv.org/pdf/1706.03762"
],
"fileIds": [
"0b007010-b3f6-4398-a3ba-e5c2518839c8"
],
"maxPages": 1
}
'import requests
url = "https://api.spidra.io/api/parse/batch"
payload = {
"urls": ["https://arxiv.org/pdf/1706.03762"],
"fileIds": ["0b007010-b3f6-4398-a3ba-e5c2518839c8"],
"maxPages": 1
}
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({
urls: ['https://arxiv.org/pdf/1706.03762'],
fileIds: ['0b007010-b3f6-4398-a3ba-e5c2518839c8'],
maxPages: 1
})
};
fetch('https://api.spidra.io/api/parse/batch', 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.spidra.io/api/parse/batch",
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([
'urls' => [
'https://arxiv.org/pdf/1706.03762'
],
'fileIds' => [
'0b007010-b3f6-4398-a3ba-e5c2518839c8'
],
'maxPages' => 1
]),
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.spidra.io/api/parse/batch"
payload := strings.NewReader("{\n \"urls\": [\n \"https://arxiv.org/pdf/1706.03762\"\n ],\n \"fileIds\": [\n \"0b007010-b3f6-4398-a3ba-e5c2518839c8\"\n ],\n \"maxPages\": 1\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.spidra.io/api/parse/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://arxiv.org/pdf/1706.03762\"\n ],\n \"fileIds\": [\n \"0b007010-b3f6-4398-a3ba-e5c2518839c8\"\n ],\n \"maxPages\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spidra.io/api/parse/batch")
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 \"urls\": [\n \"https://arxiv.org/pdf/1706.03762\"\n ],\n \"fileIds\": [\n \"0b007010-b3f6-4398-a3ba-e5c2518839c8\"\n ],\n \"maxPages\": 1\n}"
response = http.request(request)
puts response.read_body{
"status": "estimate",
"documents": [
{
"status": "estimate",
"fileId": "614b6cf9-baab-440a-a1d8-422ce676bb5d",
"fileName": "1706.03762",
"format": "PDF",
"totalPages": 15,
"pagesToParse": 2,
"credits": 2
}
],
"credits": 2
}Parse a batch
Parses up to 50 documents in one request, mixing uploads, links and fileIds, and returns a batchId straight away. Each document becomes its own parse job with the same options. Poll Get a parse batch for progress, or each document’s jobId at Get a parse job.
Send uploads as files parts in a multipart request, links in urls and stored documents in fileIds. In a multipart request, send urls and fileIds as JSON array strings.
Each document is checked and charged on its own. One that can’t be fetched or read, or that your remaining credits can’t cover, comes back in documents with status: "failed" and an error, and the others still run. With dryRun: true you get an estimate for every document and a total, and nothing is parsed.
Credits: 1 per page parsed for each document, plus AI credits when you send a prompt or schema. Failed documents cost nothing.
Rate limits: 60 parse requests a minute, shared with POST /parse.
curl --request POST \
--url https://api.spidra.io/api/parse/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"urls": [
"https://arxiv.org/pdf/1706.03762"
],
"fileIds": [
"0b007010-b3f6-4398-a3ba-e5c2518839c8"
],
"maxPages": 1
}
'import requests
url = "https://api.spidra.io/api/parse/batch"
payload = {
"urls": ["https://arxiv.org/pdf/1706.03762"],
"fileIds": ["0b007010-b3f6-4398-a3ba-e5c2518839c8"],
"maxPages": 1
}
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({
urls: ['https://arxiv.org/pdf/1706.03762'],
fileIds: ['0b007010-b3f6-4398-a3ba-e5c2518839c8'],
maxPages: 1
})
};
fetch('https://api.spidra.io/api/parse/batch', 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.spidra.io/api/parse/batch",
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([
'urls' => [
'https://arxiv.org/pdf/1706.03762'
],
'fileIds' => [
'0b007010-b3f6-4398-a3ba-e5c2518839c8'
],
'maxPages' => 1
]),
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.spidra.io/api/parse/batch"
payload := strings.NewReader("{\n \"urls\": [\n \"https://arxiv.org/pdf/1706.03762\"\n ],\n \"fileIds\": [\n \"0b007010-b3f6-4398-a3ba-e5c2518839c8\"\n ],\n \"maxPages\": 1\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.spidra.io/api/parse/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://arxiv.org/pdf/1706.03762\"\n ],\n \"fileIds\": [\n \"0b007010-b3f6-4398-a3ba-e5c2518839c8\"\n ],\n \"maxPages\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spidra.io/api/parse/batch")
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 \"urls\": [\n \"https://arxiv.org/pdf/1706.03762\"\n ],\n \"fileIds\": [\n \"0b007010-b3f6-4398-a3ba-e5c2518839c8\"\n ],\n \"maxPages\": 1\n}"
response = http.request(request)
puts response.read_body{
"status": "estimate",
"documents": [
{
"status": "estimate",
"fileId": "614b6cf9-baab-440a-a1d8-422ce676bb5d",
"fileName": "1706.03762",
"format": "PDF",
"totalPages": 15,
"pagesToParse": 2,
"credits": 2
}
],
"credits": 2
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
How to parse a document. The same options apply to POST /parse and to every document in POST /parse/batch.
Links to documents.
["https://arxiv.org/pdf/1706.03762"]
The fileIds of documents you parsed, estimated or uploaded in the last 24 hours.
["0b007010-b3f6-4398-a3ba-e5c2518839c8"]
How pages are read.
auto: reads each page's text, and uses AI only on pages that are scans or images.fast: reads text only. Scanned pages come back empty with anerrorand aren't charged.ocr: reads every page with AI. Slower, and best for scans and handwriting.
auto, fast, ocr PDF pages to parse, as pages and ranges separated by commas. "10-" means page 10 to the end. Pages past the end are skipped. Other formats ignore this and are parsed whole, with a warning.
500"1-5,9"
Parse at most this many pages, counted from the start of pages (or of the document). PDFs only.
x >= 13
Adds pages to the result, with each page's Markdown on its own. perPage is accepted as another name for this field. Only applies when the result comes back inline; when polling, use ?pages=true instead.
Puts a <!-- page N --> line before each page in markdown.
What to extract from the document, in plain English, such as "The paper's title and the authors' names". The answer is in json. Costs AI credits on top of the page credits.
5000A JSON Schema for the extracted data. The answer is in json and follows this shape. Can be sent with or without a prompt. In a multipart request, send it as a JSON string.
Returns the page count and the credits the parse would cost, without parsing or charging anything. The document is still stored, so you can parse it next with the returned fileId.
Waits up to 20 seconds for the result and returns it inline. Set to false to get a job to poll straight away. POST /parse only; a batch never waits.
Response
dryRun was true. Each document's estimate and the total credits. Nothing was parsed or charged.
Was this page helpful?

