# Company Lookalikes API Reference

> Platform documentation snapshot. Access, charging and provider requirements remain operation-specific; examples do not execute requests.

### What it does

Give a seed domain or set of domains and get ranked similar companies with similarity reasoning. Matching considers industry, size, business model, technology footprint and web presence rather than industry code alone.

### Use cases

- Expand from your ten best customers to a few hundred statistically similar accounts.
- Find competitors and adjacent players for a target account before a strategic deal review.
- Prioritize a large TAM list by similarity score so reps work the closest fits first.

### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `domains` | string[] | Array of company domains to find lookalikes for (required, max 10). e.g. ["bytemine.ai", "apollo.io"] |
| `webhook_url` | string | URL to receive results when the job completes (optional) |
| `filters.industry` | string[] | Restrict results to specific industries. Examples: "Information Technology and Services", "Financial Services", "Health Care" |
| `filters.state` | string[] | Restrict results to specific US states (2-letter codes). e.g. ["CA", "NY"] |
| `filters.country` | string | Restrict results to a specific country code (e.g. "US", "GB") |

### Response Schema

_Complete documented fields for this section, with nested notation preserved. Endpoint-specific envelopes, availability and additional fields are described under each endpoint below._

| Field | Notes |
|-------|-------|
| job_id | |
| status (pending → enriching → generating_keywords → searching → completed → failed) | |
| keywords[] | |
| results[] → company_id, name, website, industry, employee_count, similarity_score | |

**Illustrative Example Response (synthetic, not a complete endpoint schema):**

```json
{
  "job_id": "job_abc123",
  "status": "completed",
  "created_at": "2025-06-01T12:00:00Z",
  "completed_at": "2025-06-01T12:00:42Z",
  "results": [
    {
      "job_id": "abc123",
      "status": "string",
      "keywords[]": [],
      "results": [
        {
          "company_id": "abc123",
          "name": "string",
          "website": "https://example.com",
          "industry": "string",
          "employee_count": 0,
          "similarity_score": 0
        }
      ]
    }
  ]
}
```

### POST /v1/company-lookalikes — Find Lookalikes

Provide a list of company domains (max 10) and the system will enrich them, extract business keywords, and search for similar companies. Returns a job_id immediately — results are delivered asynchronously via webhook or polling. Costs 50 credits per run.

**Example Request Body:**

```json
{
  "domains": [
    "bytemine.ai",
    "apollo.io",
    "zoominfo.com"
  ],
  "webhook_url": "https://your-app.com/webhooks/lookalike-complete",
  "filters": {
    "industry": [],
    "state": [],
    "country": ""
  }
}
```

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/v1/company-lookalikes",
  "method": "POST",
  "body": {
    "domains": [
      "bytemine.ai",
      "apollo.io",
      "zoominfo.com"
    ],
    "webhook_url": "https://your-app.com/webhooks/lookalike-complete",
    "filters": {
      "industry": [],
      "state": [],
      "country": ""
    }
  }
}'
```

### GET /v1/jobs/{job_id}?type=lookalike — Get Lookalike Job Status

Poll the status of a lookalike job. Returns status, keywords used, and matched companies when complete. Status values: pending, enriching, generating_keywords, searching, completed, failed. Free — does not consume credits.

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/v1/jobs/{job_id}?type=lookalike",
  "method": "GET"
}'
```

