HomeVICIdial TutorialsVICIdial Non Agent API TutorialsHow to Extract a Single Lead Field Using lead_field_info API

How to Extract a Single Lead Field Using lead_field_info API

VICIdial is a powerful open-source call center solution that enables businesses to manage leads efficiently. One of its most useful API functions for retrieving specific lead data is lead_field_info.

This API allows users to extract a single lead field (such as phone number, email, status, or any other data point) without retrieving the entire lead record.

Why Use the lead_field_info API?

Faster data retrieval – Extract only the necessary lead field
Optimized CRM integrations – Retrieve specific data points without excess data
Reduces server load – Minimizes unnecessary API requests
Improves efficiency – Quickly access lead details when needed

In this guide, we’ll cover:
🔹 What the lead_field_info API does
🔹 How to configure and authenticate API access
🔹 How to construct and send API requests
🔹 Examples using a browser, cURL, and Postman
🔹 Understanding API responses and troubleshooting errors
🔹 Best practices for using the lead_field_info API efficiently

Let’s dive in! 🚀


Understanding the lead_field_info API Function

The lead_field_info API retrieves a specific field value from a lead record. Instead of fetching an entire lead profile, this API allows you to extract only the data you need, making it ideal for lightweight API requests and system optimizations.

Key Features of lead_field_info API

✔ Retrieve a single lead field instead of the full record
✔ Works with standard and custom lead fields
✔ Ideal for real-time CRM integrations
✔ Reduces API response size and load time

Common Use Cases

🔹 Retrieve only a lead’s phone number or email address
🔹 Check the current status of a lead before contacting
🔹 Extract a specific custom field for data processing
🔹 Optimize API queries by fetching minimal data


Step 1: Prerequisites for Using the API

Before using the lead_field_info API, ensure you have:

VICIdial installed and configured
An API-enabled user account with the correct permissions
A valid lead ID and field name to query
VICIdial server access credentials

How to Enable API Access in VICIdial

1️⃣ Log in to the VICIdial Admin Panel
2️⃣ Navigate to Admin > Users
3️⃣ Select the user who will access the API
4️⃣ Set API Access to 1 (Enabled)
5️⃣ Set User Level to 7 or higher**
6️⃣ Add lead_field_info to the Allowed API Functions (or set to ALL)
7️⃣ Click Save Changes

Now, your user is authorized to retrieve specific lead fields using the API.


Step 2: Constructing the API Request

The VICIdial API uses HTTP GET requests, meaning you can access it via a browser, cURL, or API tools like Postman.

Base API URL

arduino
http://your-vicidial-server/vicidial/non_agent_api.php

🔹 Replace your-vicidial-server with your actual VICIdial instance.

Required Parameters for lead_field_info API

Parameter Description Example
function Specifies the API function (lead_field_info) lead_field_info
user VICIdial API username admin
pass VICIdial API password 1234
source Identifier for tracking API calls CRM_Query
lead_id The ID of the lead to query 1001
field The specific field to retrieve phone_number

Step 3: Sending the API Request

Method 1: Retrieving a Lead Field via a Web Browser

Simply enter the following URL in your browser (replace credentials accordingly):

pgsql
http://your-vicidial-server/vicidial/non_agent_api.php?function=lead_field_info&user=admin&pass=1234&source=CRM_Query&lead_id=1001&field=phone_number

🔹 Press Enter, and the API response should display the requested field.


Method 2: Retrieving a Lead Field via cURL (Command Line)

For developers, cURL is a convenient tool for making API requests. Use the following command:

bash
curl -X GET "http://your-vicidial-server/vicidial/non_agent_api.php?function=lead_field_info&user=admin&pass=1234&source=CRM_Query&lead_id=1001&field=phone_number"

🔹 This will return the lead field information directly in the terminal.


Method 3: Retrieving a Lead Field via Postman

1️⃣ Open Postman
2️⃣ Set the request type to GET
3️⃣ Enter the API URL
4️⃣ Click Send
5️⃣ View the API response in the output panel


Step 4: Understanding API Responses

If the request is successful, VICIdial returns a response containing only the requested field:

9876543210

Breaking Down the Response

Response Meaning
9876543210 The phone number of lead ID 1001

Step 5: Handling Errors & Troubleshooting

If something goes wrong, VICIdial will return an error message instead of the requested field.

Common Errors & Fixes

Error Message Cause Solution
ERROR: USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION Insufficient API permissions Ensure user level is 7+ and API Access is enabled
ERROR: INVALID USERNAME OR PASSWORD Wrong credentials Verify API username and password
ERROR: NO FUNCTION SPECIFIED Missing function parameter Ensure function=lead_field_info is included
ERROR: INVALID FIELD NAME The field does not exist Check field spelling and verify it exists in VICIdial

Step 6: Best Practices for Using the lead_field_info API

Use only necessary fields to optimize API requests
Ensure the API user has correct permissions to avoid errors
Test different fields and lead IDs to validate responses
Monitor API usage logs for performance tracking
Integrate the API with CRMs or reporting tools for automation


Conclusion

The lead_field_info API function is an essential tool for retrieving specific lead details in VICIdial. Whether you need to fetch a phone number, status, or email address, this API ensures quick and efficient data retrieval without fetching unnecessary information.

📌 Key Takeaways

✅ The lead_field_info API extracts a single lead field
✅ Requires an API-enabled user with appropriate permissions
✅ API requests can be made via browser, cURL, or Postman
✅ Common errors are permission and input-related and can be fixed in Admin settings

Feel free to contact us or simply start a live chat to get connected to one of our team members. Here is our contact information.

Calling from US: +1 954-990-0053
Email: office@callix.ai

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Special Offerspot_img

Must Read

spot_img
spot_img
spot_img

Related Articles - Must Read

spot_img