Skip to Content
Docs are evolving — expect frequent updates.
CompanyUpload Files

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

HeaderRequiredDescription
AuthorizationYesYour API key (format: YOUR_API_KEY)
analysisidYesThe 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

CODE
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

CODE
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

CODE
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
{
  "code": "1000",
  "title": "Success",
  "description": "Files uploaded successfully",
  "data": {
    "filesUploaded": 3,
    "analysisId": "analysis_123",
    "status": "processing"
  }
}

Error Response (400 Bad Request)

CODE
{
  "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-data by your HTTP client
  • Field Name: Use files for 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

  1. Create a company using the Create Company endpoint
  2. Get the analysis ID from the creation response
  3. Upload files using this endpoint with the analysisId
  4. Wait for processing to complete (typically 1-5 minutes)
  5. Retrieve results using the Analysis endpoints

Example: Complete Flow

CODE
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)

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