Error Handling
The Docspeed customer API uses standard HTTP status codes with structured error bodies.
Common statuses
400invalid request shape or unsupported input combination401missing or invalid bearer token402insufficient credits422policy or validation failure429rate limit exceeded502provider execution failure503temporary unavailability
cURL
curl -sS -X POST "https://api.docspeed.ai/v1/extract" \
-H "Authorization: Bearer ${DOCSPEED_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"input": {"text": "not a PDF or image"}, "execution_mode": "sync"}'
Python
import requests
response = requests.post(
"https://api.docspeed.ai/v1/extract",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={"input": {"text": "not a PDF or image"}, "execution_mode": "sync"},
timeout=120,
)
if not response.ok:
print(response.status_code, response.json())
TypeScript
const response = await fetch("https://api.docspeed.ai/v1/extract", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
input: { text: "not a PDF or image" },
execution_mode: "sync",
}),
});
if (!response.ok) {
console.error(response.status, await response.json());
}
Example error body
{
"detail": {
"code": "invalid_input",
"message": "Schema-based extraction currently requires an image or PDF input.",
"details": null
}
}