0

Get Lead

by
Published Oct 17, 2025

Returns details for a given Lead ID. Example: To fetch the details for a lead with the ID `jPlz8TM628rzyCRPqrtcvm`, send an [authenticated](https://docs.developer.yelp.com/docs/authorization-code-workflow) GET request to the following URL: https://api.yelp.com/v3/leads/jPlz8TM628rzyCRPqrtcvm A sample response is shown in the example response box on the right under "200 - Lead"

Script yelp Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Yelp = {
3
  apiKey: string;
4
};
5
/**
6
 * Get Lead
7
 * Returns details for a given Lead ID.
8

9
Example:
10
To fetch the details for a lead with the ID `jPlz8TM628rzyCRPqrtcvm`, send an [authenticated](https://docs.developer.yelp.com/docs/authorization-code-workflow) GET request to the following URL:
11
https://api.yelp.com/v3/leads/jPlz8TM628rzyCRPqrtcvm
12

13
A sample response is shown in the example response box on the right under "200 - Lead"
14

15
 */
16
export async function main(auth: Yelp, ID: string) {
17
  const url = new URL(`https://api.yelp.com/v3/leads//${ID}`);
18

19
  const response = await fetch(url, {
20
    method: "GET",
21
    headers: {
22
      Authorization: "Bearer " + auth.apiKey,
23
    },
24
    body: undefined,
25
  });
26
  if (!response.ok) {
27
    const text = await response.text();
28
    throw new Error(`${response.status} ${text}`);
29
  }
30
  return await response.json();
31
}
32