Prepare a Large Upload
curl --request POST \
--url https://api.spidra.io/api/parse/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"size": 123
}
'import requests
url = "https://api.spidra.io/api/parse/uploads"
payload = {
"fileName": "<string>",
"size": 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({fileName: '<string>', size: 123})
};
fetch('https://api.spidra.io/api/parse/uploads', 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/uploads",
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([
'fileName' => '<string>',
'size' => 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.spidra.io/api/parse/uploads"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"size\": 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.spidra.io/api/parse/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\",\n \"size\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spidra.io/api/parse/uploads")
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 \"fileName\": \"<string>\",\n \"size\": 123\n}"
response = http.request(request)
puts response.read_body{
"fileId": "<string>",
"uploadUrl": "<string>",
"method": "PUT",
"expiresIn": 123
}{
"status": "error",
"message": "<string>"
}{
"status": "error",
"message": "<string>"
}Parse Endpoints
Upload Large Files
Upload files up to 500 MB for parsing with a prepared upload URL, and delete uploaded files.
POST
/
parse
/
uploads
Prepare a Large Upload
curl --request POST \
--url https://api.spidra.io/api/parse/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"size": 123
}
'import requests
url = "https://api.spidra.io/api/parse/uploads"
payload = {
"fileName": "<string>",
"size": 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({fileName: '<string>', size: 123})
};
fetch('https://api.spidra.io/api/parse/uploads', 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/uploads",
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([
'fileName' => '<string>',
'size' => 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.spidra.io/api/parse/uploads"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"size\": 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.spidra.io/api/parse/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\",\n \"size\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spidra.io/api/parse/uploads")
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 \"fileName\": \"<string>\",\n \"size\": 123\n}"
response = http.request(request)
puts response.read_body{
"fileId": "<string>",
"uploadUrl": "<string>",
"method": "PUT",
"expiresIn": 123
}{
"status": "error",
"message": "<string>"
}{
"status": "error",
"message": "<string>"
}Direct uploads to POST /parse take up to 50 MB. For files up to 500 MB:
Parsing a
POST /api/parse/uploadswith{ "fileName": "annual-report.pdf", "size": 182345678 }. The response has afileIdand anuploadUrl.PUTthe file’s bytes touploadUrlwithin 15 minutes. No API key is needed for this request.- Parse it with
POST /api/parseand{ "fileId": "..." }, plus any options.
curl -X POST https://api.spidra.io/api/parse/uploads \
-H "Authorization: Bearer $SPIDRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"fileName": "annual-report.pdf", "size": 182345678}'
curl -X PUT --upload-file annual-report.pdf "<uploadUrl>"
curl -X POST https://api.spidra.io/api/parse \
-H "Authorization: Bearer $SPIDRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"fileId": "<fileId>", "pages": "1-50"}'
fileId before the file has been uploaded returns 409.
Reusing and deleting files
Every uploaded or linked document gets afileId, valid for 24 hours, so you can parse it again with other pages or another prompt without sending it again. After 24 hours it is deleted.
Delete an uploaded file
DELETE /api/parse/files/{fileId} deletes it now.
{ "status": "deleted", "fileId": "deb20323-e511-44e8-b88b-72f52a2defa0" }
Authorizations
BearerAuthApiKeyAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Was this page helpful?

