A lead event or a loan stage
const url = 'https://stitch-collector-dev.magic-blocks.workers.dev/v1/conversion';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"idempotency_key":"relcu-lead-44821-created","identity":{"relcu_contact_id":"88213"},"lead":{"external_id":"44821","brand_id":"bll","attrs":{"status":"new","vendor_source":"partner-x","cost_cents":4500}},"event":"created","occurred_at":"2026-03-01T12:00:00Z"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://stitch-collector-dev.magic-blocks.workers.dev/v1/conversion \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "idempotency_key": "relcu-lead-44821-created", "identity": { "relcu_contact_id": "88213" }, "lead": { "external_id": "44821", "brand_id": "bll", "attrs": { "status": "new", "vendor_source": "partner-x", "cost_cents": 4500 } }, "event": "created", "occurred_at": "2026-03-01T12:00:00Z" }'Lead events and loan stages, from whichever system owns them — a CRM, a loan origination system, or a middleware in front of either. Any identity key works, any subset of attributes works, and the idempotency key means the same message can arrive a hundred times. Stitch assumes nothing about which stages exist, their order, or when they are reported: send what you have, when you have it. The first application event with the borrower’s figures is scored by the value model; the lead created event, the application and funded each fire a conversion to the enabled ad platforms, and a later change of value fires a restatement.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”One lead event or one loan stage per call. identity must carry at least one recognised key; occurred_at is required; and the call names a lead or a loan by external_id (a loan also needs its stage). A loan is created only at app_started; everything before that belongs to the person and the lead.
object
Yours to choose, stable per event: relcu-lead-44821-created, vesta-L88213-funded. Re-sending returns 200 and writes nothing.
Any recognised key works; send what you have. Unrecognised keys are ignored. anon_id is the browser’s cookie value, read server-side from the _bid cookie or minted by the SDK.
object
The contact id in whatever is the system of record for contacts (today, likely the CRM): the spine id. octopus_id and los_contact_id are accepted as the same thing.
The visitor’s anonymous id from the first-party cookie.
object
Beeline Loans or Beeline Equity.
Free-form. Worth sending: status, vendor_source, cost_cents, submission_id (the page’s hidden field, so the pixel’s event and Stitch’s are one), declared_source (what the person said).
object
object
The lead this loan came from. Send it on the first loan event; it is what makes lead → loan deterministic.
Free-form, kept as history. The value model reads five of them as the applicant entered them: loan_amount and property_value in dollars (or _cents), credit_range (or credit_band), app_type, product; and fico on whichever event first carries the pulled score.
object
A lead event. created fires the lead conversion; its occurred_at becomes the attribution anchor and is frozen.
A loan stage. funded carries the realised value; withdrawn, denied and dead are dead ends.
On funded: the realised gross revenue, in cents.
One lead event or one loan stage per call. identity must carry at least one recognised key; occurred_at is required; and the call names a lead or a loan by external_id (a loan also needs its stage). A loan is created only at app_started; everything before that belongs to the person and the lead.
object
Yours to choose, stable per event: relcu-lead-44821-created, vesta-L88213-funded. Re-sending returns 200 and writes nothing.
Any recognised key works; send what you have. Unrecognised keys are ignored. anon_id is the browser’s cookie value, read server-side from the _bid cookie or minted by the SDK.
object
The contact id in whatever is the system of record for contacts (today, likely the CRM): the spine id. octopus_id and los_contact_id are accepted as the same thing.
The visitor’s anonymous id from the first-party cookie.
object
Beeline Loans or Beeline Equity.
Free-form. Worth sending: status, vendor_source, cost_cents, submission_id (the page’s hidden field, so the pixel’s event and Stitch’s are one), declared_source (what the person said).
object
object
The lead this loan came from. Send it on the first loan event; it is what makes lead → loan deterministic.
Free-form, kept as history. The value model reads five of them as the applicant entered them: loan_amount and property_value in dollars (or _cents), credit_range (or credit_band), app_type, product; and fico on whichever event first carries the pulled score.
object
A lead event. created fires the lead conversion; its occurred_at becomes the attribution anchor and is frozen.
A loan stage. funded carries the realised value; withdrawn, denied and dead are dead ends.
On funded: the realised gross revenue, in cents.
Responses
Section titled “ Responses ”Seen before: the idempotency key matched, nothing was written.
object
Stitch’s id for the lead this event touched.
Stitch’s id for the loan this event touched.
true when the idempotency key had been seen: nothing was written, the status is 200.
Example generated
{ "personId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "leadId": "example", "loanId": "example", "duplicate": true}Written.
object
Stitch’s id for the lead this event touched.
Stitch’s id for the loan this event touched.
true when the idempotency key had been seen: nothing was written, the status is 200.
Example generated
{ "personId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "leadId": "example", "loanId": "example", "duplicate": true}Malformed JSON or a payload missing what the endpoint needs. The body says which.
object
What was wrong, in a sentence. A 401 carries unauthorized and nothing more.
Example generated
{ "error": "example"}No key, or a key the collector does not know. Nothing was written.
object
What was wrong, in a sentence. A 401 carries unauthorized and nothing more.
Example
{ "error": "unauthorized"}Only the method shown is served.