# Prefill

> Send whatever you already know about a business from your server. Every field is optional; Kinro asks the customer only for what is still missing.

Prefill tells Kinro what your platform already knows about a business, so your customer doesn't type it again. Call `upsert_lead` from your server on `https://api.kinro.com/mcp` with a partner token.

> **Important:** Every field is optional. Send the business details you have. Kinro uses recognized fields to fill in answers and can use other relevant details as advisor context. Leave out passwords, payment card numbers and sensitive personal identifiers.

## Send what you have

Each call below is valid. Start with whatever your platform has and add fields later. Each extra fact is usually one less question for your customer.

### Just an ID

Valid on its own. Kinro opens the lead and your customer answers every question. Skips: nothing yet.

```json
{
  "external_id": "acct_12345",
  "mint_customer_token": true
}
```

### The basics (recommended start)

A good place to start if you have only a few fields. Skips: business name, what it does, location, contact.

```json
{
  "external_id": "acct_12345",
  "mint_customer_token": true,
  "data": {
    "business": {
      "name": "Oak Hill Lawn Care",
      "trade": "Lawn care"
    },
    "address": { "zip": "78745" },
    "contact": { "email": "priya@oakhill.example" }
  }
}
```

### Everything you have

Fewest questions for your customer. Fields Kinro has no name for, like crm_segment here, reach the advisor as context. Skips: the basics, plus employees, revenue and coverages.

```json
{
  "external_id": "acct_12345",
  "mint_customer_token": true,
  "data": {
    "business": {
      "name": "Oak Hill Lawn Care",
      "trade": "Lawn care"
    },
    "address": { "zip": "78745", "state": "TX" },
    "contact": {
      "first_name": "Priya",
      "email": "priya@oakhill.example"
    },
    "workforce": { "full_time_employees": 3 },
    "financials": { "annual_revenue": 220000 },
    "insurance": {
      "desired_coverages": [ "general_liability" ]
    },
    "context": "Mowing and irrigation. No tree work.",
    "crm_segment": "landscaping_pro"
  }
}
```

A few rules of thumb:

- **Not sure a value is right?** Leave it out, or put it in `context` as a note instead of a field.
- **Different field names are fine.** Kinro also reads common flat names such as `business_name`, `zip_code`, `email` and `phone`. Put the details the advisor needs most first in `context`. Long notes may be shortened.
- **Learned something new?** Call again with the same `external_id`. See [Update as you learn more](#update-as-you-learn-more).

## Make the call

Send these headers on every `POST https://api.kinro.com/mcp` request:

- `Authorization: Bearer <your_partner_token>`
- `Content-Type: application/json`
- `Accept: application/json, text/event-stream`

```bash
curl -X POST https://api.kinro.com/mcp \
  -H "Authorization: Bearer $KINRO_PARTNER_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": "req_1",
    "method": "tools/call",
    "params": {
      "name": "upsert_lead",
      "arguments": {
        "external_id": "acct_12345",
        "mint_customer_token": true,
        "data": {
          "business": { "name": "Oak Hill Lawn Care", "trade": "Lawn care" },
          "address": { "zip": "78745" },
          "contact": { "email": "priya@oakhill.example" }
        }
      }
    }
  }'
```

```js
const response = await fetch("https://api.kinro.com/mcp", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KINRO_PARTNER_TOKEN}`,
    "Content-Type": "application/json",
    Accept: "application/json, text/event-stream",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: "req_1",
    method: "tools/call",
    params: {
      name: "upsert_lead",
      arguments: {
        external_id: account.id,
        mint_customer_token: true,
        // Send only what you have. Every key is optional.
        data: {
          business: { name: account.businessName, trade: account.industry },
          address: { zip: account.zip },
          contact: { email: account.ownerEmail },
        },
      },
    },
  }),
});
const { result } = await response.json();
const { lead_id, customer_token } = result.structuredContent;
```

```python
import os
import requests

response = requests.post(
    "https://api.kinro.com/mcp",
    headers={
        "Authorization": f"Bearer {os.environ['KINRO_PARTNER_TOKEN']}",
        "Content-Type": "application/json",
        "Accept": "application/json, text/event-stream",
    },
    json={
        "jsonrpc": "2.0",
        "id": "req_1",
        "method": "tools/call",
        "params": {
            "name": "upsert_lead",
            "arguments": {
                "external_id": "acct_12345",
                "mint_customer_token": True,
                "data": {"business": {"name": "Oak Hill Lawn Care"}, "address": {"zip": "78745"}},
            },
        },
    },
)
result = response.json()["result"]["structuredContent"]
```

Keep partner tokens on your server. Never put a `kinro_pk_*` token in browser JavaScript or a mobile app. Test and live tokens are separate: test tokens reach only sandbox leads. See [Sandbox & go-live](/docs/sandbox). To rotate a token without downtime, ask Kinro for a second active token, switch over, then revoke the old one.

## What comes back

`result.structuredContent`:

```json
{
  "lead_id": "b9011f24-6a12-4c72-9b88-100000060331",
  "external_id": "acct_12345",
  "session_id": "54d0c240-9012-43ab-88c1-200000060331",
  "session_ref": "ref_01abc23def45",
  "customer_token": "kct_...",
  "ui_blocks": [],
  "created": true
}
```

What to do next depends on your path:

- **Embedded partners:** pass `customer_token` to [`embed.js`](/docs/embedding#5-skip-questions-your-app-already-knows) in memory. The widget opens with your answers already filled in.
- **Brokers:** keep `lead_id` and [work the quote with Kinro](/docs/brokers#2-work-the-quote-with-kinro) over the API.

## Fields Kinro recognizes

These optional fields have a defined meaning. Other fields can provide context for the advisor.

| Field | Example | What it does |
| --- | --- | --- |
| `data.business.name` | `"Oak Hill Lawn Care"` | Skips the business name question |
| `data.business.trade` | `"Residential lawn care"` | What the business does, in plain words. Skips the operations question |
| `data.address.zip` | `"78745"` | Skips the location question |
| `data.contact.email`, `phone`, `first_name`, `last_name` | `"priya@oakhill.example"` | The customer's contact details. Any common phone format works |
| `data.insurance.desired_coverages` | `["general_liability"]` | Skips coverage selection. Values: `general_liability`, `bop`, `workers_comp`, `commercial_auto`, `professional_liability`, `cyber`, `commercial_property`, `bonds` |
| `data.workforce.full_time_employees` | `3` | Skips the employee count question |
| `data.financials.annual_revenue` | `220000` | Whole U.S. dollars. Can fill in the revenue question. An answer already confirmed by the customer takes precedence. A `{ "min", "max" }` range is kept as context |
| `data.address.street`, `city`, `state` | `"TX"` | The business address. `state` is the 2-letter code |
| `data.workforce.part_time_employees`, `data.financials.annual_payroll` | `85000` | Kept as context for the advisor |
| `data.context` | `"No tree work over 15 ft."` | Plain-language notes from your product, passed to the advisor |
| any other key | `"crm_segment": "pro"` | Kept and passed to the advisor as partner context |

Dates are `YYYY-MM-DD`. Kinro treats everything you send as information from your platform, never as instructions.

## Call options

| Argument | Type | What it does |
| --- | --- | --- |
| `external_id` | string | Your stable ID for this customer: 1–100 letters, digits, `_` or `-`. Recommended: later calls with the same ID update the same lead. Kinro generates one if you omit it. |
| `lead_id` | UUID | Address an existing Kinro lead instead of using `external_id`. |
| `data` | object | What you know about the business. See [the fields above](#fields-kinro-recognizes). |
| `mint_customer_token` | boolean | `true` returns a short-lived `customer_token` (`kct_*`) for `embed.js`. |
| `files` | array | Prior policies, declarations pages, certificates or loss runs. See [Documents](#documents). |
| `idempotency_key` | string | 4–160 characters. Replaying a completed key returns the same lead and session; reusing it with different arguments returns a tool error. |
| `contact_consent` | object or `null` | Partner-declared contact consent, if your agreement includes it. See [Contact consent](#contact-consent). |

## Update as you learn more

Call `upsert_lead` again with the same `external_id` whenever your platform learns something new:

- **Objects** such as `address` or `workforce` merge field by field.
- **Values and arrays** such as `desired_coverages` replace the previous value.
- **Omitted fields** stay as they were.
- **`null`** clears a field you sent before.

## Documents

Attach prior policies, declarations pages, certificates of insurance or loss runs in `files`, on the first call or any later one. A current declarations page often answers many questions at once.

```json
{
  "external_id": "acct_12345",
  "idempotency_key": "doc_acct_12345_loss_runs",
  "files": [
    {
      "file_name": "loss-runs-2025.pdf",
      "mime_type": "application/pdf",
      "data": "JVBERi0xLjQK..."
    }
  ]
}
```

Send PDF, PNG or JPEG files, base64-encoded. Send one upload at a time. If an upload times out, retry with the same `external_id`, `idempotency_key` and `files`.

## Contact consent

By default, Kinro contacts your customers outside the widget only if they opt in themselves, using the unticked consent checkbox in the widget.

If your partner agreement includes partner-declared consent and Kinro has enabled it for your account, you can declare consent per customer:

```json
{
  "external_id": "acct_12345",
  "contact_consent": { "channels": ["email", "sms", "voice"] }
}
```

- Channels are `"email"`, `"sms"` and `"voice"`.
- Sending `contact_consent` before it is enabled for your account returns an error. It is never silently ignored.
- Send `"contact_consent": null` to withdraw. A customer's own opt-out, such as replying STOP or unsubscribing, always wins.

---

Source: https://kinro.com/docs/prefill. All Kinro docs: https://kinro.com/docs/llms.txt
