Skip to main content
Internal Service β€” This is not an HTTP endpoint. It’s called by the competitor research service.

Purpose

Step 1 of competitor research: Fetches the business website content using Exa’s /contents endpoint.

Function Signature

async def fetch_website_content(api_key: str, url: str) -> str

Parameters

ParameterTypeDescription
api_keystrExa API key
urlstrBusiness website URL

Returns

str - First 2000 characters of website text content

Exa API Call

POST https://api.exa.ai/contents
{
    "urls": [url],
    "text": True,
    "livecrawl": "fallback"
}
OptionValueDescription
urls[url]Single URL to fetch
textTrueReturn text content
livecrawl"fallback"Live crawl if not cached

Why 2000 Characters?

The content is truncated to 2000 characters because:
  1. Enough context to understand the business
  2. Keeps Exa Answer API costs low
  3. Faster response times

Code Location

src/website/competitor_research/service.py
# Lines 60-88: fetch_website_content()