Upload Files to Analysis
Upload one or more files to an existing analysis for automatic processing by the Kruncher.ai analysis engine. Supports common document formats including PDF, DOCX, PPTX, and more.
Endpoint
POST https://api.kruncher.ai/api/integrationfiles/upload
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Your API key (format: YOUR_API_KEY) |
analysisid | Yes | The analysis ID returned when creating the project |
Supported File Formats
- PDF (.pdf) - Pitch decks, reports, financial statements
- Word (.docx, .doc) - Business plans, memos
- PowerPoint (.pptx, .ppt) - Presentations, decks
- Excel (.xlsx, .xls) - Financial models, data sheets
- Text (.txt, .md) - Plain text documents
Request Format
Files must be sent as multipart/form-data with the field name files. You can upload multiple files in a single request by repeating the files field.
Code Examples
Python
Single File
import requests
API_KEY = "YOUR_API_KEY_HERE"
ANALYSIS_ID = "analysis_123"
url = "https://api.kruncher.ai/api/integrationfiles/upload"
headers = {
"Authorization": f"{API_KEY}",
"analysisid": ANALYSIS_ID
}
# Upload a single file
with open("pitch-deck.pdf", "rb") as file:
files = [("files", ("pitch-deck.pdf", file))]
response = requests.post(url, headers=headers, files=files)
print(f"Status: {response.status_code}")
print(f"Response: {response.text}")Result: Single file uploaded and queued for analysis.
JavaScript/Node.js
Single File
const fs = require('fs');
const FormData = require('form-data');
const fetch = require('node-fetch');
const API_KEY = "YOUR_API_KEY_HERE";
const ANALYSIS_ID = "analysis_123";
const form = new FormData();
form.append('files', fs.createReadStream('pitch-deck.pdf'));
const response = await fetch('https://api.kruncher.ai/api/integrationfiles/upload', {
method: 'POST',
headers: {
'Authorization': `${API_KEY}`,
'analysisid': ANALYSIS_ID,
...form.getHeaders()
},
body: form
});
const result = await response.json();
console.log('Upload result:', result);Result: Single file uploaded using FormData.
cURL
Single File
curl -X POST "https://api.kruncher.ai/api/integrationfiles/upload" \
-H "Authorization: YOUR_API_KEY_HERE" \
-H "analysisid: analysis_123" \
-F "files=@pitch-deck.pdf"Response
Success Response (200 OK)
{
"code": "1000",
"title": "Success",
"description": "Files uploaded successfully",
"data": {
"filesUploaded": 3,
"analysisId": "analysis_123",
"status": "processing"
}
}Error Response (400 Bad Request)
{
"code": "4000",
"title": "Bad Request",
"description": "Invalid analysis ID or missing files"
}Important Notes
Request Format
- Method: Must use
POST(not PUT or other methods) - Content-Type: Automatically set to
multipart/form-databy your HTTP client - Field Name: Use
filesfor all file uploads (can be repeated)
File Handling
- Multiple files can be uploaded in a single request
- Each file is added with the same field name:
files - Processing starts automatically after upload
- Files are processed asynchronously
Best Practices
- Close file handles after upload (especially in Python)
- Validate file paths before uploading
- Handle errors gracefully
- Check file size limits (contact support for large files)
Typical Workflow
- Create a company using the Create Company endpoint
- Get the analysis ID from the creation response
- Upload files using this endpoint with the
analysisId - Wait for processing to complete (typically 1-5 minutes)
- Retrieve results using the Analysis endpoints
Example: Complete Flow
import requests
API_KEY = "YOUR_API_KEY_HERE"
BASE_URL = "https://api.kruncher.ai/api"
# Step 1: Create company
create_response = requests.post(
f"{BASE_URL}/integration/project",
headers={
"Authorization": f"{API_KEY}",
"Content-Type": "application/json"
},
json={
"name": "TechStartup",
"companyName": "TechStartup Inc.",
"companyWebsite": "https://techstartup.com",
"projectType": "projectAnalysisWithFile"
}
)
analysis_id = create_response.json()['analysisId']
# Step 2: Upload files
with open("pitch-deck.pdf", "rb") as file:
files = [("files", ("pitch-deck.pdf", file))]
upload_response = requests.post(
f"{BASE_URL}/integrationfiles/upload",
headers={
"Authorization": f"{API_KEY}",
"analysisid": analysis_id
},
files=files
)
print(f"Upload status: {upload_response.status_code}")
# Step 3: Check analysis status
# (Processing happens automatically in the background)Related Endpoints
- Create Company - Create a company and get an analysis ID
- Retrieve Companies - Get company and analysis data
- Analysis - Access analysis results and insights
Need Help?
- Large files? Contact support for enterprise upload limits
- Unsupported format? Let us know what formats you need
- Upload failing? Check your analysis ID and file permissions
Last updated on