Skip to Content
Docs are evolving — expect frequent updates.
CompanySearch Companies

Search Companies

Search for companies across your portfolio using keywords with pagination support.

Endpoint

GET https://api.kruncher.ai/api/integration/project/search

Headers

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

Query Parameters

ParameterTypeRequiredDescription
keywordsstringYesSearch terms to filter projects (space-separated, supports partial matching)
pageintegerNoPage 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

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

CODE
{
  "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

CODE
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

CODE
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

CODE
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

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

CODE
{
  "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

FieldTypeDescription
dataarrayArray of matching project objects
namestringProject name
companyNamestringCompany name
companyWebsitestringCompany website
processingstringProcessing status
projectstatusobjectProject status details
projectphaseobjectProject phase details
projectscoresarrayScore data

Pagination Fields

FieldTypeDescription
pageintegerCurrent page number (0-indexed)
totalCountintegerTotal matching results
pageSizeintegerResults per page (fixed)
nextPagebooleanWhether more pages exist

Error Responses

400 Bad Request - Missing Keywords

CODE
{
  "metadata": {
    "code": "1001",
    "title": "Bad Request",
    "description": "keywords parameter is required"
  }
}

No Results

CODE
{
  "metadata": {
    "code": "1000",
    "title": "Successful",
    "description": ""
  },
  "data": {
    "data": [],
    "pagination": {
      "page": 0,
      "totalCount": 0,
      "pageSize": 20,
      "nextPage": false
    }
  }
}

Common Patterns

CODE
async function findProjects(keywords) {
  const result = await searchProjects(keywords);
  return result.data.data;
}
 
// Usage
const projects = await findProjects("market");

Pattern 2: Paginated Results

CODE
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

CODE
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 nextPage to determine if more results exist
  • Use totalCount to estimate completion

Performance

  • Batch multiple searches if possible
  • Cache search results with TTL
  • Implement rate limiting on client side

Error Handling

Handling No Results

CODE
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

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

Troubleshooting

No Results Found

  • Verify keyword spelling
  • Try partial keywords
  • Try broader search terms

Pagination Issues

  • Verify page number is valid (0-indexed)
  • Check nextPage value 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