0

Get Industries

by
Published Oct 17, 2025

This endpoint lets you: - List all the industries and their codes - See how many jobs and companies we have per industry - Search for an industry Calls to this endpoint don't cost you credits.

Script their_stack Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type TheirStack = {
3
	apiKey: string
4
}
5
/**
6
 * Get Industries
7
 * This endpoint lets you:
8
- List all the industries and their codes
9
- See how many jobs and companies we have per industry
10
- Search for an industry
11

12
Calls to this endpoint don't cost you credits.
13
 */
14
export async function main(
15
	auth: TheirStack,
16
	industry: string | undefined,
17
	page: string | undefined,
18
	limit: string | undefined
19
) {
20
	const url = new URL(`https://api.theirstack.com/v0/catalog/industries`)
21
	for (const [k, v] of [
22
		['industry', industry],
23
		['page', page],
24
		['limit', limit]
25
	]) {
26
		if (v !== undefined && v !== '' && k !== undefined) {
27
			url.searchParams.append(k, v)
28
		}
29
	}
30
	const response = await fetch(url, {
31
		method: 'GET',
32
		headers: {
33
			Authorization: 'Bearer ' + auth.apiKey
34
		},
35
		body: undefined
36
	})
37
	if (!response.ok) {
38
		const text = await response.text()
39
		throw new Error(`${response.status} ${text}`)
40
	}
41
	return await response.json()
42
}
43