Skip to content

A lead event or a loan stage

POST
/v1/conversion
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.

Media type application/json
Any of:

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
idempotency_key

Yours to choose, stable per event: relcu-lead-44821-created, vesta-L88213-funded. Re-sending returns 200 and writes nothing.

string
identity

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
relcu_contact_id

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.

string
octopus_id
string
los_contact_id
string
relcu_lead_id
string
vesta_borrower_id
string
vesta_loan_number
string
magicblocks_contact_id
string
anon_id

The visitor’s anonymous id from the first-party cookie.

string
lead
required
object
external_id
required
string
brand_id

Beeline Loans or Beeline Equity.

string
Allowed values: bll ben
attrs

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
key
additional properties
any
loan
object
external_id
required
string
lead_external_id

The lead this loan came from. Send it on the first loan event; it is what makes lead → loan deterministic.

string
brand_id
string
Allowed values: bll ben
attrs

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
key
additional properties
any
event

A lead event. created fires the lead conversion; its occurred_at becomes the attribution anchor and is frozen.

string
Allowed values: created contacted connected qualified disqualified nurture_started app_started recycled dead
stage

A loan stage. funded carries the realised value; withdrawn, denied and dead are dead ends.

string
Allowed values: app_started app_submitted credit_pulled conditional_approval appraisal docs_out clear_to_close funded withdrawn denied dead
occurred_at
One of:
integer format: int64
value_cents

On funded: the realised gross revenue, in cents.

integer
value_measure
string
default: gross_revenue
value_state
string
default: realized
Allowed values: predicted realized

Seen before: the idempotency key matched, nothing was written.

Media type application/json
object
personId
required
string format: uuid
leadId
required

Stitch’s id for the lead this event touched.

string | null
loanId
required

Stitch’s id for the loan this event touched.

string | null
duplicate
required

true when the idempotency key had been seen: nothing was written, the status is 200.

boolean
Example generated
{
"personId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"leadId": "example",
"loanId": "example",
"duplicate": true
}

Written.

Media type application/json
object
personId
required
string format: uuid
leadId
required

Stitch’s id for the lead this event touched.

string | null
loanId
required

Stitch’s id for the loan this event touched.

string | null
duplicate
required

true when the idempotency key had been seen: nothing was written, the status is 200.

boolean
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.

Media type application/json
object
error
required

What was wrong, in a sentence. A 401 carries unauthorized and nothing more.

string
Example generated
{
"error": "example"
}

No key, or a key the collector does not know. Nothing was written.

Media type application/json
object
error
required

What was wrong, in a sentence. A 401 carries unauthorized and nothing more.

string
Example
{
"error": "unauthorized"
}

Only the method shown is served.