Connect your Hostinger website
Make your Hostinger contact / quote form drop straight into the CRM as a lead — no code, no plugins to configure beyond one paste. Works with the Hostinger Website Builder, WordPress, or a plain HTML site.
POST https://www.autoglass-crm.com/api/public/leadsWhat you need
Admin access
To the CRM, so you can generate an API key.
A Hostinger site
Website Builder, WordPress, or plain HTML — any works.
An API key
Created in Settings → Website Leads (next step).
Get your API key
- 1. In the CRM, open Settings → Website Leads.
- 2. Click Create key — name it, add the site URL, and optionally Route to shop.
- 3. Copy the key (
agk_…) — it's shown only once.
Form fields
These are the fields the form can send. The snippet below already includes them — this table is so you understand what each one does and which are mandatory.
| Form input | Sent as | Requirement | What it's for |
|---|---|---|---|
| name="name" | name | required | Customer's full name. (Or send firstName + lastName separately.) |
| name="phone" | phone | required | At least 7 characters. Your main way to reach the customer. |
| name="vin" | vin | recommended | 17-char VIN — lets the shop pin the exact glass/part before calling back. |
| name="email" | optional | Validated only if provided. | |
| name="service" | jobType | optional | Type of glass work — see Service types. Defaults to windshield replacement. |
| name="message" | message | optional | Free text from the customer → saved as the lead's notes. |
| name="year/make/model" | year, make, model | optional | Vehicle details, if you'd rather ask them than rely on the VIN. |
| name="address/city/state/zip" | address, city, state, zip | optional | Service location for mobile jobs. |
| (automatic) | website | optional | The script sends location.hostname so you know which site the lead came from. |
Minimum to create a lead: a name and a phone. Everything else is optional but helps your team quote faster.
Requirements & rules
- • Send the request as
Content-Type: application/jsonwith your key in theX-API-Keyheader (the snippet does this). - • phone is required and must be at least 7 characters.
- • A name is required — either
name, orfirstName+lastName. - • email is validated only if provided — an empty email is fine.
- • year, if sent, must be between 1900 and 2100.
- • jobType accepts an exact service value (see below) or free text; unknown text is stored as “Other”.
- • No rate limit for normal traffic, but the key can be disabled or deleted instantly if a site is abused.
Service types
Use these exact values in the <select name="service"> so the job type is recorded precisely.
| Value (option value) | Shown to customer |
|---|---|
| WINDSHIELD_REPLACEMENT | Windshield replacement |
| WINDSHIELD_REPAIR | Windshield chip / crack repair |
| DOOR_GLASS_FRONT_LEFT | Door glass — front left |
| DOOR_GLASS_FRONT_RIGHT | Door glass — front right |
| DOOR_GLASS_REAR_LEFT | Door glass — rear left |
| DOOR_GLASS_REAR_RIGHT | Door glass — rear right |
| BACK_GLASS | Back glass / rear window |
| VENT_GLASS_LEFT | Vent glass — left |
| VENT_GLASS_RIGHT | Vent glass — right |
| OTHER | Something else / not sure |
Add it to Hostinger
- 1. Open hPanel → Websites → your site → Edit website.
- 2. Click Add element (the + button).
- 3. Under Advanced, choose Embed code.
- 4. Paste the whole block from “The code”, then click outside the box to render it.
- 5. Drag it into place and click Go live / Publish.
The code
Paste this whole block (form and script together). The endpoint is already your CRM's — just replace agk_PASTE_YOUR_KEY_HERE with your key.
<!-- AutoGlass CRM lead form — paste into a Hostinger Embed element -->
<form id="agc-lead-form" style="max-width:480px;display:grid;gap:10px;font-family:inherit">
<input name="name" placeholder="Full name*" required style="padding:10px;border:1px solid #ccc;border-radius:8px" />
<input name="phone" placeholder="Phone*" required style="padding:10px;border:1px solid #ccc;border-radius:8px" />
<input name="email" type="email" placeholder="Email" style="padding:10px;border:1px solid #ccc;border-radius:8px" />
<input name="vin" placeholder="VIN (windshield / door jamb)" style="padding:10px;border:1px solid #ccc;border-radius:8px" />
<select name="service" style="padding:10px;border:1px solid #ccc;border-radius:8px">
<option value="WINDSHIELD_REPLACEMENT">Windshield replacement</option>
<option value="WINDSHIELD_REPAIR">Windshield chip / crack repair</option>
<option value="DOOR_GLASS_FRONT_LEFT">Door glass — front left</option>
<option value="DOOR_GLASS_FRONT_RIGHT">Door glass — front right</option>
<option value="DOOR_GLASS_REAR_LEFT">Door glass — rear left</option>
<option value="DOOR_GLASS_REAR_RIGHT">Door glass — rear right</option>
<option value="BACK_GLASS">Back glass / rear window</option>
<option value="OTHER">Something else</option>
</select>
<textarea name="message" placeholder="Tell us what happened" rows="3" style="padding:10px;border:1px solid #ccc;border-radius:8px"></textarea>
<button type="submit" style="padding:12px;border:0;border-radius:8px;background:#0a66ff;color:#fff;font-weight:600;cursor:pointer">
Request a quote
</button>
<p id="agc-status" style="margin:0;font-size:14px"></p>
</form>
<script>
(function () {
var CRM_ENDPOINT = "https://www.autoglass-crm.com/api/public/leads";
var API_KEY = "agk_PASTE_YOUR_KEY_HERE"; // from CRM → Settings → Website Leads
var form = document.getElementById("agc-lead-form");
var status = document.getElementById("agc-status");
form.addEventListener("submit", function (e) {
e.preventDefault();
status.textContent = "Sending…";
fetch(CRM_ENDPOINT, {
method: "POST",
headers: { "Content-Type": "application/json", "X-API-Key": API_KEY },
body: JSON.stringify({
name: form.name.value,
phone: form.phone.value,
email: form.email.value,
vin: form.vin.value,
jobType: form.service.value,
message: form.message.value,
website: location.hostname
})
})
.then(function (r) { return r.json(); })
.then(function (d) {
form.reset();
status.style.color = d.ok ? "#0a7d33" : "#c0392b";
status.textContent = d.ok ? "Thanks! We'll be in touch shortly." : "Please check your details and try again.";
})
.catch(function () {
status.style.color = "#c0392b";
status.textContent = "Something went wrong — please call us.";
});
});
})();
</script>Test it
- 1. Open your live site and submit the form with test data (add a VIN if you have one).
- 2. You should see “Thanks! We'll be in touch shortly.”
- 3. In the CRM, open Leads — the test lead is at the top, flagged 🌐 Website, in the key's shop.
- 4. Delete the test lead when done.
Prefer the terminal? Replace the key and run:
curl -X POST https://www.autoglass-crm.com/api/public/leads \
-H "Content-Type: application/json" \
-H "X-API-Key: agk_PASTE_YOUR_KEY_HERE" \
-d '{"name":"Test Lead","phone":"5551234567","vin":"1HGCM82633A004352","jobType":"WINDSHIELD_REPAIR"}'A success returns { "ok": true, "leadNumber": "LD-…" }.
Troubleshooting
| Symptom | Cause & fix |
|---|---|
| Error message, console shows 401 | Wrong, disabled, or deleted key. Re-copy it from Settings → Website Leads. |
| Console shows a CORS error | Your CRM is locked to specific origins. Ask the admin to allow your Hostinger domain. |
| 422 validation error | A required field is missing — phone is required, plus a name. |
| Nothing happens on submit | The <script> didn't load. Ensure the whole block (form + script) is in one Embed element. |
| Lead goes to the wrong shop | Set “Route to shop” on the key — the key's shop wins over everything. |
Security & good practice
- • The key appears in your page source. That's acceptable — it can only create leads and you can revoke it instantly.
- • Use one key per site so you can track and route each independently.
- • If a site starts getting spam, disable its key in the CRM and issue a new one.
- • Ask for the VIN — it's the single most useful field for an accurate quote.
Ready?
Create a key, paste the block, publish.