# Sales Research Apps API Reference

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

### What it does

Prebuilt agentic research products: a company scorecard, market/TAM mapping, nine-section pre-meeting sales research, and a natural-language research agent that plans and runs a mix of searches, enrichments and signals within a credit budget.

### Use cases

- Score a target account before a first call with an evidence-backed 0-100 readiness grade.
- Size a market and estimate TAM before committing territory or campaign budget.
- Auto-prepare full pre-meeting research for every demo on the calendar.
- Let your product's AI agents prospect on their own with a credit-bounded research budget.

### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `domain` | string | Company domain to research (required for scorecard and sales-research-agent) |
| `sections[]` | string[] | sales-research-agent only — any of "company_summary", "recent_news", "competitors", "tech_stack", "hiring_trends", "pain_points", "stakeholders", "objections", "talk_tracks". Omit for all nine. |
| `your_domain` | string | Your own domain, used to tailor competitive framing (optional) |
| `contact_email` | string | Optional contact email for person-level context (sales-research-agent) |
| `meeting_context` | string | Optional free-form context about the upcoming meeting (sales-research-agent) |
| `industry` | string | market-mapper only — industry to map (at least one of industry/state/city required) |
| `state` | string | market-mapper only — 2-letter US state code |
| `city` | string | market-mapper only — city name |
| `employee_range` | string | market-mapper only — company size band, e.g. "11-50" |
| `query` | string | research-agent only — natural-language description of the prospects or research you want |
| `budget` | integer | research-agent only — maximum data credits the agent may spend (default 50) |
| `mode` | string | research-agent only — planning mode, default "balanced" |

### 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 |
|-------|-------|
| company-scorecard → company_name, domain, overall_score, categories { web_presence, growth_signals, tech_maturity, market_position } each { score, details[] }, facts[] | |
| market-mapper → result { total_companies, tam_estimate, geo_distribution, size_distribution, industry_breakdown } | |
| sales-research-agent → per-section research blocks for every requested section | |
| research-agent → summary { credits_used } plus the research result produced by the agent's plan | |
| credits_used (all app endpoints) | |

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

```json
{
  "data": [
    {
      "credits_used": "string",
      "company-scorecard": {
        "company_name": "string",
        "domain": "string",
        "overall_score": 0,
        "categories { web_presence": [],
        "growth_signals": "string",
        "tech_maturity": "string",
        "market_position } each { score": 0,
        "details[] }": "string",
        "facts[]": "string"
      },
      "market-mapper": {
        "result { total_companies": "string",
        "tam_estimate": "string",
        "geo_distribution": "string",
        "size_distribution": "string",
        "industry_breakdown }": "string"
      },
      "sales-research-agent": {
        "per-section research blocks for every requested section": "string"
      },
      "research-agent": {
        "summary { credits_used } plus the research result produced by the agent's plan": "string"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "page_size": 20,
    "total": 1,
    "has_more": false
  },
  "credits_used": 1
}
```

### POST /v1/apps/company-scorecard — Generate Company Scorecard

Produce a 0-100 sales-readiness scorecard for a company: overall score plus four category scores (web presence, growth signals, tech maturity, market position) with supporting evidence, built from a live website crawl and company enrichment. Costs 10 credits.

**Example Request Body:**

```json
{
  "domain": "stripe.com"
}
```

**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/apps/company-scorecard",
  "method": "POST",
  "body": {
    "domain": "stripe.com"
  }
}'
```

### POST /v1/apps/market-mapper — Map a Market

Size and segment a market: total matching companies, a TAM estimate, geographic and size distributions and an industry breakdown, from live B2B search across the filters you pass. Costs 10 credits.

**Example Request Body:**

```json
{
  "industry": "Dental",
  "state": "TX",
  "employee_range": "11-50"
}
```

**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/apps/market-mapper",
  "method": "POST",
  "body": {
    "industry": "Dental",
    "state": "TX",
    "employee_range": "11-50"
  }
}'
```

### POST /v1/apps/sales-research-agent — Run Sales Research Agent

Full pre-meeting sales research on one company. Pick any of nine sections — company summary, recent news, competitors, tech stack, hiring trends, pain points, stakeholders, objections, talk tracks — and get each written from live crawl, enrichment and signal data. Costs 10 credits + 5 per requested section (all nine sections = 55 credits).

**Example Request Body:**

```json
{
  "domain": "prospect.com",
  "sections": [
    "company_summary",
    "pain_points",
    "objections",
    "talk_tracks"
  ],
  "your_domain": "yourdomain.com",
  "meeting_context": "Discovery call with their VP of Sales"
}
```

**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/apps/sales-research-agent",
  "method": "POST",
  "body": {
    "domain": "prospect.com",
    "sections": [
      "company_summary",
      "pain_points",
      "objections",
      "talk_tracks"
    ],
    "your_domain": "yourdomain.com",
    "meeting_context": "Discovery call with their VP of Sales"
  }
}'
```

### POST /research-agent — Run Research Agent

Agentic prospect research: describe what you're looking for in natural language and the agent plans and executes a mix of Bytemine searches, enrichments and signals within your credit budget, returning the combined result. Billed at the standard rates of the underlying calls it actually runs — see `summary.credits_used` in the response. Your workspace needs a balance of at least 5 credits to start. Aliases: `/v1/research-agent`.

**Example Request Body:**

```json
{
  "query": "Find 50 series-A SaaS companies in Texas hiring sales reps",
  "budget": 50,
  "mode": "balanced",
  "geographies": [
    "US-TX"
  ],
  "industries": [
    "Software"
  ]
}
```

**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": "/research-agent",
  "method": "POST",
  "body": {
    "query": "Find 50 series-A SaaS companies in Texas hiring sales reps",
    "budget": 50,
    "mode": "balanced",
    "geographies": [
      "US-TX"
    ],
    "industries": [
      "Software"
    ]
  }
}'
```

