• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
nic

nic

OnboardCompany

Public
Like
OnboardCompany
Home
Code
2
README.md
H
index.ts
Branches
1
Pull requests
Remixes
History
Environment variables
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
7/11/2025
Viewing readonly version of main branch: v14
View latest version
README.md

Company Logo & Address Finder API

This API provides endpoints to find company logos and addresses by searching their websites and using AI to extract the information from HTML.

Endpoints

POST /find-logo

Find company logos by analyzing website HTML.

POST /find-address

Find company addresses by searching about/contact pages.

Request Body (Both Endpoints)

{ "name": "Company Name", // Required: The company name "website": "https://...", // Optional: Company website URL "country": "Country Name", // Required: Company's country "state": "State/Province" // Optional: Company's state or province }

Responses

Logo Response (200)

{ "success": true, "logoUrl": "https://example.com/logo.png", "searchedUrl": "https://example.com" }

Address Response (200)

{ "success": true, "address": "123 Main Street, City, State 12345, Country", "searchedUrl": "https://example.com", "foundOnPage": "https://example.com/contact" }

Error Response (400/404/500)

{ "success": false, "error": "Error description", "searchedUrl": "https://example.com" // Optional: URL that was searched }

How It Works

Logo Finding

  1. Website Discovery: If no website is provided, searches DuckDuckGo to find the company's official website
  2. HTML Fetching: Retrieves the raw HTML from the company's homepage
  3. AI Logo Extraction: Uses OpenAI's GPT-4o-mini to analyze the HTML and locate the company logo
  4. URL Normalization: Converts relative URLs to absolute URLs for the logo image

Address Finding

  1. Website Discovery: Same as logo finding
  2. Page Discovery: Tries multiple pages including homepage, /about, /contact, /about-us, /contact-us, /company, /locations, /office, /headquarters
  3. HTML Analysis: Fetches HTML from each page until an address is found
  4. AI Address Extraction: Uses OpenAI to locate and format the company's physical address

Example Usage

Find Company Logo

curl -X POST https://your-val-url/find-logo \ -H "Content-Type: application/json" \ -d '{ "name": "Apple Inc", "website": "https://apple.com", "country": "United States", "state": "California" }'

Find Company Address

curl -X POST https://your-val-url/find-address \ -H "Content-Type: application/json" \ -d '{ "name": "Microsoft", "country": "United States", "state": "Washington" }'

Auto-Search (No Website Provided)

curl -X POST https://your-val-url/find-logo \ -H "Content-Type: application/json" \ -d '{ "name": "Google", "country": "United States" }'

Error Handling

Both endpoints handle various error scenarios:

  • Missing required fields (name, country)
  • Website not found during search
  • Website unreachable or returns errors
  • Logo/Address not found in website HTML
  • AI service errors

Rate Limits

This API uses OpenAI's services, so it's subject to OpenAI's rate limits. For production use, consider implementing caching and rate limiting.

Technical Details

  • Built with Hono framework on Val Town
  • Uses OpenAI GPT-4o-mini for logo and address extraction
  • Supports both provided websites and automatic website discovery
  • Handles relative and absolute URL conversion
  • Includes proper error handling and logging
  • Address finding tries multiple common page paths (/about, /contact, etc.)

Logo Finding Improvements

The logo extraction has been enhanced to handle:

  • Links with href="/" (like Apple's website)
  • Various logo placement patterns (header, navigation, etc.)
  • Different logo formats (img tags, SVG elements, CSS backgrounds)
  • Common logo identifiers (class/id containing "logo", "brand", etc.)
  • Relative and absolute URL conversion

Address Finding Strategy

The address finder uses a multi-page approach:

  1. Tries homepage first
  2. Searches common pages: /about, /about-us, /contact, /contact-us, /company, /locations, /office, /headquarters
  3. Stops at the first page where an address is found
  4. Returns the complete address and the page where it was found
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.