//native
type TheirStack = {
apiKey: string
}
/**
* Search Companies
* This endpoint lets you search for companies filtering them by company attributes, technology attributes, and jobs attributes.
*/
export async function main(
auth: TheirStack,
format: 'json' | 'csv' | undefined,
body: {
expand_technology_slugs?: string[]
order_by?: {
desc?: false | true
field:
| 'name'
| 'num_jobs'
| 'num_jobs_last_30_days'
| 'num_jobs_found'
| 'employee_count'
| 'alexa_ranking'
| 'founded_year'
| 'annual_revenue_usd'
| 'total_funding_usd'
| 'last_funding_round_date'
| 'confidence'
| 'jobs'
| 'first_date_found'
}[]
offset?: number
page?: number
limit?: number
company_description_pattern_or?: string[]
company_description_pattern_not?: string[]
company_description_pattern_accent_insensitive?: false | true
min_revenue_usd?: number
max_revenue_usd?: number
min_employee_count?: number
max_employee_count?: number
min_employee_count_or_null?: number
max_employee_count_or_null?: number
min_funding_usd?: number
max_funding_usd?: number
funding_stage_or?: string[]
industry_or?: string[]
industry_not?: string[]
industry_id_or?: number[]
industry_id_not?: number[]
company_tags_or?: string[]
company_type?: 'recruiting_agency' | 'direct_employer' | 'all'
company_investors_or?: string[]
company_investors_partial_match_or?: string[]
company_technology_slug_or?: string[]
company_technology_slug_and?: string[]
company_technology_slug_not?: string[]
only_yc_companies?: false | true
company_location_pattern_or?: string[]
company_country_code_or?: string[]
company_country_code_not?: string[]
company_list_id_or?: number[]
company_list_id_not?: number[]
company_linkedin_url_exists?: false | true
revealed_company_data?: false | true
last_funding_round_date_lte?: string
last_funding_round_date_gte?: string
company_name_or?: string[]
company_name_case_insensitive_or?: string[]
company_id_or?: string[]
company_domain_or?: string[]
company_domain_not?: string[]
company_name_not?: string[]
company_name_partial_match_or?: string[]
company_name_partial_match_not?: string[]
company_linkedin_url_or?: string[]
include_total_results?: false | true
blur_company_data?: false | true
job_filters?: {
job_title_or?: string[]
job_title_not?: string[]
job_title_pattern_and?: string[]
job_title_pattern_or?: string[]
job_title_pattern_not?: string[]
job_country_code_or?: string[]
job_country_code_not?: string[]
posted_at_max_age_days?: number
posted_at_gte?: string
posted_at_lte?: string
discovered_at_max_age_days?: number
discovered_at_min_age_days?: number
discovered_at_gte?: string
discovered_at_lte?: string
job_description_pattern_or?: string[]
job_description_pattern_not?: string[]
job_description_pattern_is_case_insensitive?: false | true
remote?: false | true
only_jobs_with_reports_to?: false | true
reports_to_exists?: false | true
final_url_exists?: false | true
only_jobs_with_hiring_managers?: false | true
hiring_managers_exists?: false | true
job_id_or?: number[]
job_id_not?: number[]
job_ids?: number[]
job_seniority_or?: 'c_level' | 'staff' | 'senior' | 'junior' | 'mid_level'[]
min_salary_usd?: number
max_salary_usd?: number
job_technology_slug_or?: string[]
job_technology_slug_not?: string[]
job_technology_slug_and?: string[]
job_location_pattern_or?: string[]
job_location_pattern_not?: string[]
scraper_name_pattern_or?: string[]
easy_apply?: false | true
}
tech_filters?: {
technology_slug_or?: string[]
technology_category_slug_or?: string[]
technology_parent_category_slug_or?: string[]
max_rank?: number
min_jobs?: number
max_jobs?: number
min_relative_occurrence?: number
first_date_found_gte?: string
first_date_found_lte?: string
last_date_found_gte?: string
last_date_found_lte?: string
confidence_or?: 'low' | 'medium' | 'high'[]
}
}
) {
const url = new URL(`https://api.theirstack.com/v1/companies/search`)
for (const [k, v] of [['format', format]]) {
if (v !== undefined && v !== '' && k !== undefined) {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago