Search Companies
Search for companies across your portfolio using keywords with pagination support.
Endpoint
GET https://api.kruncher.ai/api/integration/project/search
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Your API key (format: YOUR_API_KEY) |
Content-Type | No | Optional application/json |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
keywords | string | Yes | Search terms to filter projects (space-separated, supports partial matching) |
page | integer | No | Page number for pagination (defaults to 0, zero-indexed). Page size is fixed. |
Use Cases
- Portfolio Search: Find specific projects in your portfolio
- Quick Lookup: Search by company name or project identifier
- Bulk Review: Paginate through search results
- Reporting: Extract project data for analysis
- Integration: Sync projects with external systems
Quick Start
cURL
# Basic search
curl -X GET "https://api.kruncher.ai/api/integration/project/search?keywords=tesla" \
-H "Authorization: YOUR_API_KEY_HERE"
# Search with pagination
curl -X GET "https://api.kruncher.ai/api/integration/project/search?keywords=tech&page=1" \
-H "Authorization: YOUR_API_KEY_HERE"Response:
{
"metadata": {
"code": "1000",
"title": "Successful",
"description": ""
},
"data": {
"data": [
{
"name": "Tesla Energy",
"companyName": "Tesla Inc",
"companyWebsite": "https://tesla.com",
"companyIndustry": "Energy",
"processing": "completed",
"projectstatus": { "name": "Active", "code": "active" },
"projectphase": { "name": "Due Diligence", "code": "dueDiligence" },
"projectscores": [{ "status": "done", "scoreText": "Strong Fit", "score": 8.5 }]
}
],
"pagination": {
"page": 0,
"totalCount": 2,
"pageSize": 20,
"nextPage": false
}
}
}Code Examples
JavaScript/Node.js
const API_KEY = "YOUR_API_KEY_HERE";
const BASE_URL = "https://api.kruncher.ai/api";
async function searchProjects(keywords, page = 0) {
const params = new URLSearchParams({ keywords, page });
const response = await fetch(
`${BASE_URL}/integration/project/search?${params}`,
{
method: "GET",
headers: {
"Authorization": `${API_KEY}`,
"Content-Type": "application/json"
}
}
);
if (!response.ok) {
throw new Error(`Search failed: ${response.statusText}`);
}
return await response.json();
}
// Usage - basic search
async function main() {
try {
const result = await searchProjects("tesla");
console.log(`Found ${result.data.pagination.totalCount} projects`);
result.data.data.forEach(project => {
console.log(`- ${project.name} (${project.companyName})`);
});
} catch (error) {
console.error("Error:", error.message);
}
}
main();Advanced Search with Pagination
class ProjectSearch {
constructor(apiKey, baseUrl = "https://api.kruncher.ai/api") {
this.apiKey = apiKey;
this.baseUrl = baseUrl;
}
async search(keywords, page = 0) {
if (!keywords) {
throw new Error("keywords parameter is required");
}
const params = new URLSearchParams({ keywords, page });
const response = await fetch(
`${this.baseUrl}/integration/project/search?${params}`,
{
method: "GET",
headers: {
"Authorization": `${this.apiKey}`,
"Content-Type": "application/json"
}
}
);
if (!response.ok) {
throw new Error(`Search failed: ${response.statusText}`);
}
return await response.json();
}
async searchAll(keywords) {
const allResults = [];
let page = 0;
let hasMore = true;
while (hasMore) {
const result = await this.search(keywords, page);
allResults.push(...result.data.data);
hasMore = result.data.pagination.nextPage;
page++;
}
return allResults;
}
}
// Usage
async function advancedSearch() {
const search = new ProjectSearch("YOUR_API_KEY_HERE");
try {
const result = await search.search("Tesla");
console.log(`Found ${result.data.pagination.totalCount} projects`);
result.data.data.forEach(project => {
console.log(`- ${project.name} (${project.companyName})`);
});
const all = await search.searchAll("market");
console.log(`Total market-related projects: ${all.length}`);
} catch (error) {
console.error("Error:", error.message);
}
}
advancedSearch();Python
import requests
from typing import Dict
API_KEY = "YOUR_API_KEY_HERE"
BASE_URL = "https://api.kruncher.ai/api"
def search_projects(keywords: str, page: int = 0) -> Dict:
"""Search for projects by keywords."""
headers = {
"Authorization": f"{API_KEY}",
"Content-Type": "application/json"
}
params = {
"keywords": keywords,
"page": page
}
response = requests.get(
f"{BASE_URL}/integration/project/search",
params=params,
headers=headers
)
response.raise_for_status()
return response.json()
# Usage
def main():
try:
result = search_projects("tesla")
total = result['data']['pagination']['totalCount']
print(f"Found {total} projects")
for project in result['data']['data']:
print(f" - {project['name']} ({project['companyName']})")
except Exception as error:
print(f"Error: {error}")
if __name__ == "__main__":
main()Python - Advanced Search Manager
import requests
from typing import Dict, List
API_KEY = "YOUR_API_KEY_HERE"
BASE_URL = "https://api.kruncher.ai/api"
class ProjectSearchManager:
"""Manage project search with pagination."""
def __init__(self, api_key: str = API_KEY):
self.session = requests.Session()
self.session.headers.update({
"Authorization": f"{api_key}",
"Content-Type": "application/json"
})
def search(self, keywords: str, page: int = 0) -> Dict:
"""Search companies by keywords."""
response = self.session.get(
f"{BASE_URL}/integration/project/search",
params={"keywords": keywords, "page": page}
)
response.raise_for_status()
return response.json()
def search_all(self, keywords: str) -> List[Dict]:
"""Get all results by paginating automatically."""
all_results = []
page = 0
has_more = True
while has_more:
result = self.search(keywords=keywords, page=page)
all_results.extend(result['data']['data'])
has_more = result['data']['pagination']['nextPage']
page += 1
return all_results
# Usage
def main():
manager = ProjectSearchManager()
try:
result = manager.search("Tesla")
total = result['data']['pagination']['totalCount']
print(f"Found {total} projects")
for project in result['data']['data']:
print(f" - {project['name']} ({project['companyName']})")
all_projects = manager.search_all("market")
print(f"Total market-related projects: {len(all_projects)}")
except Exception as error:
print(f"Error: {error}")
if __name__ == "__main__":
main()Response Structure
Success Response (200 OK)
{
"metadata": {
"code": "1000",
"title": "Successful",
"description": ""
},
"data": {
"data": [
{
"name": "Tesla Energy",
"companyName": "Tesla Inc",
"companyWebsite": "https://tesla.com",
"companyIndustry": "Energy",
"processing": "completed",
"projectstatus": { "name": "Active", "code": "active" },
"projectphase": { "name": "Due Diligence", "code": "dueDiligence" },
"projectscores": [{ "status": "done", "scoreText": "Strong Fit", "score": 8.5 }]
}
],
"pagination": {
"page": 0,
"totalCount": 42,
"pageSize": 20,
"nextPage": true
}
}
}Response Fields
| Field | Type | Description |
|---|---|---|
data | array | Array of matching project objects |
name | string | Project name |
companyName | string | Company name |
companyWebsite | string | Company website |
processing | string | Processing status |
projectstatus | object | Project status details |
projectphase | object | Project phase details |
projectscores | array | Score data |
Pagination Fields
| Field | Type | Description |
|---|---|---|
page | integer | Current page number (0-indexed) |
totalCount | integer | Total matching results |
pageSize | integer | Results per page (fixed) |
nextPage | boolean | Whether more pages exist |
Error Responses
400 Bad Request - Missing Keywords
{
"metadata": {
"code": "1001",
"title": "Bad Request",
"description": "keywords parameter is required"
}
}No Results
{
"metadata": {
"code": "1000",
"title": "Successful",
"description": ""
},
"data": {
"data": [],
"pagination": {
"page": 0,
"totalCount": 0,
"pageSize": 20,
"nextPage": false
}
}
}Common Patterns
Pattern 1: Simple Search
async function findProjects(keywords) {
const result = await searchProjects(keywords);
return result.data.data;
}
// Usage
const projects = await findProjects("market");Pattern 2: Paginated Results
async function getAllResults(keywords) {
const allResults = [];
let page = 0;
let hasMore = true;
while (hasMore) {
const result = await searchProjects(keywords, page);
allResults.push(...result.data.data);
hasMore = result.data.pagination.nextPage;
page++;
}
return allResults;
}Pattern 3: Search with Result Processing
def search_and_display(keywords: str):
"""Search and display results with company details."""
manager = ProjectSearchManager()
result = manager.search(keywords)
for project in result['data']['data']:
status = project.get('projectstatus', {}).get('name', 'Unknown')
phase = project.get('projectphase', {}).get('name', 'Unknown')
print(f" {project['name']} ({project['companyName']}) - {status} / {phase}")Search Tips
Keyword Matching
- Partial matching: “tes” will match “Tesla”
- Multiple keywords: “market tech” searches for both
Best Practices
Search Strategy
- Start with broad keywords, then narrow down
- Use partial keywords for wider matches
- Implement caching for repeated searches
Pagination
- Use auto-pagination to collect all results across pages
- Check
nextPageto determine if more results exist - Use
totalCountto estimate completion
Performance
- Batch multiple searches if possible
- Cache search results with TTL
- Implement rate limiting on client side
Error Handling
Handling No Results
async function safeSearch(keywords) {
try {
const result = await searchProjects(keywords);
if (result.data.data.length === 0) {
console.log("No projects found. Try different keywords.");
return [];
}
return result.data.data;
} catch (error) {
console.error("Search failed:", error.message);
return [];
}
}Handling Pagination
def get_all_results_safely(keywords, max_pages=50):
"""Get all results with safety limits."""
manager = ProjectSearchManager()
all_results = []
page = 0
while page < max_pages:
try:
result = manager.search(keywords, page=page)
all_results.extend(result['data']['data'])
if not result['data']['pagination']['nextPage']:
break
page += 1
except Exception as error:
print(f"Error on page {page}: {error}")
break
return all_resultsRelated Endpoints
- Get Project Details - View full project information
- List Projects - Get all projects
- Change Stage - Move projects through pipeline stages
- Add Comment - Add project notes
Troubleshooting
No Results Found
- Verify keyword spelling
- Try partial keywords
- Try broader search terms
Pagination Issues
- Verify page number is valid (0-indexed)
- Check
nextPagevalue to determine if more results exist - Use automatic pagination helper
Slow Searches
- Try shorter or more specific keywords
- Check API status page
Need Help?
- Can’t find a project? Try List Projects for complete list
- Want project details? Use Get Project Details
- Need all results? Use automatic pagination to collect all pages
Last updated on