Skip to main content

Lead Sync Webhook

Use the lead-sync webhook to push a new lead into Reflekt Legal the moment your system captures it. Send one POST request with JSON, and we match the person against your existing leads by phone or email — creating them if they are new — enroll them with your assistant, and start outreach.

Any system that can send an HTTP request can use this: your website's intake form, your CRM, or an automation tool like Zapier or Make. No plugin or vendor-specific integration is required.

Already sending leads to /api/v1/lead?

An older form-encoded endpoint, POST /api/v1/lead, still accepts leads and existing integrations keep working. Move to this webhook when you can: the older endpoint returns a success response even when the campaign name matches nothing and the lead is never enrolled, so a broken integration can look healthy for weeks. This webhook returns an error instead, so you find out at setup time. Contact support@reflektlegal.ai if you need help switching.

Endpoint​

POST https://us-api.reflektlegal.ai/api/v1/webhooks/lead-sync
  • Method: POST
  • Payload type: JSON (Content-Type: application/json)

Canadian accounts use https://ca-api.reflektlegal.ai in place of the US host. Everything else is identical.

Prerequisites​

Before you begin, make sure you have:

  • An active Reflekt Legal account.
  • Your project API key. Find it under your project's Integrations settings — it begins with lap_live_.
  • Your environment internal name. This is the assistant that will handle the lead, and it is often different from the assistant's display name. Ask the Reflekt Legal team for the exact value.
  • An assistant that is set up to receive synced leads. The Reflekt Legal team configures this; if it is not switched on, the endpoint returns a 422.
caution

Treat your API key like a password. Store it in your secrets manager and only send it from a trusted server, never from public client-side code. Ask the Reflekt Legal team to send it through a secure link rather than by email or chat.

Authentication​

Send your project API key in the X-Api-Key header:

X-Api-Key: lap_live_YOUR_KEY

The key is also accepted as an ?api_key= query string parameter, for parity with the older endpoints. Prefer the header: query strings are recorded in web server and proxy logs along the way, and headers are not.

A missing or invalid key returns a 401.

Request Fields​

Send the lead data as a JSON object. Field names are camelCase.

FieldRequiredNotes
environmentNameYesThe assistant that will handle this lead. Use the environment's internal name, not its display name. Matched exactly, including capitalization. Ask the Reflekt Legal team for the exact value.
phoneNumberConditionallyAt least one of phoneNumber or email is required. Any reasonable format works — it's normalized server-side (E.164).
emailConditionallyAt least one of phoneNumber or email is required. Must be a deliverable address.
firstNameNoTrimmed and auto-capitalized.
lastNameNoTrimmed and auto-capitalized.
companyNameNoLegal suffixes such as LLC or Inc. are stripped.
addressNoFree-form postal address. Stored as sent.
notesNoFree-text context about the lead. Your assistant reads this, so anything the caller told your form belongs here.
How leads are matched

We match on phoneNumber first, then fall back to email, within your project only. Send both when you have both: whichever one we did not already have is written back, so a lead whose phone number changed stays a single record instead of splitting into two.

Only the fields you actually send are written. Omitting a field keeps whatever value we already hold; sending it explicitly as null clears it.

Example Request​

Replace the placeholder values with your own.

curl -X POST https://us-api.reflektlegal.ai/api/v1/webhooks/lead-sync \
-H "X-Api-Key: YOUR_PROJECT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"environmentName": "YOUR_ENVIRONMENT_INTERNAL_NAME",
"firstName": "Jane",
"lastName": "Doe",
"phoneNumber": "+15551234567",
"email": "jane@example.com",
"notes": "Rear-ended on I-35 on Oct 2. Treated at urgent care. Came in from the website contact form."
}'

Response​

{
"leadId": 2347093,
"created": true,
"updated": false,
"enrolled": true,
"jobId": 88142,
"taskName": "Chase Event"
}
FieldNotes
leadIdThe lead we created or matched. Stable — sync the same person again and you get the same id back. Store it to correlate your records with ours.
createdtrue when no existing lead matched and a new one was made.
updatedtrue when an existing lead had at least one field written.
enrolledtrue when this call moved the lead into the environment. false means it was already there, which is normal on a repeat sync — the assistant still runs.
jobIdThe queued job. Quote this to the Reflekt Legal team if you need a run traced.
taskNameThe assistant task this call started.

Status Codes​

A 200 always means the lead is enrolled and the assistant has been queued to work it. There is no "accepted but nothing happened" response to interpret — every way a request can fall short of that is a different status code, so you never have to parse the body to find out whether it worked.

CodeMeaning
200Done. The lead is enrolled and the assistant is queued.
400No contact details, an unparseable phone number, or an undeliverable email address.
401Missing or invalid API key.
409Another sync for this same person is still in flight. Nothing was written — wait a moment and retry.
422Well-formed but not runnable: an environmentName we don't recognize, or an assistant that isn't set up to receive synced leads.
429Over the limit of 1,000 requests per hour. The Retry-After header says how long to wait.

Retry on 409 and 429. Do not blind-retry a 400 or 422 — the request will fail the same way until the payload or the configuration changes.

Verify​

Confirm the integration is working:

  1. Send a test request with the example above, using a phone number you control.
  2. Confirm the new lead appears in your Reflekt Legal project, under the environment you named.
  3. Confirm the assistant makes contact. A live assistant really will call that number, and that call is your proof the whole chain works.
  4. Delete the test lead. A leftover test record on the same phone number can block a real lead later.

Troubleshooting​

422 mentioning the environment. The environmentName doesn't match any environment on your project. It is matched exactly, so check spelling and capitalization, and confirm you are using the internal name rather than the display name. Nothing is written when this happens — the destination is resolved before we touch the lead — so you can correct it and resend safely.

422 about no task being wired. Your assistant is not set up to act on synced leads yet. This is configured on the Reflekt Legal side, not in your request. Send the response body to the Reflekt Legal team and they will switch it on.

200 but no call happens. The lead is enrolled and queued, so the hold-up is in the assistant's schedule rather than the integration — outreach respects your configured working hours and daily contact limits. If it still doesn't fire, quote the leadId and jobId from the response.

You are not sure the request reached us. Every call to this endpoint is recorded, including the ones we rejected. The Reflekt Legal team can look up exactly what arrived and what we answered, searching by the phone number or email you sent.

If you need help validating your setup, contact support@reflektlegal.ai.