0

Food Delivery Search

by
Published Oct 17, 2025

This endpoint returns a list of businesses which support requested transaction type. **Note:** * At this time, the API does not return businesses without any reviews. * Currently, this endpoint only supports food delivery in the US.

Script yelp Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Yelp = {
3
  apiKey: string;
4
};
5
/**
6
 * Food Delivery Search
7
 * This endpoint returns a list of businesses which support requested transaction type.
8

9
**Note:**
10
* At this time, the API does not return businesses without any reviews.
11
* Currently, this endpoint only supports food delivery in the US.
12

13
 */
14
export async function main(
15
  auth: Yelp,
16
  transaction_type: "delivery" = "delivery",
17
  latitude: string | undefined,
18
  longitude: string | undefined,
19
  location: string | undefined,
20
  term: string | undefined,
21
  categories: string | undefined,
22
  price: string | undefined,
23
) {
24
  const url = new URL(
25
    `https://api.yelp.com/v3/transactions/${transaction_type}/search`,
26
  );
27
  for (const [k, v] of [
28
    ["latitude", latitude],
29
    ["longitude", longitude],
30
    ["location", location],
31
    ["term", term],
32
    ["categories", categories],
33
    ["price", price],
34
  ]) {
35
    if (v !== undefined && v !== "" && k !== undefined) {
36
      url.searchParams.append(k, v);
37
    }
38
  }
39
  const response = await fetch(url, {
40
    method: "GET",
41
    headers: {
42
      Authorization: "Bearer " + auth.apiKey,
43
    },
44
    body: undefined,
45
  });
46
  if (!response.ok) {
47
    const text = await response.text();
48
    throw new Error(`${response.status} ${text}`);
49
  }
50
  return await response.json();
51
}
52