# Proposal Generator API Reference

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

### What it does

Generate a tailored, client-ready proposal from a company domain plus your offer details. The generator researches the account with Live Company Intelligence and produces positioning, scope, value narrative and pricing framing.

### Use cases

- Produce a first-draft proposal in under a minute after a discovery call.
- Let partners or resellers self-serve branded proposals from a portal you control.
- Standardize proposal quality across a large sales team without a proposal-desk bottleneck.

### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `source_domain` | string | Your company domain — used for branding, context, and proposal styling (required) |
| `target_domain` | string | Prospect's domain to generate the proposal for (required) |
| `contact_name` | string | Recipient's full name for personalization (optional) |
| `contact_email` | string | Recipient's email address (optional) |
| `proposal_type` | enum | Type of proposal: 'sales' or 'partnership' (optional, defaults to 'sales') |
| `cta_link` | string | Custom CTA button URL, e.g. demo booking page (optional — defaults to source domain) |
| `calendar_embed` | string | Raw HTML for an embedded calendar widget, e.g. Calendly inline widget (optional) |

### 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 |
|-------|-------|
| slug | |
| url | |
| outreach → linkedin_message, email_subject, email_body | |
| credits_used | |

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

```json
{
  "data": {
    "slug": "string",
    "url": "https://example.com",
    "credits_used": "string",
    "outreach": {
      "linkedin_message": "string",
      "email_subject": "user@example.com",
      "email_body": "user@example.com"
    }
  }
}
```

### POST /v1/proposals/generate — Generate Proposal

Generate a personalized sales or partnership proposal for a prospect. The system crawls both your website and the prospect's website, extracts branding and company context, and uses AI to produce a fully branded HTML proposal with ROI projections, social proof, and auto-generated outreach copy (LinkedIn message + email). Costs 10 credits.

Features:
- Dynamic brand extraction (colors, typography) from source domain
- AI-generated social proof and ROI projections
- Optional CTA button link and raw HTML calendar embed (e.g. Calendly)
- Auto-generated LinkedIn message and email outreach copy
- Public shareable URL at `/proposals/:slug`

**Example Request Body:**

```json
{
  "source_domain": "yourdomain.com",
  "target_domain": "prospect.com",
  "contact_name": "John Smith",
  "contact_email": "john@prospect.com",
  "proposal_type": "partnership",
  "cta_link": "https://yourdomain.com/demo",
  "calendar_embed": "<div class=\"calendly-inline-widget\" data-url=\"https://calendly.com/you/30min\"></div>"
}
```

**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/proposals/generate",
  "method": "POST",
  "body": {
    "source_domain": "yourdomain.com",
    "target_domain": "prospect.com",
    "contact_name": "John Smith",
    "contact_email": "john@prospect.com",
    "proposal_type": "partnership",
    "cta_link": "https://yourdomain.com/demo",
    "calendar_embed": "<div class=\"calendly-inline-widget\" data-url=\"https://calendly.com/you/30min\"></div>"
  }
}'
```

