Documentation

Leads

When a person asks your institution to contact them from your own app or chatbot, send the lead here. It goes where your institution's calculator pages send theirs: its routing, notifications, CRM and webhooks.

You need a key with the leads scope, which your Administrators choose when they make the key, and your institution needs lead capture turned on. Leads aren't counted against the calculation quota; each integration may send 60 a minute (10 with a test key).

Ask for consent in a calculation's answer (it is included unless you narrow include):

JSONCode
"institution": { "consent": { "id": "4f1c…e9", "text": "We may contact you about your results." } }

Show the person text, in full, before they give their details. Keep id: it is how the lead says which words they agreed to.

2. Send the lead

TerminalCode
curl https://api.fincalc.com/v2/leads \ -H "Authorization: Bearer $FINCALC_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 6f2d4c7a-0b9e-4e7a-9a51-3b1f2c8d9e01" \ -d '{ "email": "pat@example.com", "calculator": "auto-loan-accelerated-payoff", "inputs": { "loanAmount": 25000, "termMonths": 60 }, "consent": { "id": "4f1c…e9", "agreedAt": "2026-11-27T19:55:00Z" } }'
JSONCode
{ "reference": "01JDZ3K6Q8F0V9S2B7M4N1C5XA", "status": "pending" }

The answer is 202: the lead is taken in, and your institution captures it within a minute or so.

  • consent.agreedAt is when the person agreed, within the last 24 hours. Send a lead when it is collected, not in a batch later. The example's time above is long past, so a copy of it is refused: send your own, and keep the sending server's clock right.
  • email must be an address mail can reach (pat@example.com, not pat@example.c).
  • calculator is the slug of the calculator the person used, and inputs what it was given: a calculator we have (404 unknown-calculator otherwise), licensed for the API to a live key, and only inputs it takes. Inputs need their calculator. Both may be left out.
  • Only the fields here. A field a lead doesn't have (phone, say) is refused by name, not dropped, so nothing you send is silently lost. The same goes inside consent and client.
  • consent.id comes from an answer's institution.consent. If answers carry none, your institution turns the consent sentence on, on its API answers screen.
  • name and postalCode only if your institution collects them; sending one it doesn't is refused rather than dropped. A name has letters in it, and no markup or web addresses; a postal code is letters and digits, with spaces or hyphens between them.
  • locale is the language the person saw the sentence in, if not your institution's own.
  • client (ipAddress, userAgent) is what your app saw of the person's device, kept with the consent record. ipAddress must be an IPv4 or IPv6 address.
  • email, name and postalCode are one line of text each: a control character or line break in one is refused.
  • Idempotency-Key: send the same lead again with the same key, after a timeout say, and it is never captured twice. The answer is the first lead's reference and its status now, with the header Idempotent-Replayed: true. A different lead under a key already used is refused with 422 idempotency-key-reused: use a new key for each lead. A key finds its lead for a day after it is captured.

If the sentence changed between showing it and sending the lead, the answer is 409 consent-not-current: show the new sentence and ask again.

3. Check it, if you need to

TerminalCode
curl https://api.fincalc.com/v2/leads/01JDZ3K6Q8F0V9S2B7M4N1C5XA \ -H "Authorization: Bearer $FINCALC_KEY"

pending until it is captured, usually within a minute, then accepted, or refused with a reason:

ReasonWhat happenedWhat to do
capture-offThe institution turned lead capture off, or removed the consent sentence in that language, after you sent the lead.Nothing to retry; ask the institution.
consent-changedThe consent sentence changed between the person agreeing and the capture.Show the new sentence from the consent extra and ask again.
field-not-collectedA name or postal code the institution no longer collects.Send the lead without it.
refusedAnother capture check, such as consent not given.Check what you sent against the institution's settings.
failedWe couldn't capture it, for a reason on our side, for an hour.Send it again with the same Idempotency-Key: it is taken in again, under a new reference.

The status is kept for a week.

A test key's leads are marked as tests: your institution sees them, and they are removed sooner.

Last modified on