Prefill API
Tell us what you already know about a visitor, and the form opens with it filled in.
If your server already knows something about a visitor, tell us before they open the quote form. The first screen arrives filled in. The visitor checks it, fixes anything wrong, and continues with the rest of the form.
Base URL: https://platform.clicklyft.com
01How it works
- Your server sends us what it knows. We return a
prefill_id. - Your page gives that id to the form.
- The form shows the details on its first screen. The visitor edits them if needed and continues.
Only the details below are accepted. Every field is optional, and anything else is refused. Send contact details only if the visitor has already agreed to you passing them on.
02Authentication
Send your API key on every request. It is the same key you use for the Direct API.
Authorization: Bearer clk_your_key_hereMake the request from your server. Never put the key in a web page or a mobile app. A missing, wrong or revoked key returns 401 with {"error":"invalid_api_key"}.
03Create a prefill
POST/prefill/v1/sessions with Content-Type: application/json.
Unknown fields are rejected, so a typo cannot silently drop data.
Fields
| Field | Type | Required | Valid values |
|---|---|---|---|
reference_id | string | No | 1 to 128 characters. Your own ID. We return it. |
data | object | Yes | At least one of the fields below. |
data
| Field | Type | Valid values |
|---|---|---|
zip | string | 5 digits, for example 94105. |
state | string | 2 uppercase letters, for example CA. |
address | string | 1 to 200 characters. |
city | string | 1 to 80 characters. |
vehicles | array | One to four vehicles. See below. |
first_name | string | 1 to 60 characters. Send it with last_name: one without the other returns 400. |
last_name | string | 1 to 60 characters. Send it with first_name: one without the other returns 400. |
email | string | A valid email address, up to 200 characters. |
phone | string | 10 digits, for example 4155551234. |
drivers | array | One driver. See below. |
data.drivers[]
| Field | Type | Required | Valid values |
|---|---|---|---|
gender | string | No | male, female, other |
marital_status | string | No | married, single |
birth_date | string | No | A real date as YYYY-MM-DD, for example 1990-03-14. |
education | string | No | some_high_school, high_school, bachelors_degree, masters_degree |
credit_rating | string | No | excellent, good, fair, poor |
license_status | string | No | active, expired |
Send at least one field. The form asks for each of these on its own screen, with its own checks, so they arrive there filled in rather than on the first screen. A value the form does not offer is left blank for the visitor to answer.
data.vehicles[]
| Field | Type | Required | Valid values |
|---|---|---|---|
vin | string | Yes, if you do not send year, make and model | 17 letters and digits, never I, O or Q, for example 1HGCM82633A004352. See below. |
year | integer | Yes, unless you send vin | 1980 up to next year. A number, not a string. |
make | string | Yes, unless you send vin | 1 to 50 characters, for example Honda. |
model | string | Yes, unless you send vin | 1 to 80 characters, for example Civic. |
Sending a VIN. Send vin instead of year, make and model, and we look up the vehicle's year, make and model from it before we store anything. We check the VIN's check digit first, so a mistyped VIN is refused instead of matched to the wrong car.
- If you send
year,makeandmodelas well, we use yours and do not look the VIN up. It must still be 17 letters and digits, but its check digit is not checked and the lookup cannot fail. - If you send only some of the three, the VIN fills in the rest and yours win.
- The lookup covers vehicles made from 1981 and sold in the US. For anything else, send
year,makeandmodel. - We use the VIN for the lookup only and do not keep it. The form gets the year, make and model.
- A VIN works only through this API. The page-side options below take
year,makeandmodel, because a lookup needs a request to us.
Send the vehicles in the order you want them numbered. The form takes the first one that is complete and stops at the first that is not, so a vehicle with no model also drops the ones after it. The form's own vehicle count follows the number you send (four is "4 or more vehicles").
If your page names the car with its trim, such as Civic LX 2.0L 4 Cyl. Sedan, send it as is. The form matches the start of it to the models it lists.
Example
curl -X POST https://platform.clicklyft.com/prefill/v1/sessions \
-H "Authorization: Bearer $CLICKLYFT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reference_id": "order-1001",
"data": {
"zip": "94105",
"state": "CA",
"address": "1 Market St",
"city": "San Francisco",
"vehicles": [{ "year": 2018, "make": "Honda", "model": "Civic" }],
"first_name": "Ada",
"last_name": "Lovelace",
"email": "ada@example.com",
"phone": "4155551234",
"drivers": [{ "birth_date": "1990-03-14" }]
}
}'const res = await fetch("https://platform.clicklyft.com/prefill/v1/sessions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CLICKLYFT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"reference_id": "order-1001",
"data": {
"zip": "94105",
"state": "CA",
"address": "1 Market St",
"city": "San Francisco",
"vehicles": [
{
"year": 2018,
"make": "Honda",
"model": "Civic"
}
],
"first_name": "Ada",
"last_name": "Lovelace",
"email": "ada@example.com",
"phone": "4155551234",
"drivers": [
{
"birth_date": "1990-03-14"
}
]
}
}),
});
const data = await res.json();import os
import requests
res = requests.post(
"https://platform.clicklyft.com/prefill/v1/sessions",
headers={"Authorization": f"Bearer {os.environ['CLICKLYFT_API_KEY']}"},
json={
"reference_id": "order-1001",
"data": {
"zip": "94105",
"state": "CA",
"address": "1 Market St",
"city": "San Francisco",
"vehicles": [
{
"year": 2018,
"make": "Honda",
"model": "Civic"
}
],
"first_name": "Ada",
"last_name": "Lovelace",
"email": "ada@example.com",
"phone": "4155551234",
"drivers": [
{
"birth_date": "1990-03-14"
}
]
}
},
timeout=30,
)
data = res.json()Response 201
{
"prefill_id": "pf_Qm3x8WvR1sYb7eLz0pDk4gT2nHc5uJa9XoVf6iBwE1y",
"expires_at": "2026-11-25T10:00:00.000Z",
"reference_id": "order-1001"
}| Field | Type | Meaning |
|---|---|---|
prefill_id | string | Give this to the form. It works for one visitor. |
expires_at | string | When we delete the details if the visitor has not finished. |
reference_id | string or null | Your reference_id, or null if you sent none. |
04Show it in the form
Load the form with the prefill template on the script tag:
<script src="https://platform.clicklyft.com/embed.js" data-template="prefill-review"></script>Then pass the id when you open the form:
window.clicklyft.open({ prefillId: "pf_Qm3x8WvR1sYb7eLz0pDk4gT2nHc5uJa9XoVf6iBwE1y" });If you cannot run script on the page, add the id to the page address instead:
https://example.com/quote#cl-prefill-id=pf_Qm3x8WvR1sYb7eLz0pDk4gT2nHc5uJa9XoVf6iBwE1yThe form reads it once and removes it from the address bar.
What the visitor sees:
- The first screen shows what you sent, ready to edit. Everything else in the form follows as usual.
- A field the form has no matching question for is skipped. A value the form does not recognize is left blank for the visitor.
- If the id is unknown, expired, or we are slow to answer, the visitor gets the standard form. There is no error on the page.
- If the visitor reloads, pass the same id again so the form starts from the same screen.
05No server? Pass the same fields from the page
The form takes the same data fields straight from your page, with no request to us and no id:
window.clicklyft.open({
prefill: { zip: "94105", state: "CA", vehicles: [{ year: 2018, make: "Honda", model: "Civic" }] },
});Or in the page address, as base64url JSON of the same fields: #cl-prefill=<data>. These details stay in the visitor's browser. The page address ignores the contact and driver details (names, email, phone and every drivers field), because an address ends up in history, bookmarks and anything that records the page. Pass those through open({ prefill }) or the prefill API.
06How long we keep it
We keep the details, encrypted, until the visitor submits the form, or for 24 hours, whichever comes first. Then we delete them. Anything the visitor changes on the screen is not sent to us until they submit.
07Testing
Before you send live traffic, send the same request to the test endpoint:
POST/prefill/v1/test/sessions
- It uses your key, the same request body and the same validation. To go live, change only the path.
- Nothing is saved on our side. A VIN is still checked and looked up, so a wrong VIN is refused here just as it is live.
- The response has the live shape plus an
environmentfield set totest, and aprefill_idthat starts withtest_. A response from the live endpoint has noenvironmentfield. - A test id does not fill a form. The form treats it as unknown and shows the standard form. It only shows your request is valid.
{
"prefill_id": "test_Qm3x8WvR1sYb7eLz0pDk4g",
"expires_at": "2026-11-25T10:00:00.000Z",
"reference_id": "order-1001",
"environment": "test"
}To see a prefilled form while you build, use a live request and open the form with the id it returns. A live prefill that you do not use is deleted after 24 hours.
08Errors
| Status | Body | Meaning |
|---|---|---|
| 400 | {"error":"invalid_request","errors":[{"field":"data.zip","message":"..."}]} | The request breaks this spec. errors names each field. Nothing was saved. The messages never include your values. |
| 400 | {"error":"invalid_request","errors":[{"field":"data.email","message":"unknown field"}]} | You sent a field we do not take, such as ssn or driver_license. |
| 400 | {"error":"invalid_request","errors":[{"field":"data.vehicles.0.vin","message":"..."}]} | A VIN's check digit is wrong, or we could not identify a vehicle from it. Nothing was saved. Fix the VIN, or send year, make and model. |
| 401 | {"error":"invalid_api_key"} | The key is missing, wrong or revoked. |
| 503 | {"error":"vin_lookup_unavailable"} | We could not look up a VIN right now. Nothing was saved. Try again, or send year, make and model. |
| 5xx | A fault on our side. Try again. |
09Go-live checklist
- The API key is on your server only.
- You send only the fields in this spec. Contact details only if the visitor has agreed to you passing them on.
- You send each vehicle as
year,makeandmodel, or as avinthrough this API. - You give the
prefill_idto the form withopen({ prefillId })or the page address, and do not log it or show it where a visitor can share it. - Your page works when the form shows the standard form because an id is unknown or expired.
- You tested with
/prefill/v1/test/sessions, then created a live prefill and opened the form with its id.
10Notes
- This is version 1, under
/prefill/v1. We may add optional fields without changing the version. - Each request creates a new id. Sending the same data twice gives two ids.
- Do not log full request bodies, and do not show the
prefill_idanywhere the visitor can share it.