Public
Like
OnboardCompany
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v20View latest version
This API provides endpoints to find company logos and addresses by searching their websites and using AI to extract the information from HTML.
Find company logos by analyzing website HTML.
Find company addresses by searching about/contact pages.
{ "name": "Company Name", // Required: The company name "website": "https://..." // Optional: Company website URL }
{ "success": true, "logoUrl": "https://example.com/logo.png", "searchedUrl": "https://example.com" }
{ "success": true, "address": "123 Main Street, City, State 12345, Country", "searchedUrl": "https://example.com", "foundOnPage": "https://example.com/contact" }
{ "success": false, "error": "Error description", "searchedUrl": "https://example.com" // Optional: URL that was searched }
- Website Discovery: If no website is provided, searches DuckDuckGo to find the company's official website
- HTML Fetching: Retrieves the raw HTML from the company's homepage
- AI Logo Extraction: Uses OpenAI's GPT-4o-mini with enhanced logic to locate the company logo
- Format Prioritization: Prefers SVG > PNG > other image formats
- URL Validation: Ensures the logo URL ends with a valid image extension (.svg, .png, .jpg, .jpeg, .gif, .webp)
- Website Discovery: Same as logo finding
- Page Discovery: Tries multiple pages including homepage, /about, /contact, /about-us, /contact-us, /company, /locations, /office, /headquarters
- HTML Analysis: Fetches HTML from each page until an address is found
- AI Address Extraction: Uses OpenAI to locate and format the company's physical address
curl -X POST https://your-val-url/find-logo \ -H "Content-Type: application/json" \ -d '{ "name": "Apple Inc", "website": "https://apple.com" }'
curl -X POST https://your-val-url/find-address \ -H "Content-Type: application/json" \ -d '{ "name": "Microsoft" }'
curl -X POST https://your-val-url/find-logo \ -H "Content-Type: application/json" \ -d '{ "name": "Google" }'
Both endpoints handle various error scenarios:
- Missing required field (company name)
- Website not found during search
- Website unreachable or returns errors
- Logo/Address not found in website HTML
- AI service errors
The logo extraction has been significantly improved with:
- SVG logos (highest priority) - Vector graphics, scalable, often used by modern companies
- PNG logos (second priority) - High-quality raster images, good for detailed logos
- Other formats (lowest priority) - JPG, JPEG, GIF, WEBP
- Only returns URLs that end with valid image extensions
- Rejects URLs that don't end with: .svg, .png, .jpg, .jpeg, .gif, .webp
- Prevents returning non-image URLs or API endpoints
- Inline SVG elements in header/navigation areas
- IMG tags with alt text containing company name + "logo"
- Multiple logo placement patterns (header, navigation, etc.)
- Better handling of relative and absolute URLs
- Processes up to 20,000 characters of HTML (increased from 15,000)
- More sophisticated pattern recognition
- Better handling of modern website structures
The address finder uses a multi-page approach:
- Tries homepage first
- Searches common pages: /about, /about-us, /contact, /contact-us, /company, /locations, /office, /headquarters
- Stops at the first page where an address is found
- Returns the complete address and the page where it was found