API Documentation
We're building a public API so you can integrate PDFSub's AI-powered document processing into your applications. Join the waitlist to get early access.
Quick Start
Authentication
All API requests require authentication via session cookie or API key.
Rate Limits
Business plan: 1,000 AI operations per month. Check usage via /api/user/ai-usage.
Security
All requests use HTTPS. Document data is never stored or used for training.
Example Request
curl -X POST https://pdfsub.com/api/pdf/summarize \
-H "Content-Type: application/json" \
-H "Cookie: better-auth.session_token=YOUR_SESSION" \
-d '{
"text": "Your document text here...",
"summaryType": "brief"
}'API Endpoints
AI Document Analysis
/api/pdf/summarizeGenerate AI summaries of document text
Request Body
{
"text": "Document text content",
"summaryType": "brief | detailed | standard"
}Response
{
"success": true,
"summary": "Generated summary text",
"tokensUsed": {
"input": 100,
"output": 50,
"total": 150
}
}/api/pdf/chatAsk questions about a document
Request Body
{
"documentText": "Document text content",
"question": "Your question about the document",
"conversationHistory": [
{
"role": "user",
"content": "Previous question"
},
{
"role": "assistant",
"content": "Previous answer"
}
]
}Response
{
"success": true,
"answer": "AI response to your question",
"tokensUsed": {
"input": 200,
"output": 100,
"total": 300
}
}/api/pdf/translateTranslate document text to another language
Request Body
{
"text": "Document text content",
"targetLanguage": "Spanish",
"sourceLanguage": "English (optional)",
"preserveFormatting": true
}Response
{
"success": true,
"translatedText": "Translated content",
"sourceLanguage": "English",
"targetLanguage": "Spanish",
"tokensUsed": {
"input": 100,
"output": 120,
"total": 220
}
}Data Extraction
/api/pdf/extract-dataExtract structured data from documents
Request Body
{
"documentText": "Document text content",
"extractionType": "auto | contacts | tables | dates | amounts | custom",
"customFields": [
"field1",
"field2"
]
}Response
{
"success": true,
"extractedData": {},
"tokensUsed": {
"input": 150,
"output": 80,
"total": 230
}
}/api/pdf/invoice-extractorExtract data from invoices
Request Body
{
"documentText": "Invoice text content"
}Response
{
"success": true,
"invoiceData": {
"vendor": "Company Name",
"invoiceNumber": "INV-001",
"date": "2026-01-15",
"dueDate": "2026-02-15",
"subtotal": 1000,
"tax": 100,
"total": 1100,
"lineItems": []
},
"tokensUsed": {
"input": 200,
"output": 150,
"total": 350
}
}/api/pdf/receipt-scannerExtract data from receipts
Request Body
{
"documentText": "Receipt text content"
}Response
{
"success": true,
"receiptData": {
"merchant": "Store Name",
"date": "2026-01-15",
"total": 45.99,
"items": []
},
"tokensUsed": {
"input": 100,
"output": 80,
"total": 180
}
}/api/pdf/bank-statementExtract transactions from bank statements using AI
Request Body
{
"documentText": "Bank statement text content",
"bankName": "Chase (optional)",
"accountType": "Checking (optional)"
}Response
{
"success": true,
"transactions": [
{
"date": "2026-01-15",
"description": "Purchase",
"amount": -50,
"balance": 1000,
"type": "debit"
}
],
"accountInfo": {
"accountNumber": "1234",
"statementPeriod": "Jan 2026"
},
"transactionCount": 25,
"tokensUsed": {
"input": 500,
"output": 400,
"total": 900
}
}Usage & Limits
/api/user/ai-usageGet your current AI operation usage
Response
{
"success": true,
"usage": {
"used": 45,
"limit": 1000,
"remaining": 955,
"resetAt": "2026-02-01T00:00:00.000Z",
"operations": [
{
"type": "summarize",
"count": 20,
"lastUsed": "2026-01-31T12:00:00Z"
},
{
"type": "chat",
"count": 15,
"lastUsed": "2026-01-31T11:30:00Z"
}
]
}
}Error Handling
Invalid or missing authentication. Ensure you're logged in or using a valid API key.
You've exceeded your monthly AI operation limit. Response includes remaining limit and reset date.
{
"error": "Monthly limit reached",
"remaining": 0,
"limit": 1000,
"resetAt": "2026-02-01T00:00:00.000Z"
}AI service is temporarily unavailable. Retry after a short delay.
Interested in API Access?
The PDFSub API is coming soon. Join the waitlist and we'll notify you when it's available.
Join the Waitlist