Embed API

Add AI-powered turf visualization and instant quoting to any website in two lines of code.

When a homeowner uses the widget on your site, their lead — including the AI visualization and sqft estimate — lands directly in your Instant Turf Quote dashboard.

CORS-open — All embed endpoints accept requests from any origin. No additional server-side setup required.

How It Works

Homeowner visits your website and clicks your "Get a Free Estimate" button (or whatever you call it).
The ITQ widget opens — a modal overlay branded with your company name. They upload a photo of their lawn.
AI runs in ~20 seconds — photorealistic before/after visualization + square footage estimate.
Results are revealed — the homeowner enters their name, email, phone, and zip to unlock the price range.
Lead lands in your dashboard — with full contact info, the visualization images, and sqft estimate. Ready to quote.

Quickstart (2 Lines)

Paste this into any HTML page, replacing YOUR_API_KEY with your key from the dashboard.

HTML
<div id="itq-widget" data-api-key="YOUR_API_KEY"></div>
<script src="https://instantturfquote.com/embed.js"></script>

This renders a "Get a Free Instant Quote" button wherever the <div> is placed.

Authentication

All embed API requests must include your API key. You can send it as:

⚠️ Your API key is embedded in client-side JavaScript and visible to the public. This is intentional and safe — keys are scoped to lead submission only and cannot access your private dashboard data.

API Reference

Base URL: https://instantturfquote.com

GET /api/embed/config Get company branding for the widget

Query Parameters

ParamDescription
api_key requiredYour embed API key

Response

{
  "company_name": "Bob's Turf Co.",
  "color_scheme": "emerald",
  "rep_name": "Bob Smith"
}
POST /api/embed/visualize Run AI turf visualization on a photo

Accepts multipart/form-data. This is the heavy lifting — AI visualization typically takes 15–30 seconds.

Request Fields

FieldTypeDescription
file requiredFileLawn photo. JPG, PNG, or WebP. Max 20 MB.
texture optionalstringnatural (default), premium, or sport
yard_type optionalstringHint for AI: front yard, backyard, pet area, etc.

Headers

HeaderValue
X-API-Key requiredYour embed API key

Response

{
  "status": "success",
  "original_image": "<base64 JPEG>",
  "result_image": "<base64 JPEG>",
  "sqft": 842,
  "lawn_percentage": 68.4,
  "quote": {
    "price_low": 8400,
    "price_high": 11800,
    "sqft": 842
  }
}
POST /api/embed/lead Submit a homeowner lead

Accepts application/json. The lead is assigned directly to your account.

Request Body

FieldTypeDescription
name requiredstringHomeowner's full name
email requiredstringHomeowner's email
zip_code requiredstringUS zip code
phone optionalstringHomeowner's phone number
sqft_estimate optionalnumberEstimated square footage from visualize step
result_image optionalstringBase64 turf visualization image
original_image optionalstringBase64 original photo

Response

{
  "status": "success",
  "lead_id": "a1b2c3...",
  "message": "Thanks Jane! Bob's Turf Co. will be in touch shortly."
}

Widget Installation

The drop-in widget handles the full flow automatically — upload, AI processing, before/after slider, and lead capture. No configuration required beyond your API key.

Options (data attributes)

AttributeDefaultDescription
data-api-keyrequiredYour embed API key
data-button-text"Get a Free Instant Quote"Text shown on the trigger button
data-hosthttps://instantturfquote.comOverride the API host (advanced)

Examples

Inline button inside a section:

HTML
<section class="cta-section">
  <h2>Get a Free Instant Quote</h2>
  <div id="itq-widget" data-api-key="itq_live_..." data-button-text="Visualize My Lawn →"></div>
</section>
<script src="https://instantturfquote.com/embed.js"></script>

Floating button (no div needed):

HTML
<script src="https://instantturfquote.com/embed.js"
        data-api-key="itq_live_..."
        data-button-text="Get a Free Quote">
</script>

When no #itq-widget div exists, the widget injects a floating button in the bottom-right corner of the page.

Managing API Keys

Generate and manage your API keys from your dashboard → API & Embed tab.

FAQ

Does the homeowner know they're using Instant Turf Quote?

No. The widget shows your company name and branding. "Instant Turf Quote" only appears in a small "Powered by" footer inside the modal.

Where do leads go?

Directly into your Instant Turf Quote dashboard under the Leads tab. They are private to your account and are never shared with other reps or added to the lead marketplace.

Is there an extra charge for the embed API?

No — it's included in all paid plans (Individual and Executive). Every visualization uses AI credits from your plan.

What if the AI visualization fails?

The widget shows a friendly error with a "Try Again" option. The lead is only submitted after the homeowner fills in their contact info — a failed visualization simply means they don't proceed to that step.

Can I use the API directly without the widget?

Yes. The three endpoints are fully documented above and can be called from any frontend or backend. The widget is just a convenience wrapper.

Do I need to set up CORS on my server?

No. The embed endpoints on our server are CORS-open, so the widget can call them from any domain. Your web server doesn't need any changes.