0
Get Company Details By Domain
One script reply has been approved by the moderators Verified

Returns detailed information about any company domain.

Created by hugo697 54 days ago Viewed 14 times
0
Submitted by hugo697 Typescript (fetch-only)
Verified 54 days ago
1
type Abstractapi = {
2
	apiKey: string
3
}
4

5
export async function main(resource: Abstractapi, domain: string) {
6
	const queryParams = new URLSearchParams({
7
		api_key: resource.apiKey,
8
		domain
9
	})
10

11
	const endpoint = `https://companyenrichment.abstractapi.com/v2?${queryParams.toString()}`
12

13
	const response = await fetch(endpoint, {
14
		method: 'GET'
15
	})
16

17
	if (!response.ok) {
18
		throw new Error(`HTTP error! status: ${response.status}`)
19
	}
20

21
	const data = await response.json()
22

23
	return data
24
}
25