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).
1. Show the consent sentence
Ask for consent in a calculation's answer (it is included unless you narrow include):
Code
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
Code
Code
The answer is 202: the lead is taken in, and your institution captures it within a minute or so.
consent.agreedAtis 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.emailmust be an address mail can reach (pat@example.com, notpat@example.c).calculatoris the slug of the calculator the person used, andinputswhat it was given: a calculator we have (404unknown-calculatorotherwise), 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 insideconsentandclient. consent.idcomes from an answer'sinstitution.consent. If answers carry none, your institution turns the consent sentence on, on its API answers screen.nameandpostalCodeonly 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.localeis 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.ipAddressmust be an IPv4 or IPv6 address.email,nameandpostalCodeare 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'sreferenceand its status now, with the headerIdempotent-Replayed: true. A different lead under a key already used is refused with 422idempotency-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
Code
pending until it is captured, usually within a minute, then accepted, or refused with a reason:
| Reason | What happened | What to do |
|---|---|---|
capture-off | The 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-changed | The consent sentence changed between the person agreeing and the capture. | Show the new sentence from the consent extra and ask again. |
field-not-collected | A name or postal code the institution no longer collects. | Send the lead without it. |
refused | Another capture check, such as consent not given. | Check what you sent against the institution's settings. |
failed | We 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.