Add a lead
Post one lead into a lead list, and onto the campaign that list feeds, in a single call.
curl -X POST "https://www.inyoke.com/api/v1/lists/$LIST_ID/leads" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"firstName": "Ana", "lastName": "Rivera", "phone": "(305) 555-0123", "email": "ana@example.com", "state": "FL"}'The list decides the campaign, because a list feeds at most one. Find a list's id with GET /lists. If the list feeds no campaign, the lead is filed and campaign and enrollment come back null.
Needs a key with Read and write access, and the Import leads permission.
The lead
| Key | Notes |
|---|---|
phone | Required. Any common format. A number that can't be dialed answers 422. |
name, or firstName and lastName | The lead's name. |
email, notes, source | Optional. |
state, zip, city, address | Optional. state is what licensing checks against. |
fields | Your agency's own fields, as { "<field key>": "value" }, by the key the Fields page lists. At most 100. |
Every value is text of at most 500 characters. A key the lead doesn't take, or a field your agency doesn't have, is refused by name rather than dropped. The API never makes new fields.
The answer
{
"result": "created",
"lead": { "id": "cm2x9k1ld0003", "name": "Ana Rivera", "phone": "(305) 555-0123" },
"list": { "id": "cm2x9k1lt0002" },
"campaign": { "id": "cm2x9k1ab0001", "label": "Final expense Florida" },
"enrollment": { "state": "active" }
}result
| Value | Meaning |
|---|---|
created | A new lead was made and filed into the list. Status 201. |
matched | Your agency already had this lead. It was filed into the list. Status 200. |
already_called | Your agency has already called this number, so it was dropped: nothing was filed or enrolled, and lead is null. Status 200. |
enrollment.state
| Value | Meaning |
|---|---|
active | On the campaign and ready to be dialed. |
already_on | Already on the campaign, and nothing changed. |
blocked | The campaign's screening refused it. reasons lists why. |
held | Parked until someone on the campaign is licensed for the lead's state. |
not_enrolled | The lead couldn't be put on the campaign. reasons says why. |
Duplicates and retries
Adding a lead goes through the same duplicate rules and screening as an uploaded file. It's safe to retry: posting the same lead again finds the lead the first post made, files nothing new, and its enrollment reads already_on.
A key with Read and write access is told the name and phone of a matched lead you can see. A key that can only write is told its id and nothing else.