Prompt
How do I troubleshoot an API returning empty results for company search?
Latest observation
Here’s a practical checklist for troubleshooting an API that returns empty results for a company search:
1) Verify the request is correct
- Check the endpoint URL
- Confirm the HTTP method is right (
GET,POST, etc.) - Make sure required query params, path params, or body fields are present
- Verify spelling, casing, and formatting of the company name or search terms
Example:
curl -X GET "https://api.example.com कंपनies/search?name=Acme"
2) Inspect authentication and permissions
- Ensure your API key/token is valid
- Confirm the token has access to the company search scope
- Check for environment mismatch:
- sandbox vs production
- test tenant vs real tenant
3) Check filters and search criteria
Empty results often happen because filters are too restrictive:
- exact match vs partial match
- country/region filters
- industry filters
- status filters (
active,verified, etc.) - date filters
- pagination cursor/page number
Try removing filters one by one to isolate the cause.
4) Confirm the company actually exists in the API dataset
- The company may not be indexed yet
- The record may not be available in the selected data source
- The company name might be different from what you expect:
- legal name vs trade name
- abbreviations
- punctuation differences
Try searching with:
- partial name
- alternate spellings
- domain name
- company ID if available
5) Look at the response metadata
Even if results are empty, useful clues may be in:
totalcountmatchesnext_cursorwarningserrorsdebugfields
An empty list with total: 0 means no matches.
An empty list with an error/warning may indicate a malformed request or permissions issue.
6) Test the request in isolation
Use a tool like:
curl- Postman
- Insomnia
This helps determine whether the issue is:
- in your application code
- in request serialization
- in the API itself
7) Log the raw request and response
Log:
- full URL
- headers
- request body
- response body
- status code
Be careful not to log secrets like API keys.
8) Check pagination
You may be on a page with no results because:
- page number is too high
- cursor is stale/invalid
- limit/page size is too small
Try page 1 or reset the cursor.
9) Compare with known-good examples
If the API docs provide sample searches, run them exactly as shown.
If sample queries work but yours don’t, the problem is likely in your search terms or filters.
10) Review API documentation or changelog
- Search behavior may be case-sensitive or normalized
- Some APIs require minimum term length
- Some APIs don’t return partial matches unless a flag is enabled
- Recent API changes may have altered defaults
11) Check rate limiting or throttling
Some APIs may return empty results or degraded responses under load, though more commonly they return 429.
- Inspect status codes
- Retry after backoff if needed
12) Validate encoding and special characters
Company names with special characters can break searches if not encoded properly:
&+'/- accented characters
Use URL encoding for query strings.
Quick diagnostic flow
- Remove all filters
- Search with a simple partial company name
- Try the company domain instead of name
- Verify auth and environment
- Check raw request/response logs
- Compare with API docs/sample requests
If you want, I can help you troubleshoot a specific request if you paste:
- the endpoint
- the request payload/query params
- the status code
- a redacted response body