> ## Documentation Index
> Fetch the complete documentation index at: https://docs.searchcompany.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Competitor

Add a competitor to analyze in the Explore tab. The competitor website is analyzed using Exa's AI-powered APIs:

1. **Exa `/contents`** - Fetches the actual website content with live crawling
2. **Exa `/answer`** - Analyzes the content to extract structured company information

Users can add up to **2 competitors manually**. Auto-discovered competitors (10 from onboarding) don't count toward this limit.

## How It Works

The two-step approach ensures accurate data extraction:

1. First, we fetch the website content using Exa's `/contents` endpoint with `livecrawl: "fallback"` to get fresh data
2. Then, we pass that content to Exa's `/answer` endpoint which uses an LLM to extract the company name, description, products, and target market in a structured format

## Request Body

| Field | Type   | Required | Description            |
| ----- | ------ | -------- | ---------------------- |
| `url` | string | Yes      | Competitor website URL |

## Example Request

```bash theme={null}
curl -X POST https://searchcompany-main.up.railway.app/api/explore/add-competitor \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://lululemon.com"}'
```

## Example Response (Success)

```json theme={null}
{
  "status": "success",
  "competitor": {
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "name": "Lululemon",
    "url": "https://lululemon.com",
    "description": "Lululemon Athletica is a Canadian athletic apparel company known for yoga pants and technical athletic wear.",
    "favicon_url": "https://www.google.com/s2/favicons?domain=lululemon.com&sz=64",
    "source": "user_added"
  }
}
```

## Example Response (Limit Reached)

```json theme={null}
{
  "status": "error",
  "error": "You can only add up to 2 competitors manually. Remove one to add another."
}
```

## Example Response (Already Exists)

```json theme={null}
{
  "status": "error",
  "error": "This competitor has already been added"
}
```

## Response Fields

| Field        | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| `status`     | string | `"success"` or `"error"`          |
| `competitor` | object | The added competitor (on success) |
| `error`      | string | Error message (on failure)        |

### Competitor Fields

| Field         | Type   | Description                                           |
| ------------- | ------ | ----------------------------------------------------- |
| `id`          | string | Unique competitor ID (UUID)                           |
| `name`        | string | Company name (extracted via Exa /answer)              |
| `url`         | string | Company website URL                                   |
| `description` | string | Brief description of the company                      |
| `favicon_url` | string | URL to company favicon (via Google's favicon service) |
| `source`      | string | Always `"user_added"` for this endpoint               |

## Timing

The request typically completes in **3-8 seconds** depending on website complexity.
