POST /directory_yellowpages • Credits: 0.01 credits per business returned
Yellow Pages Search finds businesses in the Yellow Pages directory by keyword and location. It returns a JSON object with a data.businesses array. Each business holds a name, a phone number, an address, a website, categories and a rating. One POST call costs 0.01 credits per business returned, which is $0.0002 per business.
What does Yellow Pages Search do?
Local sales teams need the phone number and the website of every business of one type in one city. Yellow Pages Search builds that list from the Yellow Pages business directory at yellowpages.com. Send a business type such as "plumber" and a location such as "Austin, TX". RichAPI runs the directory search, reads the result pages, and returns one object per business. The data source is the public Yellow Pages listing, so the phone number, the address and the categories come from the directory entry. At 0.01 credits per business, Yellow Pages Search is the cheapest per-result endpoint in RichAPI.
Which endpoint does Yellow Pages Search use?
Method:
POSTURL:
https://api.richapi.ai/api/v1/directory_yellowpagesAuthentication:
x-api-keyheaderRequest format: JSON request body
Response: Synchronous JSON object
Data source:
yellowpages.comsearch resultsPages per call: 1 to 10, set by
max_pagesCredits: 0.01 credits per business returned
Yellow Pages Search accepts the POST method only. If you send GET, the API returns 405.
How to send a Yellow Pages Search request
Copy your API key from the RichAPI dashboard.
Set
search_queryto the business type that you want to find, for example"plumber".Set
locationto the city, the state or the ZIP code, for example"Austin, TX".Set
pageto the first result page that you want. The default value is1.Set
max_pagesto the number of result pages to read. The default value is1.Send a
POSTrequest tohttps://api.richapi.ai/api/v1/directory_yellowpages.Send the API key in the
x-api-keyheader.Read the businesses from
data.businessesin the response.
cURL
curl -X POST https://api.richapi.ai/api/v1/directory_yellowpages
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"search_query": "plumber",
"location": "Austin, TX",
"page": 1,
"max_pages": 3
}'
Python
import requests
response = requests.post(
"https://api.richapi.ai/api/v1/directory_yellowpages",
headers={"x-api-key": "YOUR_API_KEY"},
json={
"search_query": "plumber",
"location": "Austin, TX",
"page": 1,
"max_pages": 3,
},
timeout=180,
)
response.raise_for_status()
for business in response.json()["data"]["businesses"]:
print(business["name"], business["phone"], business["website"])
Node.js
const response = await fetch(
"https://api.richapi.ai/api/v1/directory_yellowpages",
{
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
search_query: "plumber",
location: "Austin, TX",
page: 1,
max_pages: 3,
}),
}
);
const result = await response.json();
for (const business of result.data.businesses) {
console.log(business.name, business.phone, business.website);
}
Which parameters does Yellow Pages Search accept?
Parameter | Type | Required | Default | Description |
| string | Yes | none | The business type or the business name to search for, for example |
| string | Yes | none | The city, the state or the ZIP code, for example |
| integer | No |
| The first result page to read. The valid range is 1 to 20. |
| integer | No |
| The number of consecutive result pages to read. The valid range is 1 to 10. |
search_query and location carry no default value. If you omit either one, the API returns 400 with the message Missing required field: search_query or Missing required field: location.
If page falls outside the range 1 to 20, the API returns 400 with the message page must be between 1 and 20. If max_pages falls outside the range 1 to 10, the API returns 400 with the message max_pages must be between 1 and 10.
Yellow Pages Search rejects every parameter name that is not in the table above. An unknown name returns 400 with the message Unknown input field(s), and the response lists the accepted names in supported_fields.
CAUTION: Do not send query or cache in the request body. The API rejects both names with 400 and charges no credits.
How do I read more Yellow Pages results with max_pages?
max_pages is the volume control for Yellow Pages Search. One call reads the result pages from page up to page + max_pages - 1. A call with page: 1 and max_pages: 3 reads pages 1, 2 and 3. The response holds every business from the three pages in one data.businesses array.
|
| Result pages read |
1 | 1 | 1 |
1 | 3 | 1, 2, 3 |
1 | 10 | 1 to 10 |
4 | 2 | 4, 5 |
When a result page holds no business, Yellow Pages Search stops early. The response then holds the businesses from the earlier pages only. To walk a large city in several calls, raise page by the max_pages value of the previous call.
What does Yellow Pages Search return?
Yellow Pages Search returns a JSON object with a data block and a meta block. This example shows a response for the search "plumber" in Austin, TX.
{
"data": {
"businesses": [
{
"name": "Radiant Plumbing & Air Conditioning",
"phone": "(512) 263-9988",
"address": "3600 S Congress Ave, Austin, TX 78704",
"website": "https://radiantplumbing.com",
"categories": [
"Plumbers",
"Air Conditioning Service & Repair",
"Water Heaters"
],
"rating": "4.7"
},
{
"name": "Reliant Plumbing",
"phone": "(512) 271-4000",
"address": "9701 Dessau Rd Ste 501, Austin, TX 78754",
"website": "https://reliantplumbing.com",
"categories": [
"Plumbers",
"Plumbing-Drain & Sewer Cleaning"
],
"rating": "4.9"
},
{
"name": "Daniel's Plumbing & Air Conditioning",
"phone": "(512) 520-0056",
"address": "5602 Blue Bluff Rd, Austin, TX 78724",
"website": "",
"categories": [
"Plumbers"
],
"rating": ""
}
]
},
"meta": {
"cache_hit": false,
"execution_time_ms": 8412,
"quality_warning": null
}
}
The third business in the example holds an empty website value and an empty rating value. Yellow Pages Search always returns all six business keys. When the directory entry carries no value for a field, the value is an empty string or an empty array.
Which fields does each Yellow Pages business hold?
Field | Type | Description |
| array of objects | One object per business in the Yellow Pages results. When the search matches no business, the array is empty. |
| string | The business name on the directory listing, for example |
| string | The public phone number, for example |
| string | The street address line, for example |
| string | The website URL from the listing. When the listing holds no website, the value is an empty string. |
| array of strings | Every Yellow Pages category of the business, for example |
| string | The star rating as text, for example |
| boolean | The value is |
| integer | The run time of the call in milliseconds, for example |
| string or null | The value is |
How much does Yellow Pages Search cost?
Yellow Pages Search costs 0.01 credits per business returned. There is no base charge per call. At $0.02 a credit, the rate on the 1,000 and 5,000 credit packs, one business costs $0.0002. Larger packs cost less per credit. A call that returns 100 businesses costs 100 x 0.01 = 1 credit. That is $0.02.
Cost of one call, by the number of businesses returned:
Businesses returned | Credits | Cost |
0 | 0 | $0.00 |
1 | 0.01 | $0.0002 |
10 | 0.1 | $0.002 |
50 | 0.5 | $0.01 |
100 | 1 | $0.02 |
500 | 5 | $0.10 |
1,000 | 10 | $0.20 |
Cost of a lead list, across many calls:
Calls | Businesses per call | Businesses | Credits | Cost |
10 | 100 | 1,000 | 10 | $0.20 |
50 | 100 | 5,000 | 50 | $1.00 |
100 | 100 | 10,000 | 100 | $2.00 |
500 | 200 | 100,000 | 1,000 | $20.00 |
Before the call, RichAPI reserves 10 x max_pages x 0.01 credits against the organization's credit balance. A call with max_pages: 3 reserves 0.3 credits. After the call, RichAPI charges 0.01 credits for each business in the response and releases the rest of the reservation. A call that returns zero businesses costs zero credits.
When do I use Yellow Pages Search instead of Google Maps Places (Keyword)?
Yellow Pages Search and Google Maps Places (Keyword) API both return local businesses by keyword and location. Yellow Pages Search costs 0.01 credits per business. Google Maps Places (Keyword) costs 0.1 credits per business. Yellow Pages Search is ten times cheaper for the same kind of record.
Detail | Yellow Pages Search | Google Maps Places (Keyword) |
Credits per business | 0.01 | 0.1 |
Cost per business | $0.0002 | $0.002 |
Cost of 10,000 businesses | 100 credits, $2.00 | 1,000 credits, $20.00 |
Data source |
| Google Maps place listings |
Coverage | United States businesses | Worldwide businesses |
Volume control |
|
|
Rating data | star rating | star rating and review count |
Location detail | one address line | street, city, state and country code |
Place identifier | none | Google place ID inside |
Use Yellow Pages Search for bulk United States local lead generation. The cost per business is $0.0002, so a 100,000-record list costs $20.00. Use Google Maps Places (Keyword) for a business outside the United States. Use it also for the review count, the Google place ID and the split address.
How do I build a local lead list with Yellow Pages Search?
Bulk local lead generation is the core use case for Yellow Pages Search. One call returns every business of one type on the result pages that you request, with a phone number and a website for each.
Choose one business type, for example
"roofing contractor".Set
search_queryto that business type.Set
locationto the target city, for example"Austin, TX".Set
pageto1andmax_pagesto10.Send the request.
Read
name,phone,address,websiteandcategoriesfrom each business.Repeat the call with a second city to widen the list.
To cover a state, send one call per city instead of one call for the state. To find email addresses for the list, pass each website value to the Website Email Extractor API. To add company data to each website, pass the same value to the Website Intelligence API.
Does Yellow Pages Search cache the response?
Yellow Pages Search caches every successful response for 24 hours. The cache key holds the search_query value, the location value, the page value and the max_pages value. A repeat call with the same four values returns the cached businesses and sets meta.cache_hit to true. The cache is always on, and no parameter turns it off.
CAUTION: A cache hit costs the same credits as a live read. RichAPI bills 0.01 credits per business on a cached response.
Which errors can Yellow Pages Search return?
Status | Meaning | What to do |
| The request body failed validation. A missing | Correct the parameter that the error message names. Read |
| The API key is missing or wrong. | Send a valid key in the |
| The organization has no credits left, or the team reached its monthly spend limit. | Buy credits in the RichAPI dashboard. |
| The API key has no access, or Yellow Pages Search is not on the plan. | Check the plan and the endpoint access in the RichAPI dashboard. |
| The request used a method other than | Send the request again with the |
| Too many requests. | Wait, then send the request again. |
| The API failed. | Send the request again. If the failure repeats, write to [email protected]. |
| The directory read failed. | Send the request again. If the failure repeats, write to [email protected]. |
| The directory read took too long. | Lower |
RichAPI refunds the credit reservation for every response outside the 200 range. A 400, 429 or 500 response costs no credits.
A failed directory read does not always return an error status. Yellow Pages Search returns 200 with an empty data.businesses array and a meta.quality_warning value. That response costs zero credits.
Frequently asked questions
How much does one Yellow Pages business record cost?
One Yellow Pages business record costs 0.01 credits, which is $0.0002. Yellow Pages Search charges no base credit per call, so a call that returns zero businesses costs zero credits.
Why is Yellow Pages Search cheaper than Google Maps Places (Keyword)?
Yellow Pages Search reads the public Yellow Pages directory, and Google Maps Places (Keyword) runs a Google Maps crawl. Yellow Pages Search costs 0.01 credits per business, and Google Maps Places (Keyword) costs 0.1 credits per business. For bulk United States local lead generation, Yellow Pages Search costs ten times less.
How many businesses can Yellow Pages Search return in one call?
Yellow Pages Search reads up to 10 result pages in one call, and it returns every business on those pages. max_pages sets the page count, and the valid range is 1 to 10. The exact business count per page depends on the Yellow Pages result page.
Does Yellow Pages Search return an email address?
No. The Yellow Pages listing holds a phone number, an address and a website, and not an email address. To find email addresses, pass each website value to the RichAPI Website Email Extractor endpoint.
Do I send the parameter name query to Yellow Pages Search?
No. Send search_query, location, page and max_pages. A request body with query returns 400.
Why does a business in the response hold an empty website value?
Yellow Pages Search always returns all six business keys. When the Yellow Pages listing carries no website, the website value is an empty string. The rating, phone and address values behave the same way.
Can I turn off the Yellow Pages Search cache?
No. Yellow Pages Search caches every successful response for 24 hours, and no parameter turns the cache off. A request body with cache returns 400, because cache is not an accepted parameter name.
Which countries does Yellow Pages Search cover?
Yellow Pages Search reads yellowpages.com, which lists United States businesses. For a business outside the United States, use the RichAPI Google Maps Places (Keyword) endpoint.
Related articles
Google Maps Places (Keyword) API — searches Google Maps for the same kind of local business. It costs 0.1 credits per place returned, which is ten times the Yellow Pages Search rate.
Website Intelligence API — adds company data to the
websitevalue of a Yellow Pages business.Website Email Extractor API — finds email addresses on the website of a Yellow Pages business.
Email Finder API — finds the work email address of a named person at a company.
