← API Reference
Hostinger integration

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/leads

What 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. 1. In the CRM, open Settings → Website Leads.
  2. 2. Click Create key — name it, add the site URL, and optionally Route to shop.
  3. 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 inputSent asRequirementWhat it's for
name="name"namerequiredCustomer's full name. (Or send firstName + lastName separately.)
name="phone"phonerequiredAt least 7 characters. Your main way to reach the customer.
name="vin"vinrecommended17-char VIN — lets the shop pin the exact glass/part before calling back.
name="email"emailoptionalValidated only if provided.
name="service"jobTypeoptionalType of glass work — see Service types. Defaults to windshield replacement.
name="message"messageoptionalFree text from the customer → saved as the lead's notes.
name="year/make/model"year, make, modeloptionalVehicle details, if you'd rather ask them than rely on the VIN.
name="address/city/state/zip"address, city, state, zipoptionalService location for mobile jobs.
(automatic)websiteoptionalThe 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/json with your key in the X-API-Key header (the snippet does this).
  • phone is required and must be at least 7 characters.
  • • A name is required — either name, or firstName + 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_REPLACEMENTWindshield replacement
WINDSHIELD_REPAIRWindshield chip / crack repair
DOOR_GLASS_FRONT_LEFTDoor glass — front left
DOOR_GLASS_FRONT_RIGHTDoor glass — front right
DOOR_GLASS_REAR_LEFTDoor glass — rear left
DOOR_GLASS_REAR_RIGHTDoor glass — rear right
BACK_GLASSBack glass / rear window
VENT_GLASS_LEFTVent glass — left
VENT_GLASS_RIGHTVent glass — right
OTHERSomething else / not sure

Add it to Hostinger

  1. 1. Open hPanel → Websites → your site → Edit website.
  2. 2. Click Add element (the + button).
  3. 3. Under Advanced, choose Embed code.
  4. 4. Paste the whole block from “The code”, then click outside the box to render it.
  5. 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.

html
<!-- 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. 1. Open your live site and submit the form with test data (add a VIN if you have one).
  2. 2. You should see “Thanks! We'll be in touch shortly.”
  3. 3. In the CRM, open Leads — the test lead is at the top, flagged 🌐 Website, in the key's shop.
  4. 4. Delete the test lead when done.

Prefer the terminal? Replace the key and run:

bash
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

SymptomCause & fix
Error message, console shows 401Wrong, disabled, or deleted key. Re-copy it from Settings → Website Leads.
Console shows a CORS errorYour CRM is locked to specific origins. Ask the admin to allow your Hostinger domain.
422 validation errorA required field is missing — phone is required, plus a name.
Nothing happens on submitThe <script> didn't load. Ensure the whole block (form + script) is in one Embed element.
Lead goes to the wrong shopSet “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.

Get an API key