0

Get Prospect

by
Published today

Retrieves a single prospect by its ID.

Script outreach Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 4 hours ago
1
//native
2

3
/**
4
 * Get Prospect
5
 * Retrieves a single prospect by its ID.
6
 */
7
export async function main(auth: RT.Outreach, prospect_id: number) {
8
  const response = await fetch(
9
    `https://api.outreach.io/api/v2/prospects/${prospect_id}`,
10
    {
11
      headers: {
12
        Authorization: `Bearer ${auth.token}`,
13
        Accept: "application/vnd.api+json",
14
      },
15
    }
16
  )
17

18
  if (!response.ok) {
19
    throw new Error(`${response.status} ${await response.text()}`)
20
  }
21

22
  return await response.json()
23
}
24