# Leads

# Load Leads

## <span style="color: rgb(2, 106, 73);">**API: Load Lead**</span>

###  **Description**

The **Load Lead API** allows you to register, import, and distribute leads within a call center platform. Its purpose is to centralize the capture of potential customers coming from campaigns, web forms, external databases, or CRM integrations, so they can later be managed by agents, auto dialers, or follow-up workflows.

<p class="callout info">**Note:** Api user for this function must have modify\_leads set to 1 and user\_level must be set to 8 or higher  
</p>

## 🔗 **URL**

#### https://DOMAIN.croco-dial.net/API/lmapi.php

<p class="callout info align-left">**Note:** Replace `DOMAIN` with the specific domain you want to query.</p>

### **📝 Required Parameters**  


<table border="1" id="bkmrk-parameter-value-desc" style="border-collapse: collapse; width: 100%; height: 179.094px;"><colgroup><col style="width: 28.7247%;"></col><col style="width: 71.2753%;"></col></colgroup><thead><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Parameter**</td><td style="height: 29.7969px;">**Description**</td></tr></thead><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">phone\_number</td><td style="height: 29.7969px;">must be all numbers, 6-16 digits.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">phone\_code</td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">must be all numbers, 1-4 digits, defaults to 1 if not set.</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">list\_id</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">must be all numbers, 3-12 digits, defaults to 999 if not set.</span></td></tr><tr style="height: 30.1094px;"><td style="height: 30.1094px;">source</td><td style="height: 30.1094px;"><span class="_aupe copyable-text xkrh14z">description of what originated the API call (maximum 20 characters)</span>.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">campaing</td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">must be the campaign to load the lead</span></td></tr></tbody></table>

### **Opcional Fields**

<table border="1" id="bkmrk-vendor_lead_code-1-2" style="border-collapse: collapse; width: 100%; height: 523.344px;"><colgroup><col style="width: 50.0596%;"></col><col style="width: 50.0596%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">vendor\_lead\_code</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-20 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">source\_id</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-50 characters</span></td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;"><span class="_aupe copyable-text xkrh14z">gmt\_offset\_now</span></td><td style="height: 46.5938px;"><span class="_aupe copyable-text xkrh14z">overridden by auto-lookup of phone\_code and area\_code portion of phone number if applicable</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">title </span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-4 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">first\_name</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-30 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">middle\_initial</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1 character</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">last\_name</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-30 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">address1</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-100 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">address2</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-100 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">address3</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-100 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">city</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-50 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">state</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">2 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">province</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-50 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">postal\_code</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">1-10 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">country\_code</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">3 characters</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">gender</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">U, M, F (Undefined, Male, Female) - defaults to 'U'</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">date\_of\_birth</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">YYYY-MM-DD</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">alt\_phone</span></td><td><span class="_aupe copyable-text xkrh14z">1-12 characters</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">email</span></td><td><span class="_aupe copyable-text xkrh14z">1-70 characters</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">security\_phrase</span></td><td><span class="_aupe copyable-text xkrh14z">1-100 characters</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">comments</span></td><td><span class="_aupe copyable-text xkrh14z">1-255 characters</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">multi\_alt\_phones</span></td><td><span class="_aupe copyable-text xkrh14z">5-1024 characters (see examples for more info)</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">rank</span></td><td><span class="_aupe copyable-text xkrh14z">1-5 digits</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">owner</span></td><td><span class="_aupe copyable-text xkrh14z">1-20 characters (user ID, Territory or user group)</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">entry\_list\_id</span></td><td><span class="_aupe copyable-text xkrh14z">WARNING! ONLY USE IF YOU KNOW WHAT YOU ARE DOING, CAN BREAK CUSTOM FIELDS! (must be all numbers, 3-12 digits, will not work if custom\_fields is set to Y)</span></td></tr></tbody></table>


### **Settings Fields**

<table border="1" id="bkmrk-dnc_check-y%2C-n-or-ar" style="border-collapse: collapse; width: 100%; height: 292.563px;"><colgroup><col style="width: 50.0596%;"></col><col style="width: 50.0596%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">dnc\_check</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">Y, N or AREACODE, default is N</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">campaign\_dnc\_check</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">Y, N or AREACODE, default is N</span></td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;"><span class="_aupe copyable-text xkrh14z">campaign\_id</span></td><td style="height: 46.5938px;"><span class="_aupe copyable-text xkrh14z">2-8 Character campaign ID, required if using campaign\_dnc\_check or callbacks</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">add\_to\_hopper</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">Y or N, default is N</span></td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">hopper\_priority</span></td><td style="height: 29.7969px;"><span class="_aupe copyable-text xkrh14z">99 to -99, the higher number the higher priority, default is 0</span></td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;"><span class="_aupe copyable-text xkrh14z">hopper\_local\_call\_time\_check</span></td><td style="height: 46.5938px;"><span class="_aupe copyable-text xkrh14z">Y or N, default is N. Validate the local call time and/or state call time before inserting lead in the hopper</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">usacan\_prefix\_check</span></td><td><span class="_aupe copyable-text xkrh14z">Y or N, default is N. Check for a valid 4th digit for USA and Canada phone numbers (cannot be 0 or 1).</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">usacan\_areacode\_check</span></td><td><span class="_aupe copyable-text xkrh14z">Y or N, default is N. Check for a valid areacode for USA and Canada phone numbers(also checks for 10-digit length).</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">nanpa\_ac\_prefix\_check</span></td><td><span class="_aupe copyable-text xkrh14z">Y or N, default is N. Check for a valid NANPA areacode and prefix, if optional NANPA data is on the system.</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">custom\_fields</span></td><td><span class="_aupe copyable-text xkrh14z">Y or N, default is N. Defines whether the API will accept custom field data when inserting leads into the vicidial\_list table</span>

<span class="_aupe copyable-text xkrh14z"> For custom fields to be inserted, just add the field label as a variable to the URL string</span>

<span class="_aupe copyable-text xkrh14z"> For example, if the field\_label is "favorite\_color" you would add "&amp;favorite\_color=blue".</span>

</td></tr><tr><td><span class="_aupe copyable-text xkrh14z">tz\_method</span></td><td><span class="_aupe copyable-text xkrh14z">&lt;empty&gt;, POSTAL, TZCODE or NANPA, default is &lt;empty&gt; which will use the country code and areacode for time zone lookups</span>

<span class="_aupe copyable-text xkrh14z"> POSTAL relies on the postal\_code field</span>

<span class="_aupe copyable-text xkrh14z"> TZCODE relies on the owner field being populated with a proper time zone code</span>

<span class="_aupe copyable-text xkrh14z"> NANPA relies on the optional NANPA areacode prefix data being loaded on your system.</span>

</td></tr><tr><td><span class="_aupe copyable-text xkrh14z">callback</span></td><td><span class="_aupe copyable-text xkrh14z">Y or N, default is N. Set this lead as a scheduled callback. campaign\_id field is REQUIRED for callbacks.</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">callback\_status</span></td><td><span class="_aupe copyable-text xkrh14z">1-6 Character, callback status to use, default is CALLBK (vicidial\_list status will be set to CBHOLD to lock.</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">callback\_datetime</span></td><td><span class="_aupe copyable-text xkrh14z">YYYY-MM-DD+HH:MM:SS, date and time of scheduled callback. REQUIRED if callback is set.</span>

<span class="_aupe copyable-text xkrh14z"> 'NOW' can be used for current datetime. 'xDAYS' can also be used where 'x' is replaced with a number of days in the future.</span>

</td></tr><tr><td><span class="_aupe copyable-text xkrh14z">callback\_type</span></td><td><span class="_aupe copyable-text xkrh14z">USERONLY or ANYONE, default is ANYONE.</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">callback\_user</span></td><td><span class="_aupe copyable-text xkrh14z">User ID the USERONLY callback is assigned to.</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">callback\_comments</span></td><td><span class="_aupe copyable-text xkrh14z">Optional comments to appear when the callback is called back.</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">lookup\_state</span></td><td><span class="_aupe copyable-text xkrh14z">Y or N, default is N. Looks up state field from areacode list. Only works if the 'state' field is not populated.</span></td></tr><tr><td><span class="_aupe copyable-text xkrh14z">list\_exists\_check</span></td><td><span class="_aupe copyable-text xkrh14z">Y or N, default is N. If the list\_id is not a defined list in the system, it will ERROR and not insert the lead.</span></td></tr><tr style="height: 80.1875px;"><td style="height: 80.1875px;"><span class="_aupe copyable-text xkrh14z">duplicate\_check</span></td><td style="height: 80.1875px;"><span class="_aupe copyable-text xkrh14z">Check for duplicate records in the system, can select more than one (duplicate\_check=DUPLIST-DUPTITLEALTPHONELIST)</span>

<span class="_aupe copyable-text xkrh14z"> If duplicate is found, will return error, the duplicate data and lead\_id and list\_id of existing record</span>

</td></tr></tbody></table>


#### **<span class="_aupe copyable-text xkrh14z">Here are the duplicate\_check options:  
  
</span>**

- <span class="_aupe copyable-text xkrh14z">**DUPLIST** - check for duplicate phone\_number in same list</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPCAMP** - check for duplicate phone\_number in all lists for this list's campaign</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPSYS** - check for duplicate phone\_number in entire system</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPPHONEALTLIST** - check for duplicate phone against phone\_number and alt\_phone in same list</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPPHONEALTCAMP** - check for duplicate phone against phone\_number and alt\_phone in all lists for this list's campaign</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPPHONEALTSYS** - check for duplicate phone against phone\_number and alt\_phone in entire system</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPTITLEALTPHONELIST** - check for duplicate title and alt\_phone in same list</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPTITLEALTPHONECAMP** - check for duplicate title and alt\_phone in all lists for this list's campaign</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPTITLEALTPHONESYS** - check for duplicate title and alt\_phone in entire system</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPNAMEPHONELIST** - check for duplicate first\_name, last\_name and phone\_number in same list</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPNAMEPHONECAMP** - check for duplicate first\_name, last\_name and phone\_number in all lists for this list's campaign</span>
- <span class="_aupe copyable-text xkrh14z"> **DUPNAMEPHONESYS** - check for duplicate first\_name, last\_name and phone\_number in entire system</span>
- <span class="_aupe copyable-text xkrh14z">" **1/2/3/7/14/15/21/28/30/60/90/180/360DAY** - Added to one of the above duplicate checks(i.e. "DUPSYS90DAY"), only checks leads loaded in last 90 days</span>





### **Request Examples:**

#### **GET :**

```bash
curl -X GET "https://DOMAIN.croco-dial.net/API/lmapi.php?user=MyUser&pass=MyPass&function=add_lead&phone_number=number_client&source=MyUser

```

#### **POST (Form Data):**

If you prefer to send the data as form parameters:

```bash
curl -X POST "https://DOMAIN.croco-dial.net/API/lmapi.php" \
  --data-urlencode "user=MyUser" \
  --data-urlencode "pass=MyPass" \
  --data-urlencode "function=add_lead" \
  --data-urlencode "phone_number=number_client" \
  --data-urlencode "source=MyUser"
```

####  **Example Response**

```
SUCCESS: add_lead LEAD HAS BEEN ADDED - 7275551111|6666|999|193715|-4
NOTICE: add_lead ADDED TO HOPPER - 7275551111|6666|193715|1677922
```

```
SUCCESS: add_lead LEAD HAS BEEN ADDED - 7275551111|6666|999|193716|-4
NOTICE: add_lead CUSTOM FIELDS VALUES ADDED - 7275551111|1234|101
NOTICE: add_lead CUSTOM FIELDS NOT ADDED, CUSTOM FIELDS DISABLED - 7275551111|Y|0
NOTICE: add_lead CUSTOM FIELDS NOT ADDED, NO CUSTOM FIELDS DEFINED FOR THIS LIST - 7275551111|1234|101
NOTICE: add_lead CUSTOM FIELDS NOT ADDED, NO FIELDS DEFINED - 7275551111|1234|101
NOTICE: add_lead MULTI-ALT-PHONE NUMBERS LOADED - 3|6666|193716
NOTICE: add_lead NOT ADDED TO HOPPER, OUTSIDE OF LOCAL TIME - 7275551111|6666|193716|-4|0
```

```
NOTICE: add_lead SCHEDULED CALLBACK ADDED - 1234|2011-09-29 12:00:01|TESTCAMP|6666|USERONLY|CALLBK
NOTICE: add_lead SCHEDULED CALLBACK NOT ADDED, USER NOT VALID - 1234|TESTCAMP|6|
NOTICE: add_lead SCHEDULED CALLBACK NOT ADDED, CAMPAIGN NOT VALID - 1234|XYZ
```

```
NOTICE: add_lead NANPA options disabled, NANPA prefix data not loaded - 0|6666
```

<p class="callout warning"> **Example Error**</p>

```
ERROR: add_lead INVALID PHONE NUMBER LENGTH - 72755|6666 
ERROR: add_lead INVALID PHONE NUMBER PREFIX - 72755|6666 
ERROR: add_lead INVALID PHONE NUMBER AREACODE - 72755|6666 
ERROR: add_lead INVALID PHONE NUMBER NANPA AREACODE PREFIX - 7275551212|6666
```

```
ERROR: add_lead USER DOES NOT HAVE PERMISSION TO ADD LEADS TO THE SYSTEM - 6666|0 
ERROR: add_lead NOT AN ALLOWED LIST ID - 7275551212|98762
ERROR: add_lead NOT A DEFINED LIST ID, LIST EXISTS CHECK ENABLED - 7275551212|12344
```

```
ERROR: NO FUNCTION SPECIFIED
```

```
ERROR: add_lead DUPLICATE PHONE NUMBER IN LIST - 7275551111|101|8765444
ERROR: add_lead DUPLICATE PHONE NUMBER IN CAMPAIGN LISTS - 7275551111|101|8765444|101
ERROR: add_lead DUPLICATE PHONE NUMBER IN SYSTEM - 7275551111|101|8765444|101
ERROR: add_lead DUPLICATE PHONE NUMBER IN LIST - 7275551111|101|8765444|PHONE
ERROR: add_lead DUPLICATE PHONE NUMBER IN CAMPAIGN LISTS - 7275551111|101|8765444|101|ALT
ERROR: add_lead DUPLICATE PHONE NUMBER IN SYSTEM - 7275551111|101|8765444|101|PHONE
ERROR: add_lead DUPLICATE TITLE ALT_PHONE IN LIST - 1234|7275551111|101|8765444
ERROR: add_lead DUPLICATE TITLE ALT_PHONE IN CAMPAIGN LISTS - 1234|7275551111|101|8765444|101
ERROR: add_lead DUPLICATE TITLE ALT_PHONE IN SYSTEM - 1234|7275551111|101|8765444|101
ERROR: add_lead DUPLICATE NAME PHONE IN LIST - Bob|Smith|7275551113|101|8765444|101
ERROR: add_lead DUPLICATE NAME PHONE IN CAMPAIGN LISTS - Bob|Smith|7275551113|101|8765444|101
ERROR: add_lead DUPLICATE NAME PHONE IN SYSTEM - Bob|Smith|7275551113|101|8765444|101
```