Docs← Back to site
API reference · v1

Event Feed API

Every lead, ad shown, click and payout, tagged with your reference_id. Pull it, or get webhooks.

A record of what happens to your leads and the ads we show for them: leads accepted, ads shown, ads clicked, and the payout each click earns. Every event carries your own reference_id, so it ties back to your order or customer record. You can read the feed, or have us send it to a webhook.

Base URL: https://platform.clicklyft.com

The feed covers leads from the Quote API and from the embedded funnel, in the same format. Events contain no consumer personal information.

01Authentication

Send your API key on every request. It is the same key you use for the Quote API.

Text
Authorization: Bearer clk_your_key_here

You only receive your own events. Never send an organization or account ID. A missing, wrong or revoked key returns 401 with {"error":"invalid_api_key"}.

02Events

Every event has these fields:

FieldTypeMeaning
event_idstringIdentifies this event. It never changes and is never reused. Use it to ignore duplicates.
typestringWhat happened. See the table below.
occurred_atstringWhen it happened. ISO 8601, UTC.
reference_idstring or nullThe reference_id you sent on the quote request or passed to the embed, or null if you sent none.
request_idstringThe request_id returned by the quote request. For a lead from the embedded funnel, our reference for that lead.
environmentstringtest or live. Every event carries it, unlike Quote API and Prefill API responses, where only the test endpoints add it. Your account starts in test mode and moves to live when your contract is signed. In test mode, events come from requests to the live Quote API endpoint and from the embedded funnel, both run against the carriers' test environments, and carry no real revenue. Requests to the test endpoints save nothing and create no events. The feed returns the events of the environment your account is in now, so every event on one page has the same value. Events we sent before this field existed carry none, and were all live.
typeWhen we send itExtra fields
lead.submittedA quote request was accepted and saved. One event per lead, even if a Quote API request is retried with the same submission_key.num_ads
offer.shownAn ad was shown: returned to you in a quote response, or displayed in the embedded funnel. A Quote API retry returns the ads again, so it adds offer.shown events with new ad_ids.ad_id, rank, carrier
offer.clickedA customer clicked an ad: in the Quote API, by following its click_url; in the embedded funnel, by clicking the ad. Counted once per ad.ad_id, rank, carrier, click_id
revenue.recordedA payout for you was recorded.ad_id, rank, carrier, click_id, source, payout_cents, currency, status

lead.submitted has only the fields above and num_ads, the number of ads we returned or showed for the request. It can be 0. It carries none of the data you sent.

Ad fields

FieldTypeMeaning
ad_idstring or nullThe ad, as returned in the quote response. null on a payout that does not come from a click.
rankinteger or nullThe ad's position, starting at 0.
carrierstring or nullThe carrier name shown on the ad.

Payout fields

FieldTypeMeaning
click_idstring or nullIdentifies the click. It is the same on the offer.clicked event and on the payout event for that click. null when the payout does not come from a click.
sourcestringclick for a click payout, lead for a lead that was sold.
payout_centsintegerYour payout in cents. It is the same amount your dashboard shows as your revenue for this click or lead.
currencystringUSD.
statusstringrecognized: counted when the click happened or the lead was sold. We may add other values later.

An event is never edited after we send it. To get the payout for a click or a reference_id, add up its payout_cents. offer.shown events carry no price.

03Reading events

GET/direct/v1/events

ParameterRequiredValid values
cursorNoThe next_cursor from your last response. Leave it out on your first request.
fromNoISO 8601 time with a time zone. On a first request without a cursor, start from events at or after this time. Ignored when cursor is sent.
limitNo1 to 500. Default 100.
typeNoOne of the event types above. Repeat the parameter to ask for several.
reference_idNoOnly events for this reference_id.

Unknown parameters are rejected.

curl "https://platform.clicklyft.com/direct/v1/events?limit=100&type=offer.clicked" \
  -H "Authorization: Bearer $CLICKLYFT_API_KEY"

Response 200

JSON
{
  "events": [{ "event_id": "evt_click_cm3k2x0cd0003efgh9012mnop", "type": "offer.clicked" }],
  "next_cursor": "MjAyNi0xMS0yN1QxODowNDoxMi4wMDBafGV2dF9jbGlja19jbTNrMg",
  "has_more": false
}
FieldTypeMeaning
eventsarrayEvents in the order they happened. May be empty.
next_cursorstringSend this as cursor on your next request. It is always present, including when events is empty.
has_morebooleantrue if more events are ready now. Request again straight away.
  • Store next_cursor after each response and send it on the next request. You get each event once, in order.
  • A stored cursor stays valid. To replay events, send an older cursor again.
  • Use the same filters on every request that shares a cursor.

Timing

An event is available about 30 seconds after it happens. We hold it back that long so that a cursor never skips an event. A click payout is recorded at the moment of the click. Not every click earns a payout: a click with no payout has an offer.clicked event and no revenue.recorded event.

04Webhooks

To receive events as they happen, give us an HTTPS URL. We send you a signing secret once and cannot show it again; it starts whsec_. You can use the pull API and a webhook together. A webhook receives events from the time it is set up, not earlier ones; the pull API replays history.

We send each event as a POST with Content-Type: application/json. The body is one event object, exactly as the pull API returns it. These headers come with it:

HeaderValue
X-ClickLyft-Event-IdThe event's event_id.
X-ClickLyft-TimestampUnix time in seconds when we sent it.
X-ClickLyft-Signaturev1= followed by the hex HMAC-SHA256 of the timestamp, a . and the raw body, keyed with your signing secret exactly as we gave it to you, whsec_ included.

Verify every request:

  1. Compute the HMAC-SHA256 of the timestamp, a . and the raw request body, using your signing secret.
  2. Compare it to the signature in constant time.
  3. Reject the request if the timestamp is more than 5 minutes old.

In Node.js:

JavaScript
import { createHmac, timingSafeEqual } from "node:crypto";

// rawBody is the request body exactly as received, before any JSON parsing.
function verifyClickLyftWebhook(rawBody, headers, secret) {
  const timestamp = headers["x-clicklyft-timestamp"];
  const signature = headers["x-clicklyft-signature"] ?? "";
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const expected = "v1=" + createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest("hex");
  const a = Buffer.from(signature);
  const b = Buffer.from(expected);
  return a.length === b.length && timingSafeEqual(a, b);
}

Respond with any 2xx status within 10 seconds to acknowledge an event. Anything else, a redirect included, or no response, counts as a failure.

  • A failed event is retried 1, 5, 15, 60, 180, 360 and 720 minutes after the previous attempt: 8 attempts over about 22 hours. After that we stop. You can still pull the event.
  • Delivery is at least once. The same event can arrive twice. Ignore an event_id you have already handled.
  • Events are sent in the order they happened, but a retry can arrive after later events. Use occurred_at to order them.
  • An event reaches your URL within about 90 seconds of happening.
  • A failing endpoint never affects your quote requests or your customers' clicks.
  • To change your URL or replace a lost secret, tell us.

05Testing

Before you read live events or receive live webhooks, try the test endpoints. They use your key and save nothing.

GET/direct/v1/test/events takes the same parameters as the live endpoint and returns a fixed set of sample events for one order: a lead.submitted with num_ads 2, two offer.shown, an offer.clicked on the rank 0 ad, and a revenue.recorded with a sample payout_cents. The amount is made up and says nothing about what a click pays. It uses your key and reads and saves nothing.

  • reference_id chooses the value the events carry. Without it they carry test-order-1001.
  • cursor, limit and type work as they do on the live endpoint.
  • The response has the live shape plus an environment field set to test. Every event_id starts with evt_test_ and every request_id starts with TEST-.
  • There is no 30-second delay.

Test webhook

POST/direct/v1/test/webhook with Content-Type: application/json sends one sample event to your webhook URL, signed with your real signing secret and with the same headers as a live delivery. Use it to check your signature verification.

FieldTypeRequiredValid values
typestringNoOne of the event types above. Default offer.clicked.
  • It sends to the URL we registered for you. A url field, or any other field, is refused.
  • It sends once and does not retry. Nothing is recorded.
  • The event is the sample above, with a test-order-1001 reference_id and an event_id that starts with evt_test_.

Response 200:

JSON
{
  "environment": "test",
  "delivered": true,
  "response_status": 200,
  "event": { "event_id": "evt_test_0004", "type": "offer.clicked" }
}
FieldTypeMeaning
environmentstringAlways test.
deliveredbooleantrue when your endpoint answered with a 2xx status within 10 seconds.
response_statusinteger or nullThe status your endpoint returned, or null if it did not answer.
eventobjectThe event we sent.

If we have not registered a webhook URL for you, or it is switched off, it returns 503 with {"error":"test_not_configured"}.

06Passing a reference ID through the embed

If you show our funnel on your page, pass your own order or customer ID when you open it:

Text
window.clicklyft.open({ referenceId: "order-1001" });
  • referenceId is a string of 1 to 128 characters. Use an ID from your own system. Do not use personal information such as a name, email address or phone number.
  • We keep it in the visitor's browser until they submit the form, and send it only with the submitted answers. Nothing is sent to us before that.
  • It appears as reference_id on every event for that lead: submitted, shown, clicked and paid.
  • Pass it every time you open the funnel. If you leave it out, the events for that lead have a null reference_id.
  • Leads from the embedded funnel appear in this feed in the same way as leads from the Quote API.

07Passing your own tracking values through the embed

If you show our funnel on your page, pass your own tracking values when you open it:

Text
window.clicklyft.open({ subs: { sub_1: "partner-42", sub_2: "homepage-banner" } });
  • subs takes sub_1 to sub_6, the same names and limits as the Quote API: strings of 1 to 128 characters. Send only the slots you use. A value that does not fit is dropped and the others are kept.
  • A slot you do not send stays empty. We never fill one from the page URL or from UTM parameters, so read them yourself and pass what you want tracked.
  • We send them when the visitor opens the funnel, before they submit. They are not answers, so keep personal information out of them.
  • They appear in the dashboard and are passed to our ad buyers to measure performance.
  • Pass them every time you open the funnel. Each open() replaces the last.

08Errors

StatusBodyMeaning
400{"error":"invalid_request","errors":[{"field":"limit","message":"..."}]}A parameter breaks this spec. errors names each one.
400{"error":"invalid_cursor"}The cursor is not one we issued. Start again with from.
401{"error":"invalid_api_key"}The key is missing, wrong or revoked.
503{"error":"test_not_configured"}Test webhook only: we have not registered a webhook URL for you, or it is switched off.
5xxA fault on our side. Retry the same request.

09Notes

  • This is version 1, under /direct/v1. We may add optional fields, new event types and new response fields without changing the version. Ignore event types and fields you do not recognize.
  • The feed reports what you have earned. Payments we have made to you are shown in your dashboard balance, not in the feed.
Copied