Skip to Content
Docs are evolving — expect frequent updates.
CompanyUpdate Criteria

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

HeaderRequiredDescription
AuthorizationYesYour API key (format: YOUR_API_KEY)
Content-TypeYesMust be application/json

Request Body

FieldTypeRequiredDescription
projectIdstringYesUnique identifier for the project
projectscoreIdstringYesUnique identifier for the project score
postanalysisoutputIdstringYesUnique identifier for the post-analysis output
criteriaSelectedCodestringYesCode representing the selected criteria
criteriaSelectedNamestringYesDisplay name of the selected criteria

Getting Required IDs

To get the required IDs (projectscoreId and postanalysisoutputId):

  1. Retrieve the project using the Find Companies endpoint
  2. Extract IDs from the response:
    • projectscoreId from projectScores[0].id
    • postanalysisoutputId from the analysis output data
    • projectId is returned when you create the project

Common Criteria Codes

CodeNameCategory
advertisingandmarketingAdvertising & MarketingIndustry
saasSaaSBusiness Model
b2bB2BBusiness Model
b2cB2CBusiness Model
fintechFinTechIndustry
healthtechHealthTechIndustry
ecommerceE-commerceIndustry
enterpriseEnterprise SoftwareIndustry
aiArtificial IntelligenceTechnology
blockchainBlockchainTechnology

Note: Get the complete list of available criteria codes using the Config endpoint.

Code Examples

JavaScript/TypeScript

CODE
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

CODE
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

CODE
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
{
  "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
{
  "code": "4000",
  "title": "Bad Request",
  "description": "Invalid project ID or criteria code"
}

404 Not Found

CODE
{
  "code": "4040",
  "title": "Not Found",
  "description": "Project or score not found"
}

Complete Workflow

Step-by-Step: Update Criteria for a New Project

CODE
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

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

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

CODE
# 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 projectscoreId and postanalysisoutputId
  • 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

Troubleshooting

”Project score ID not found”

  • Ensure the project has been analyzed
  • Check that projectScores array 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