Update Analysis
Update specific entity values within an existing analysis. Use this endpoint to refine analysis data, correct information, or add missing details.
Endpoint
PUT https://api.kruncher.ai/api/integration/analysis/detail
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Your API key (format: YOUR_API_KEY) |
Content-Type | Yes | Must be application/json |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
analysisId | string | Yes | The ID of the analysis to update |
entityKey | string | Yes | The entity field name to update (e.g., email, revenue, stage) |
value | any | Yes | The new value for the entity (type depends on entity) |
Common Entity Keys
| Entity Key | Value Type | Example | Description |
|---|---|---|---|
email | string | "contact@company.com" | Company contact email |
revenue | number | 5000000 | Annual revenue in USD |
stage | string | "seriesA" | Company stage |
industry | array | ["Software", "SaaS"] | Industry classifications |
employees | number | 50 | Employee count |
website | string | "https://company.com" | Company website |
description | string | "AI-powered analytics" | Company description |
fundingRaised | number | 10000000 | Total funding raised |
valuation | number | 50000000 | Company valuation |
Code Examples
JavaScript/TypeScript
Basic
const API_KEY = "YOUR_API_KEY_HERE";
const response = await fetch("https://api.kruncher.ai/api/integration/analysis/detail", {
method: "PUT",
headers: {
"Authorization": `${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
analysisId: "analysis_123",
entityKey: "email",
value: "contact@techstartup.com"
})
});
const result = await response.json();
console.log("Update result:", result);Result: Updates the email entity for the specified analysis.
Python
Basic
import requests
API_KEY = "YOUR_API_KEY_HERE"
url = "https://api.kruncher.ai/api/integration/analysis/detail"
headers = {
"Authorization": f"{API_KEY}",
"Content-Type": "application/json"
}
data = {
"analysisId": "analysis_123",
"entityKey": "email",
"value": "contact@techstartup.com"
}
response = requests.put(url, headers=headers, json=data)
if response.status_code == 200:
print("Update successful:", response.json())
else:
print(f"Error: {response.status_code} {response.text}")Result: Updates a single entity value.
cURL
Basic
curl -X PUT "https://api.kruncher.ai/api/integration/analysis/detail" \
-H "Authorization: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"analysisId": "analysis_123",
"entityKey": "email",
"value": "contact@techstartup.com"
}'Response
Success Response (200 OK)
{
"code": "1000",
"title": "Success",
"description": "Entity updated successfully",
"data": {
"analysisId": "analysis_123",
"entityKey": "email",
"value": "contact@techstartup.com",
"updatedAt": "2024-01-15T10:30:00Z"
}
}Error Responses
400 Bad Request
{
"code": "4000",
"title": "Bad Request",
"description": "Invalid entity key or value"
}404 Not Found
{
"code": "4040",
"title": "Not Found",
"description": "Analysis not found"
}401 Unauthorized
{
"code": "4010",
"title": "Unauthorized",
"description": "Invalid or missing API key"
}Common Entity Updates
Update Contact Information
// Update email
await api.updateEntity("analysis_123", "email", "contact@company.com");
// Update website
await api.updateEntity("analysis_123", "website", "https://company.com");Update Financial Data
// Update revenue
await api.updateEntity("analysis_123", "revenue", 5000000);
// Update funding raised
await api.updateEntity("analysis_123", "fundingRaised", 10000000);
// Update valuation
await api.updateEntity("analysis_123", "valuation", 50000000);Update Company Details
// Update stage
await api.updateEntity("analysis_123", "stage", "seriesA");
// Update employee count
await api.updateEntity("analysis_123", "employees", 50);
// Update industry
await api.updateEntity("analysis_123", "industry", ["Software", "SaaS"]);Validation Rules
- Must be valid email format
- Example:
contact@company.com
Revenue, Funding, Valuation
- Must be non-negative numbers
- Specified in USD
- Example:
5000000(for $5M)
Website
- Must be valid URL with protocol
- Example:
https://company.com
Stage
- Must match valid stages:
preSeed,seed,seriesA,seriesB,seriesC,growth,ipo
Industry
- Can be string or array of strings
- Example:
["Software", "SaaS", "B2B"]
Employees
- Must be non-negative integer
- Example:
50
Best Practices
Data Validation
- Always validate data before sending
- Check for correct data types
- Ensure values are within expected ranges
Error Handling
- Wrap updates in try-catch blocks
- Log failed updates for review
- Consider retry logic for transient failures
Batch Updates
- When updating multiple entities, process sequentially
- Track successful and failed updates
- Don’t stop on first error unless critical
Performance
- Batch related updates together
- Avoid unnecessary updates (check if value changed)
- Use appropriate rate limiting
Example Workflows
Workflow 1: Update After Data Collection
# After collecting data from a company
company_data = collect_company_data() # Your data collection function
# Update analysis with new data
api = KruncherAnalysisAPI()
results = api.update_from_dict("analysis_123", {
"email": company_data["contact_email"],
"revenue": company_data["annual_revenue"],
"employees": company_data["team_size"],
"fundingRaised": company_data["total_funding"]
})
# Check results
summary = api.get_update_summary(results)
if summary['failed'] > 0:
print(f"Warning: {summary['failed']} updates failed")Workflow 2: Correct Analysis Data
// Fix incorrect data in analysis
const corrections = [
{ entityKey: "email", value: "correct@email.com" },
{ entityKey: "revenue", value: 7500000 }, // Corrected from 5M to 7.5M
{ entityKey: "stage", value: "seriesB" } // Updated from seriesA
];
const api = new KruncherAnalysisAPI(API_KEY);
const results = await api.updateMultiple("analysis_123", corrections);
console.log(`Corrected ${results.successful.length} fields`);Workflow 3: Enrich Analysis
# Enrich analysis with additional data
enrichment_data = {
"website": "https://techstartup.com",
"description": "AI-powered analytics platform for investors",
"industry": ["Software", "SaaS", "FinTech"],
"valuation": 75000000
}
api = KruncherAnalysisAPI()
results = api.update_from_dict("analysis_123", enrichment_data, validate=True)
print(f"Enriched analysis with {len(results)} fields")Related Endpoints
- Create Company - Create a new company with analysis
- Find Companies - Retrieve companies and analyses
- Analysis - Get detailed analysis results
- Upload Files - Upload documents for analysis
Troubleshooting
Update Not Reflecting
- Check that you’re using the correct
analysisId - Verify the
entityKeyis spelled correctly - Ensure the value type matches the entity requirements
Validation Errors
- Check value format (especially for email, website)
- Ensure numbers are positive where required
- Verify stage/status values match accepted values
Performance Issues
- Reduce batch size if updates are timing out
- Add delays between updates if rate limited
- Consider updating only changed values
Need Help?
- Unknown entity keys? Check the Data Model documentation
- Validation failing? Review the validation rules above
- Bulk updates? Contact support for batch update options
Last updated on