Update Project Criteria
Configure scoring criteria for a project to customize how companies are evaluated and analyzed. Use this endpoint to set industry-specific criteria, update scoring parameters, or refine evaluation metrics.
Endpoint
POST https://api.kruncher.ai/api/integration/project/criteria
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 |
|---|---|---|---|
projectId | string | Yes | Unique identifier for the project |
projectscoreId | string | Yes | Unique identifier for the project score |
postanalysisoutputId | string | Yes | Unique identifier for the post-analysis output |
criteriaSelectedCode | string | Yes | Code representing the selected criteria |
criteriaSelectedName | string | Yes | Display name of the selected criteria |
Getting Required IDs
To get the required IDs (projectscoreId and postanalysisoutputId):
- Retrieve the project using the Find Companies endpoint
- Extract IDs from the response:
projectscoreIdfromprojectScores[0].idpostanalysisoutputIdfrom the analysis output dataprojectIdis returned when you create the project
Common Criteria Codes
| Code | Name | Category |
|---|---|---|
advertisingandmarketing | Advertising & Marketing | Industry |
saas | SaaS | Business Model |
b2b | B2B | Business Model |
b2c | B2C | Business Model |
fintech | FinTech | Industry |
healthtech | HealthTech | Industry |
ecommerce | E-commerce | Industry |
enterprise | Enterprise Software | Industry |
ai | Artificial Intelligence | Technology |
blockchain | Blockchain | Technology |
Note: Get the complete list of available criteria codes using the Config endpoint.
Code Examples
JavaScript/TypeScript
Basic
const API_KEY = "YOUR_API_KEY_HERE";
const response = await fetch("https://api.kruncher.ai/api/integration/project/criteria", {
method: "POST",
headers: {
"Authorization": `${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
projectId: "521a93a6-091d-4943-ba13-7c1a654a14ae",
projectscoreId: "7c904e6a-e797-4b5b-8c28-feaf34b5ac75",
postanalysisoutputId: "8756d0e9-8398-47ba-8d0e-f88ab53c38f3",
criteriaSelectedCode: "advertisingandmarketing",
criteriaSelectedName: "Advertising & Marketing"
})
});
const result = await response.json();
console.log("Criteria updated:", result);Result: Updates the project criteria to “Advertising & Marketing”.
Python
Basic
import requests
API_KEY = "YOUR_API_KEY_HERE"
url = "https://api.kruncher.ai/api/integration/project/criteria"
headers = {
"Authorization": f"{API_KEY}",
"Content-Type": "application/json"
}
data = {
"projectId": "521a93a6-091d-4943-ba13-7c1a654a14ae",
"projectscoreId": "7c904e6a-e797-4b5b-8c28-feaf34b5ac75",
"postanalysisoutputId": "8756d0e9-8398-47ba-8d0e-f88ab53c38f3",
"criteriaSelectedCode": "advertisingandmarketing",
"criteriaSelectedName": "Advertising & Marketing"
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
print("Criteria updated:", response.json())
else:
print(f"Error: {response.status_code} {response.text}")Result: Updates project criteria to “Advertising & Marketing”.
cURL
Basic
curl -X POST "https://api.kruncher.ai/api/integration/project/criteria" \
-H "Authorization: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"projectId": "521a93a6-091d-4943-ba13-7c1a654a14ae",
"projectscoreId": "7c904e6a-e797-4b5b-8c28-feaf34b5ac75",
"postanalysisoutputId": "8756d0e9-8398-47ba-8d0e-f88ab53c38f3",
"criteriaSelectedCode": "advertisingandmarketing",
"criteriaSelectedName": "Advertising & Marketing"
}'Response
Success Response (200 OK)
{
"code": "1000",
"title": "Success",
"description": "Criteria updated successfully",
"data": {
"projectId": "521a93a6-091d-4943-ba13-7c1a654a14ae",
"criteriaCode": "advertisingandmarketing",
"criteriaName": "Advertising & Marketing",
"updatedAt": "2024-01-15T10:30:00Z"
}
}Error Responses
400 Bad Request
{
"code": "4000",
"title": "Bad Request",
"description": "Invalid project ID or criteria code"
}404 Not Found
{
"code": "4040",
"title": "Not Found",
"description": "Project or score not found"
}Complete Workflow
Step-by-Step: Update Criteria for a New Project
const API_KEY = "YOUR_API_KEY_HERE";
const BASE_URL = "https://api.kruncher.ai/api";
// Step 1: Create a project
const createResponse = await fetch(`${BASE_URL}/integration/project`, {
method: "POST",
headers: {
"Authorization": `${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
name: "TechStartup",
companyName: "TechStartup Inc.",
companyWebsite: "https://techstartup.com",
projectType: "projectAnalysisNoFile"
})
});
const { project, analysisId } = await createResponse.json();
const projectId = project.id;
// Step 2: Wait for analysis to complete (or poll for status)
await new Promise(resolve => setTimeout(resolve, 5000));
// Step 3: Get project details to extract IDs
const projectsResponse = await fetch(`${BASE_URL}/integration/projects`, {
headers: {
"Authorization": `${API_KEY}`,
"Content-Type": "application/json"
}
});
const projects = await projectsResponse.json();
const projectData = projects.data.find(p => p.id === projectId);
const projectscoreId = projectData.projectScores[0].id;
const postanalysisoutputId = projectData.analyses[0].outputId;
// Step 4: Update criteria
const criteriaResponse = await fetch(`${BASE_URL}/integration/project/criteria`, {
method: "POST",
headers: {
"Authorization": `${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
projectId,
projectscoreId,
postanalysisoutputId,
criteriaSelectedCode: "saas",
criteriaSelectedName: "SaaS"
})
});
const result = await criteriaResponse.json();
console.log("Criteria updated:", result);Use Cases
Industry-Specific Scoring
# Set criteria based on company industry
industry_criteria_map = {
"Software": {"code": "saas", "name": "SaaS"},
"Finance": {"code": "fintech", "name": "FinTech"},
"Healthcare": {"code": "healthtech", "name": "HealthTech"},
"Retail": {"code": "ecommerce", "name": "E-commerce"}
}
company_industry = "Software"
criteria = industry_criteria_map.get(company_industry)
if criteria:
api.update_criteria(project_id, criteria['code'], criteria['name'])Business Model Based Criteria
// Set criteria based on business model
const businessModelCriteria = {
"b2b": { code: "b2b", name: "B2B" },
"b2c": { code: "b2c", name: "B2C" },
"marketplace": { code: "marketplace", name: "Marketplace" }
};
const companyModel = "b2b";
const criteria = businessModelCriteria[companyModel];
await api.updateCriteria(projectId, criteria.code, criteria.name);Multi-Criteria Update
# Apply multiple criteria tags
criteria_tags = [
{"code": "saas", "name": "SaaS"},
{"code": "b2b", "name": "B2B"},
{"code": "enterprise", "name": "Enterprise Software"}
]
results = api.update_multiple_criteria(project_id, criteria_tags)
print(f"Applied {len([r for r in results if r.success])} criteria tags")Best Practices
Get IDs Programmatically
- Don’t hardcode
projectscoreIdandpostanalysisoutputId - Fetch them from the project data before updating
- Cache IDs if making multiple updates to the same project
Validate Criteria Codes
- Use the Config endpoint to get valid criteria codes
- Validate codes before sending updates
- Handle invalid criteria gracefully
Error Handling
- Check if project has scores and analysis before updating
- Verify IDs exist in project data
- Implement retry logic for transient failures
Performance
- Batch criteria updates when possible
- Cache project IDs to reduce API calls
- Use appropriate delays between updates
Related Endpoints
- Create Company - Create a project to apply criteria to
- Find Companies - Get project data including score and analysis IDs
- Config - Get list of available criteria codes
- Update Analysis - Update other analysis entities
Troubleshooting
”Project score ID not found”
- Ensure the project has been analyzed
- Check that
projectScoresarray is not empty - Verify analysis has completed successfully
”Post-analysis output ID not found”
- Wait for analysis to complete
- Check analysis status in project data
- Ensure project type supports analysis
Invalid Criteria Code
- Use the Config endpoint to get valid codes
- Check for typos in criteria code
- Verify criteria exists in your account settings
Need Help?
- Custom criteria? Contact support to add new criteria types
- Bulk updates? Ask about batch criteria update endpoints
- Integration issues? Check the troubleshooting guide above
Last updated on